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

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Wavetable Power of 2 Limitation

For general discussion related FlowStone

Wavetable Power of 2 Limitation

Postby Perfect Human Interface » Sun Mar 31, 2013 8:12 am

Is there any possibility of getting around this? My project is dependent on being able to create wavetables that are any number of samples and not an even power of 2.

Has anyone created a custom wavetable module that's not limited this way by any chance?
Perfect Human Interface
 
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

Re: Wavetable Power of 2 Limitation

Postby trogluddite » Sun Mar 31, 2013 11:49 am

Assuming that it is the number of samples in your raw input that must be totally variable (rather than the size of the output table)...
The float array 'Resample' primitive is often used for this, to convert the data to a length that the wavetable primitive will accept - if your input data is e.g. wav files, the 'mem to float array' primitive will let you convert the data type.

In principle, any size of output table is also possible, as are the readers to go with them; but building such a table requires a huge amount of audio filtering to create the anti-aliased waveform segments. Using an FFT filter is by far the most practical way to do it, and it is the FFT that ultimately has the 'power of two' requirement.
A few of us have done experiments with our own tables, but without a few additions to the DSP/Code primitives, it's difficult to make them at all efficient.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Wavetable Power of 2 Limitation

Postby Perfect Human Interface » Mon Apr 01, 2013 1:48 am

trogluddite wrote:The float array 'Resample' primitive is often used for this


Thank you VERY much. This indeed works. Unfortunately the accuracy of the output is dependent on the resampling resolution (output array size), and the interface (the knob controlling the input array size) starts to get a bit sluggish at higher values. Still works but it's a slight bother. I don't think there's a way to limit the amount of resamples occurring continuously while the knob is turned without effecting accuracy. I tried putting a redraw limiter in front of the resampler but all that did was make the resampling audibly delayed rather than continuous (with the interface being sluggish the redraw rate is sluggish anyways).
Perfect Human Interface
 
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

Re: Wavetable Power of 2 Limitation

Postby Perfect Human Interface » Mon Apr 01, 2013 2:55 am

By the way, is it possible for a wavetable module that's fed an array of values between -1 and 1 to occasionally spit out a value that's greater than 1 or less than -1? Because that's what seems to be happening.
Perfect Human Interface
 
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

Re: Wavetable Power of 2 Limitation

Postby Jay » Mon Apr 01, 2013 3:34 am

yep agreed PHI i have seen this as well,many times!
Jay
 
Posts: 276
Joined: Tue Jul 13, 2010 5:42 pm

Re: Wavetable Power of 2 Limitation

Postby Perfect Human Interface » Mon Apr 01, 2013 3:38 am

Jay wrote:yep agreed PHI i have seen this as well,many times!


Okay, thanks for chipping in. In this case I can just clip the signal and it's no problem, but I was wondering what the heck was going on for a while there.
Perfect Human Interface
 
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm

Re: Wavetable Power of 2 Limitation

Postby trogluddite » Mon Apr 01, 2013 12:01 pm

Perfect Human Interface wrote:occasionally spit out a value that's greater than 1 or less than -1

Ah, yes, that will be the dreaded 'inter sample peaks'.

With bi-cubic interpolation, you can imagine the process is trying to make as accurate a waveform as possible - fitting a nice smooth curve to the sample points rather than just joining them with straight lines.
If you have two adjacent samples very close to the peak level - one on the 'up-slope' and one on the 'down-slope', the little loop of curve, that turns the corner from up to down, can poke up above the max sample level.

Also filtering can introduce higher peak levels - kind of counter intuitive when you think that you are removing some frequencies - but some of the removed frequencies might have been out of phase, and thus subtracting from the wave at some points. You can see this very clearly if you look closely at the stock square wave at mid-frequencies - little overshoots at the 'cliffs edges' of the wave caused by anti-aliasing removing the top harmonics that would otherwise have flattened out the top and bottom.

This can happen whenever a signal is filtered, re-sampled, interpolated, or even at the analogue output stage of a soundcard. Just clipping the peaks off may also not work totally reliably if the sound passes through another process that reconstructs the curve..
Hence, it is rarely good to normalise or limit the samples right up to the min/max 'brick wall' - usually 1-2dB of headroom is recommended (i.e. just reduce the level of the input array very slightly).
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Wavetable Power of 2 Limitation

Postby Perfect Human Interface » Mon Apr 01, 2013 3:17 pm

trogluddite wrote:
Perfect Human Interface wrote:occasionally spit out a value that's greater than 1 or less than -1

Ah, yes, that will be the dreaded 'inter sample peaks'.


Ah, I know about this! It's strange going from using music/audio software to making it, the way the pieces slowly come together. The mysteries resolve into familiar things.

It seems as fast as I can come up with questions you've got answers ready for me, which I'm glad for since I keep finding more questions to ask! Thanks again. :)
Perfect Human Interface
 
Posts: 643
Joined: Sun Mar 10, 2013 7:32 pm


Return to General

Who is online

Users browsing this forum: No registered users and 3 guests