# 512x oversampling in Gen~

Gen

Ruslan
Dec 20 2014 | 3:40 pm
Hello,
For my current vocoding project I need to make a 512x oversampling in gen~. I understand that by power multiplication I increase the number of computations. Let me introduce this situation: I have the current speed set as f = 1 / T and on the Transmission Rate of 11050Hz my discretization algorithm able to reproduce the signal with 5025Hz bandwidth according to Kotelnikov theorem. But the current buffer rate is decreased up to 3 samples, which is sufficient to reproduce only one band of 24-band signal. I understood that if I upsample the signal up to 22579200 Hz sample rate this will give me buffer of 2048 samples again. How I made this calculations: 1. I round the Transmission Rate of the algorithm to 11025 Hz as a standard for sample rate discretization. But use instead 11050 Hz to avoid aliasing effect. 2. I count the number of samples for a buffer using the formula provided and it is 4 samples at this Transmission Rate. 3. I multiply 44100 Hz sample rate on 2048 samples to count at which discretization speed the algorithm will have 2048 buffer length again. It equals to 22579200 Hz, which is DSD512. Option: I can’t afford any of DSD512 converters on the market and I'm also unsure if DSD512 sampling rate can be selected on Max side so I'd like an option of oversampling. The use of it is to be able to run the algorithm with all 24 vocoding bands active. So the question is can I make 512x or even 256x oversampling in Gen~ with native objects? Can you point me in any direction for the literature on this topic? Or even if it is possible to do such amount of oversampling?
Best regards, Ruslan Yusipov

• Peter McCulloch
Dec 20 2014 | 4:05 pm
Have you tried running the gen~ patch inside a poly~ with poly~ up sampled 256 times? (not sure what the upwards limit is for the up message to poly~)
Share
• Ruslan
Dec 20 2014 | 4:18 pm
Thank you Peter, I will definitely try this. But my project is intended for exportcode command so I'm thinking about the possibilities inside gen~ also.
• Ruslan
Dec 20 2014 | 4:43 pm
Peter, it seems even on x4 it multiplies processing four times. My gen~ patcher use 40% of the cpu, so I overrun with this solution. However, looking into oversampling wikipedia article I already started implementation of oversampling in my patch. I made buffer length 65536 samples, which is 2^2*n with 8bit oversampling. I made this solution as my algorithm relies on a counter and all is dependent on it. I need to replace this weak point or improove it, because it is really this pipe, which prevents me of higher sample rates. Now my counter counts 4 samples with an increment of 1. I need it to count 512 times faster in a one second time.
• Ruslan
Dec 20 2014 | 5:31 pm
I think the problem is that counter counts with sample rate speed. It isn't really my intent. I need some counting device in gen~ which will be free of sample rate value and which I can set myself. For example I can use for operator with interruption. For operator runs at processor speed, I should reserve 22579200 Hz value speed for 'for' operator. It is not so difficult as I understand I just need to set a variable for current processor speed. And then set a divisor or multiplier as you like for break value.
• Roman Thilenius
Dec 22 2014 | 9:23 pm
upsampling x512 uses 512x the CPU. i somehow suspected that. :)
• Peter McCulloch
Dec 22 2014 | 9:29 pm
You should also try running different voices of the vocoder in separate top-level patchers. IIRC that may have some effect on parallel optimizations if those are enabled. Alternatively, if you're just developing code for export, you could run the audio using the non-realtime driver and record the output to confirm that it's working properly.
• Ruslan
Dec 23 2014 | 7:28 am
Hi Peter,
Can you tell me more about non-realtime driver? I haven't used it in Max yet. I now achieved upsampling up to x64 algorithmically, but set the counter step to mean sample value, which now equals to 64 and gives 4 equidistant steps. If I set the step to 1 it will run slower and it is not enough to playback the voice because it is indistinguishable. On the other side enen one band working with transmission rate 11025 Hz gives pleasant results. Yet, I can imagine how it will sound with all 24 bands active.
I'm interested in where to select this non-realtime driver and if it is in Max package?