Oversampling Toolkit

Sound synthesis techniques, DSP and related mathematics

Moderators: electrogear, exonerate

Oversampling Toolkit

Postby Andrew J on Tue Jun 03, 2008 2:46 pm

Hi all,

As hinted elsewhere on the forum, I've been working on a toolkit for oversampling - and now it's ready! So take a look at the wiki tutorial (which is inside the DSP section of the tutorials). You'll find a schematic containing the ASM-optimised filters towards the bottom of the page, there's also an example schematic to play with.

Thanks to sambean for originally providing the code for the polyphase IIR filter, and to aliasant for user testing and feedback.

Please post any comments/issues here.

Regards,
Andrew J
Andrew J
smanatic
 
Posts: 617
Joined: Tue May 29, 2007 4:53 am
Location: Australia

Re: Oversampling Toolkit

Postby aliasant on Tue Jun 03, 2008 5:39 pm

Simply amazing work. Im stunned! Speechless.
Out of words. Knocked to the floor.
:D
It's never to late to be late.....
http://martinrodensjo.smugmug.com/
User avatar
aliasant
smunatic
 
Posts: 2388
Joined: Sat Dec 30, 2006 5:49 pm
Location: Sweden

Re: Oversampling Toolkit

Postby sunsynth on Tue Jun 03, 2008 7:57 pm

I second that and i am the 2nd on the floor ;)

SUNsynth
User avatar
sunsynth
smaniac
 
Posts: 1496
Joined: Mon Sep 11, 2006 3:27 pm
Location: HH - Made in Germany

Re: Oversampling Toolkit

Postby exonerate on Tue Jun 03, 2008 8:23 pm

Thanks andrew :)

Have to study this some more, but I think your tutorial and example will help me to get my head around oversampling at last!

It seems that in your example schematic the triangular and power oversampling requires a gain boost by the oversampling factor to be at the same volume level as the polyphase. I guess thats to do with the quality of the filters and the roll off?

Cheers :D

Exo
Flowstone Guru Blog and download site for Flowstone /Synthmaker!
Fightware - My Mobile fitness apps.
User avatar
exonerate
smaniac
 
Posts: 1504
Joined: Sat Dec 30, 2006 1:57 pm
Location: England, West Yorkshire, Huddersfield

Re: Oversampling Toolkit

Postby kirkagur on Tue Jun 03, 2008 9:23 pm

I must say that I am "on the ceiling" like all the others!

very useful stuff a lot to learn!

thx!!!!!!!!!!
User avatar
kirkagur
essemilian
 
Posts: 365
Joined: Mon Jul 10, 2006 3:14 pm

Re: Oversampling Toolkit

Postby TomC on Tue Jun 03, 2008 9:30 pm

Andrew J wrote:Hi all,

As hinted elsewhere on the forum, I've been working on a toolkit for oversampling - and now it's ready! So take a look at the wiki tutorial (which is inside the DSP section of the tutorials). You'll find a schematic containing the ASM-optimised filters towards the bottom of the page, there's also an example schematic to play with.

Thanks to sambean for originally providing the code for the polyphase IIR filter, and to aliasant for user testing and feedback.

Please post any comments/issues here.

Regards,
Andrew J


Great Image

I've already created my own Triangular/Linear up and downsampler primitives, but that polyphase thingy sounds quite interesting. But I think it's more than just upsampling, I'll have a closer look next weekend.

Tom
.signature failure
User avatar
TomC
smanatic
 
Posts: 709
Joined: Tue Oct 02, 2007 9:34 pm
Location: 3rd rock from the sun

Re: Oversampling Toolkit

Postby MyCo on Tue Jun 03, 2008 11:24 pm

Hi Andrew!

This is exactly what I described in the other thread, which you are refering to. But your explanation is totaly missleading, and I don't think there are many people outside that realy understand how simple it is. The way you describe it is just to difficult. The basic idea is just: calculate an imaginary sample between 2 real samples, the easiest way is a moving average filter which is the most simple lowpass filter. Then process the real-stream and the imaginary-stream you describe it as "oversampling process" and at the end you just mix the to streams together with another lowpass filter (the moving average filter could do this too).

My english is too bad, to explain it in "Fachchinesisch" (technical mumbo-jumbo [???]) 3:)

And for me, it is still a fake oversampling, because it isn't processed at higher sample rate. The right term for this in my opinion is "double processing" ;)
Some of my SynthMaker examples: TranceDrive, LoopDrive
or go directly to my Blog
User avatar
MyCo
smaniac
 
Posts: 1039
Joined: Mon Dec 19, 2005 1:43 am
Location: Germany

Re: Oversampling Toolkit

Postby Andrew J on Wed Jun 04, 2008 12:09 am

MyCo wrote:Hi Andrew!

This is exactly what I described in the other thread, which you are refering to. But your explanation is totaly missleading, and I don't think there are many people outside that realy understand how simple it is. The way you describe it is just to difficult. The basic idea is just: calculate an imaginary sample between 2 real samples, the easiest way is a moving average filter which is the most simple lowpass filter. Then process the real-stream and the imaginary-stream you describe it as "oversampling process" and at the end you just mix the to streams together with another lowpass filter (the moving average filter could do this too).

My english is too bad, to explain it in "Fachchinesisch" (technical mumbo-jumbo [???]) 3:)

And for me, it is still a fake oversampling, because it isn't processed at higher sample rate. The right term for this in my opinion is "double processing" ;)


Hi Maik,

I don't understand why you say the explanation is totally misleading? The explanation is simplified in some regards, but I don't think it's actually misleading. The use of a low pass filter as an interpolator is well documented in literature, as are the use of polyphase IIR filters as decimators.

The triangular window filter I provide is quite similar to the moving average filter you mention. While I'd agree that a moving average filter is the easiest way, the performance of this and other simple convolution filters is somewhat limited.

As for "double processing" at the original sample rate, it's not fake. It's all a matter of timing. With "true" oversampling at 2X the original rate, you simply process one sample and produce the ouput, and then the process the next and produce the next output. When doing this in SM, we are going to be returning to the original sample rate anyway - so we don't need to wait for an in-between sample period (of a higher S.R.). We can simply shuffle our sample/state values and process the next sample immediately after the first one. If coded correctly, the result (after returning to the original sample rate) is mathematically equivalent to what you call "true" oversampling.

The only thing I'm not completely comfortable with in this toolkit is the cascading technique for higher rates of oversampling. While cascading techniques have been proven elsewhere, I have not worked all the way through the maths of my example. I have simply performed experiments (as per the overdrive example) and concluded that the technique does actually seem to work!

In the end, the real test is whether or not people find that it removes audible aliasing artifacts.

Regards,
Andrew

PS - I really appreciate any critical review (I don't always get it in my job as a professional engineer!)
Andrew J
smanatic
 
Posts: 617
Joined: Tue May 29, 2007 4:53 am
Location: Australia

Re: Oversampling Toolkit

Postby MyCo on Wed Jun 04, 2008 12:38 am

In "true" oversampling, you can generate waveforms with let's say FS/2 which have 4 samples so you can see what it is:
sine: 0 1 0 -1
saw: -1 -0.3 0.4 1
ramp: 1 0.4 -0.3 -1
pulse: -1 -1 1 1

in "fake" oversampling FS/2 is a pulse (-1 1) and it depends on the filter how it looks like oversampled. But you can NEVER generate different waveforms at this frequency.

And this is not what you are looking for, if you need oversampling...
Some of my SynthMaker examples: TranceDrive, LoopDrive
or go directly to my Blog
User avatar
MyCo
smaniac
 
Posts: 1039
Joined: Mon Dec 19, 2005 1:43 am
Location: Germany

Re: Oversampling Toolkit

Postby Andrew J on Wed Jun 04, 2008 12:49 am

exonerate wrote:It seems that in your example schematic the triangular and power oversampling requires a gain boost by the oversampling factor to be at the same volume level as the polyphase. I guess thats to do with the quality of the filters and the roll off?


Exactly - gain is preserved if you stay within the pass band. You can try a pre or post EQ to compensate for the roll-off.
Andrew J
smanatic
 
Posts: 617
Joined: Tue May 29, 2007 4:53 am
Location: Australia

Re: Oversampling Toolkit

Postby Andrew J on Wed Jun 04, 2008 12:58 am

MyCo wrote:In "true" oversampling, you can generate waveforms with let's say FS/2 which have 4 samples so you can see what it is:
sine: 0 1 0 -1
saw: -1 -0.3 0.4 1
ramp: 1 0.4 -0.3 -1
pulse: -1 -1 1 1

in "fake" oversampling FS/2 is a pulse (-1 1) and it depends on the filter how it looks like oversampled. But you can NEVER generate different waveforms at this frequency.

And this is not what you are looking for, if you need oversampling...


OK - so you're talking specifically about constructing an oscillator here? If so, you don't need to upsample anything - you'd simply generate the in-between samples immediately after the first ones and output them to the decimating filter. The decimating filter is coded so that it considers all the samples correctly and effectively processes them as if it were at the higher sampling rate.

I've never coded an oscillator before, but it'd be fun to have a go and see if I can show you exactly what I mean. Any preferences as to which waveform you'd like me to attempt?

-Andrew
Andrew J
smanatic
 
Posts: 617
Joined: Tue May 29, 2007 4:53 am
Location: Australia

Re: Oversampling Toolkit

Postby bootsy on Wed Jun 04, 2008 10:40 am

great stuff - thanks for sharing and thanks especially for the detailed comments in the ASM :)

watch out for denormals when using the polyphase filter.
Come and visit my Blog: Variety Of Sound
bootsy
essemilian
 
Posts: 371
Joined: Sat Jul 28, 2007 10:55 am
Location: Frankfurt, Germany

Re: Oversampling Toolkit

Postby aliasant on Wed Jun 04, 2008 11:06 am

bootsy wrote:great stuff - thanks for sharing and thanks especially for the detailed comments in the ASM :)

watch out for denormals when using the polyphase filter.


I just noticed that too. Simple fix by adding a low noise to the signal. My noise is at -160dB If I go lower it seems to stop working.
It's never to late to be late.....
http://martinrodensjo.smugmug.com/
User avatar
aliasant
smunatic
 
Posts: 2388
Joined: Sat Dec 30, 2006 5:49 pm
Location: Sweden

Re: Oversampling Toolkit

Postby TomC on Wed Jun 04, 2008 7:29 pm

MyCo wrote:And for me, it is still a fake oversampling, because it isn't processed at higher sample rate. The right term for this in my opinion is "double processing" ;)


Nope it's perfectly normal oversampling. When you double your sample rate you're processing twice as much samples per second, when you do it like Andrew and I do you process 2 samples at the same time, which happen to be twice as much samples per second as well.
When you use the same upsampling algorithm the result even does null.

Tom
.signature failure
User avatar
TomC
smanatic
 
Posts: 709
Joined: Tue Oct 02, 2007 9:34 pm
Location: 3rd rock from the sun

Re: Oversampling Toolkit

Postby bootsy on Wed Jun 04, 2008 8:47 pm

Andrew,
I just took an ordinary RBJ peak filter and oversampled it with vour polyphase OS. I saw that the EQ curves still get warped near nyquist frequency in the same way as without OS. I thought the warping should be gone with proper OS. Any ideas?

peace,
bootsy
Come and visit my Blog: Variety Of Sound
bootsy
essemilian
 
Posts: 371
Joined: Sat Jul 28, 2007 10:55 am
Location: Frankfurt, Germany

Next

Return to Sound

Who is online

Users browsing this forum: No registered users and 1 guest