MyCo's and MV's Oversampling Toolkit

Post any examples or modules that you want to share here
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

MyCo's and MV's Oversampling Toolkit

Post by martinvicanek »

MyCo's oversampling toolkit from the past (Synthmaker?) days. I remember there used to be a tutorial on the SM forum. Anybody has a copy?
Attachments
Oversampling Kit (MyCo & MV).fsm
Filters tweaked by MV and added 4x oversampling, fixed a minor bug
(811.66 KiB) Downloaded 838 times
Oversampling Kit 4 (MyCo).fsm
MyCo's Oversampling Toolkit
(103.97 KiB) Downloaded 867 times
Last edited by martinvicanek on Tue Apr 26, 2022 4:45 pm, edited 2 times in total.
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: MyCo's Oversampling Toolkit

Post by Spogg »

Thanks for this Martin.

Back in 2016 there was a discussion about oversampling in FS using the technique in the toolkit:

viewtopic.php?f=2&t=4383&p=24759

I didn’t understand it then and, 6 years later, I still don’t get it. :oops:

Please forgive me again, but if FS evaluates a whole schematic once per sample how do we achieve a sample rate of 88.2 KHz? I know the technique somehow splits the stream into “odd and even” (whatever that means) and the two halves are processed in ASM at the same time, in parallel, and recombined later. :?

I guess what I really need is a book called “Oversampling in FlowStone for Dummies”. :lol:
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: MyCo's Oversampling Toolkit

Post by martinvicanek »

HI gang, I know this is not at all an obvious matter, so I whipped up a little demo/tutorial with application examples. Hope it helps. :)
Attachments
Oversampling_demo_and_tutorial_v2.fsm
Updated 24.April 2022, added 4x oversampling
(782.05 KiB) Downloaded 806 times
Last edited by martinvicanek on Sun Apr 24, 2022 9:57 am, edited 2 times in total.
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: MyCo's Oversampling Toolkit

Post by Spogg »

Thank you SO much for the tutorial and worked examples. :D

I spent quite some time puzzling over this and I found the DSP code versions of up and down sampling filter number 1 really useful, because I could work out what the code was doing. I also auditioned the Tanh(x) thing as well as the naïve saw and the results were striking to me.

Based on me listening rather than going by the graphs, I found the audio results absolutely fine with the simplest up/down selected. So although I could see the differences I could barely hear them (on good headphones)!

I think I get the ODD/EVEN thing now. I checked, and swapping odd/even still worked, so they could be called a/b or x/y or whatever. “Odd/even” was a stumbling block for me before, but I guess it relates to sample number 1 when a channel opens, then 2 and then 3 and so on.

The big light came on for me when I realised that a single sample pass of an up-sampling code block (or saw osc) would generate 2 non-identical stream values per sample period so, for example, you get 2 outputs separated by half the difference between the current and previous value. The 2 different values are generated at 44100 with a nyquist of 22050 for both signal paths (odd/even). What seems to be happening with down-sampling is the aliasing is reduced by averaging between 2 successive samples for the odd and even and this is the bit that still puzzles me I’m afraid. Clearly it works successfully and is useful, but I’m surprised at just how much the aliasing is reduced.

BTW Martin, are you a native English speaker? Your text was perfect and I wouldn’t have edited even one word!
Tepeix
Posts: 361
Joined: Sat Oct 16, 2021 3:11 pm

Re: MyCo's Oversampling Toolkit

Post by Tepeix »

Yep thanks, very interesting and detailed !

I had also difficulty to hear the difference, even with a naive square.
But once placed in a simple synth with envelope i could clearly hear it !)
Attachments
Test oversample naive square.fsm
(125.13 KiB) Downloaded 811 times
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: MyCo's Oversampling Toolkit

Post by tulamide »

martinvicanek wrote:HI gang, I know this is not at all an obvious matter, so I whipped up a little demo/tutorial with application examples. Hope it helps. :)

Without having read it, here's how I'd do it (or not do it):
I double, quadruple, or whatever the rate increase is, each sample, then do some magic and finally average the doubled/quadrupled etc values down to one again.

Problem is, I suck at magic :lol:
"There lies the dog buried" (German saying translated literally)
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: MyCo's Oversampling Toolkit

Post by Spogg »

tulamide wrote:... I double, quadruple, or whatever the rate increase is, each sample...


Once I’d kinda worked out what was going on I started to wonder if you could generate 4 non-identical values per sample period. But then my brain hung up.
:lol:
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: MyCo's Oversampling Toolkit

Post by martinvicanek »

You can cascade the 2x oversampling units to achieve 4x, 8x, etc. Perhaps I should include that in the tutorial. Hmm.
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: MyCo's Oversampling Toolkit

Post by Spogg »

martinvicanek wrote:You can cascade the 2x oversampling units to achieve 4x, 8x, etc. Perhaps I should include that in the tutorial. Hmm.

Oh wow! Yes please!
adamszabo
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: MyCo's Oversampling Toolkit

Post by adamszabo »

Very interesting Martin, thanks for the tutorial! I am particularly interested in the 2x upsampled naive saw. I assume it outputs the odd and even samples only? I am still not quite sure how that works, can one visualize it somehow with a graph so we see that they only go to even and odd ones? Or I am misunderstanding something?
Post Reply