Optimizing signal path.. streamin, monoin, polyin... huh?
Archive · 200514 old posts
From the original SynthMaker forum (2004–2014), with its members’ names and dates.
Kingston ·
Hi,
I can't seem to find conclusive information on what I/O to use with code block when optimizing performance.
I'm basically doing lots of independent filters and waveshapers and maybe oversampling with stereo audio. What I/O method should I use?
Could someone maybe list the pros and cons of poly/mono/stream codeblock IO? (is there more?)
Cheers. 🙂
infuzion ·
Well, aside what you can read in the docs for Poly vs Mono, it's best to code everything in StreamIn/Out. That way it automaticly becomes Poly, Pack4, Mono, as the need arises. Unless you have a specific reason do to it in Mono (eg need a constanly-running 1 sound channel) of course.
Kingston ·
Right,
that much I suspected already.
About using streams in code block, can I unpack them inside code block?
Say I had 4 filters in parallel, each with its own set of variables, should I unpack the streams and use separate block for each filter?
Or something better if its possible to unpack within code block?
sambean ·
Currently with the code module you can't unpack inside the module, you have to use the asm module to do this.
If you're wanting 4 filters in parallel what to do is just use one filter module with coefficient inputs and pack the different coefficients for each filter into the module using the pack modules, therefore each channel of the filter will be calculated using it's own coefficients.
infuzion ·
sambean wrote: Currently with the code module you can't unpack inside the module, you have to use the asm module to do this.
There's an example of this in Shif's Poly Power module (w/GUI avail by me 🙂 ), most likely in skOre's mega-pack.
Kingston ·
sambean wrote: Currently with the code module you can't unpack inside the module, you have to use the asm module to do this.
If you're wanting 4 filters in parallel what to do is just use one filter module with coefficient inputs and pack the different coefficients for each filter into the module using the pack modules, therefore each channel of the filter will be calculated using it's own coefficients.
Hmm, sounds like it would be just as efficient unpacking to 4 separate filter modules in that case, then packing them back to stream. And those separate modules should be monoin/monoout as well.
Or am I missing something?
sambean ·
Most of the commands inside the code module use SSE, definately all the basic arithmetic. With SSE 4 32 bit floats are packed into 1 register and then when an operation is performed on the register it is performed on all the data that's been packed.
So for example if we pack (a, b, c, d) into X and (e, f, g, h) into Y then we only need to calculate X + Y to get (a+e, b+f, c+g, d+h)..
So if you use a mono4 with a filter module then you basically have the cpu overhead for 1 filter being used for 4 filters.
In some cases when the calculation is quite small though, it may actually take more overhead to pack and unpack the data than it would be to perform 4 individual calculations..
Kingston ·
what's mono4? something I've missed again?
I see how sse works with the data in parallel. But what if I need to use separate variables (filter feedback mainly) for the calculations in parallel?
How to achieve that in SSE?
sambean ·
mono4 are the connectors that come out/go into the pack/unpack modules..
If you wan't seperate variables in you filter you need to use the pack modules to import them to the filter
Here's an example of what it would look like if you had 4 lowpasses in parallel, each with different cutoffs and res'
If you wanted more complicated filters you'd have to pack the individual coef's
Kingston ·
Thanks,
I'll test this tomorrow. Let's see how this works with the oversampling modules...
(for those brand new to SM)
Mono4 is used where you want to process 2-4 audio channels at once. This would save CPU where eg processing stereo pairs. Essentially the same as Poly, but instead of SM having a single 4-voice path (Poly processes 4 audio channels at once due to the above mentioned SSE), SM will process 4 Mono channels at once, which you can mannually converge before, & diverge later.
Hope that helps.
Kingston ·
I knew about the pack/unpack modules and their SSE related use, just didn't know mono4 refers to that. I thought mono4 was something in the code block I had missed. 😮
Kingston ·
sambean,
I just tested your example with the interpolator/decimator and it doesn't work. I guess it's due to feedback variables getting mixed up within the single code block.
I have to use 4 separate code blocks the get it to work. AFAIK based on what was said here it's not possible to access the individual streams within code block, and hence I can't have separate filter feedback variables for each stream.
I guess it doesn't matter as it's already pretty damn efficient with 4 individual code blocks. 😀
sambean ·
Yeah, if you're wanting to interpolate the signal as well you'd need to use seperate code blocks as you'd have 16 audio channels..
Wrote something here? To have a post removed or your name hidden, write to [email protected].