Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

FINALLY - a way to to OVERSAMPLE your schematic for real!!!

DSP related issues, mathematics, processing and techniques

FINALLY - a way to to OVERSAMPLE your schematic for real!!!

Postby KG_is_back » Sat Jan 27, 2018 2:16 am

I have been messing around with the "call of Cuthulu" and I may have come up with something game-changing.... A way to oversample sections of your schematic. And I mean really oversample, as in execute the portion of your stream multiple times per sample!!!
It is not limited to assembler!!! You can put in any module with stream inputs/outputs and it will run that module at N-times the sample rate!!!

Now, this module is not fully finished. For proper oversampling the inputs and outputs should be low-passed at Nyquist/N frequency to remove aliasing. I haven't quite done that yet, because I was so excited to share this discovery with you.

The mechanism is actually very simple. In first ASM block in the signal chain I call the "call of Cuthulu" to get the memory address of the machine code at that point. I pass that value to the last ASM block in the signal chain. That one simply does call to that value which makes everything between the first and second ASM blocks repeat again and again. I added counter which breaks that infinite loop after N iterations. (there's a bit more details to it, that I may go over later).

Keep in mind that this will merely make the stream run at N-times the speed - if that code is samplerate dependent (ie. EQ, adsr, delays) you will have to modify them. Typically, multiplying the output of any samplerate prim by the oversampling ratio will do the trick. Some prims, however, read the samplerate in "hidden" way (for example the pitch to freq prims) - you will have to replace them.
Attachments
oversampler.fsm
(1.36 KiB) Downloaded 1799 times
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: FINALLY - a way to to OVERSAMPLE your schematic for real

Postby adamszabo » Sat Jan 27, 2018 3:05 am

Cool! Id love to see some real life examples
adamszabo
 
Posts: 657
Joined: Sun Jul 11, 2010 7:21 am

Re: FINALLY - a way to to OVERSAMPLE your schematic for real

Postby Spogg » Sat Jan 27, 2018 11:59 am

Very exciting, I can see why you’re so pleased!

Like Adam said, it would be lovely to see something, maybe with an A/B comparison, to demo the advantage of this true oversampling.

Can the schematic “inside” the system operate on individual samples independently? For example, for better interpolation?

Cheers

Spogg
User avatar
Spogg
 
Posts: 3318
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: FINALLY - a way to to OVERSAMPLE your schematic for real

Postby KG_is_back » Sat Jan 27, 2018 1:16 pm

Ok, here's an example. A bitcrusher. A true ideal bitcrusher should only reduce the amplitude resolution ie. distort the wave into stairs. That means it should only add harmonics and no additional disharmonic noise. That means if you bitcrush frequencies above cca. 12000Hz you should hear no difference (because the harmonics should be outside range of hearing). In reality naive bitcrusher adds massive amount of aliasing because at 44kHz sample rate the harmonics reflect back into audible range. This aliasing can be reduced by oversampling the bitcrusher and low-passing it, so that only harmonics below 20000Hz are there.

In this schematic you have two identical bitcrushers (the knob in the schematic controls the bit resolution of both). one is not oversampled and the other is (it is buried inside the oversampled module). You can switch the selector to see and hear one or the other. You can even increase the oversampling to further reduce the aliasing - it is clearly audible every single time you increase/decrease oversampling.
Attachments
oversampler_v2.fsm
(143.01 KiB) Downloaded 1761 times
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: FINALLY - a way to to OVERSAMPLE your schematic for real

Postby Spogg » Sat Jan 27, 2018 1:41 pm

OMG what a difference!

Fantastic demo KG.

I see the CPU increases, on my system, from 0.3 to 2.6 so is this just down to the oversampling magic? If there was more going on "inside" the oversampler would this be multiplied too or is it just the over sampling part?

EDIT: I just kinda answered this myself by deleting the Nyquist filters and found it's those that were taking up most of the extra overhead.

Thanks for sharing this. Brilliant!

Spogg
User avatar
Spogg
 
Posts: 3318
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: FINALLY - a way to to OVERSAMPLE your schematic for real

Postby KG_is_back » Sat Jan 27, 2018 2:07 pm

Spogg wrote:EDIT: I just kinda answered this myself by deleting the Nyquist filters and found it's those that were taking up most of the extra overhead.



I should mention that in current state the oversampling is not very mathematically done :-D I'm not quite sure HOW to interpolate the samples. At the moment I just take the input, oversample it into stairs (for example in 4x oversampling, I just take the original and keep it constant 4 samples, change with new value, keep constant, etc.). I then "smooth out" the stairs using a strong low-pass filter at Niquist/N (where N is the oversampling ratio).
I do the same on output just in reverse - strong low-pass (BTW this where the aliasing actually gets removed) and then take the LAST sample as the downsampled version. I know That this last step effectively delays the output by (N-1)/N samples - I could fix that by taking the first only, but I was lazy....

I'm certain that there are better more rigorous ways to do the up-sampling filter. For example the old way we used to oversample, was to take the input, interlace the input with zeros and low-pass that. The interlacing only introduces frequencies above original Nyquist. My experiments show that doing that stair-lowpass that I did actually introduces phase-shift/delay of 1/N samples.

I REALLY need some serious help with this...
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: FINALLY - a way to to OVERSAMPLE your schematic for real

Postby Spogg » Sat Jan 27, 2018 2:15 pm

I just heard Martin’s “Someone needs a filter” alarm going off :lol:
User avatar
Spogg
 
Posts: 3318
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: FINALLY - a way to to OVERSAMPLE your schematic for real

Postby KG_is_back » Sat Jan 27, 2018 2:35 pm

The biggest joke of all of this is, that this oversampling trick was actually possible all the way since flowstone was released. In fact it could have been done even back in the days of synthmaker (though ruby made it much easier to implement). Difficulty of implementing oversampling was always a major hurdle in making high-quality audio-plugins with synthmaker/flowstone.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: FINALLY - a way to to OVERSAMPLE your schematic for real

Postby adamszabo » Sat Jan 27, 2018 2:49 pm

Yeah, this is really amazing, I hope other chime in too, as this is a bit over my head at the moment
adamszabo
 
Posts: 657
Joined: Sun Jul 11, 2010 7:21 am

Re: FINALLY - a way to to OVERSAMPLE your schematic for real

Postby tulamide » Sat Jan 27, 2018 3:02 pm

Hmm, why am I experiencing something completely different? I started the schematic, it all went ok, then I switched the selector to the oversampling module and Flowstone crashed immediately.

Maybe it is not compatible back to the stoneage? Using v3.0.6 of Flowstone, that's why I ask.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2686
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Next

Return to DSP

Who is online

Users browsing this forum: No registered users and 32 guests