Hi all,
Today I implemented bandlimited wavetables in Pd vanilla using the idea behind mipmapping in OpenGL (ie, generate many filtered and downsampled versions of a source, use the most appropriate version(s) by a function of the derivative of the lookup index).
More info and full source (quick start tutorial: bl-example.pd):
https://gitorious.org/maximus/pd-bl
License: same as Pd vanilla.
Advantages over other implementations:
Disadvantages:
awesome, thanks claude.
On Fri, Feb 13, 2015 at 1:06 AM, Claude Heiland-Allen claude@mathr.co.uk wrote:
Hi all,
Today I implemented bandlimited wavetables in Pd vanilla using the idea behind mipmapping in OpenGL (ie, generate many filtered and downsampled versions of a source, use the most appropriate version(s) by a function of the derivative of the lookup index).
More info and full source (quick start tutorial: bl-example.pd):
https://gitorious.org/maximus/pd-bl
License: same as Pd vanilla.
Advantages over other implementations:
- Can generate wavetables from any waveform stored in a table.
Disadvantages:
- The higher harmonics are reduced compared to an optimal method.
Claude
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
Hey
Very nice. Having band-limitation for free waveforms is awesome. I still have to dig into it, especially in order to understand how the filtering is done.
My two cents:
initially designed to avoid aliasing in scaled images? It seems to me that they are too 'tight' for audio. With higher notes the perceived volume is reduced. Without any proof, I suspect it cuts off more of the harmonics than actually necessary.
or also in CPU usage? Obviously, you need more CPU time to calculate the tables, but once they're calculated, does it require more CPU to have more tables? I'd like to have a version with many more tables (so that one could get lower notes without the higher harmonics being cut-off).
Roman
On Thu, 2015-02-12 at 16:06 +0000, Claude Heiland-Allen wrote:
Hi all,
Today I implemented bandlimited wavetables in Pd vanilla using the idea behind mipmapping in OpenGL (ie, generate many filtered and downsampled versions of a source, use the most appropriate version(s) by a function of the derivative of the lookup index).
More info and full source (quick start tutorial: bl-example.pd):
https://gitorious.org/maximus/pd-bl
License: same as Pd vanilla.
Advantages over other implementations:
- Can generate wavetables from any waveform stored in a table.
Disadvantages:
- The higher harmonics are reduced compared to an optimal method.
Claude
Hi Roman,
On 13/02/15 10:32, Roman Haefeli wrote:
Very nice. Having band-limitation for free waveforms is awesome. I still have to dig into it, especially in order to understand how the filtering is done.
My two cents:
- You say you learned from OpenGL. Does that mean you applied filters
initially designed to avoid aliasing in scaled images?
No - I use FFT filtering for periodic waveforms (ie, no windowing necessary).
The gain is 1 for frequencies from 0 to SR/4, then it ramps linearly down to 0 at SR/2. The ramp is intended to avoid sudden changes in amplitude of harmonics when moving through the wave tables - but the linear interpolation mentioned below might take care of that anyway.
I'll do some tests later today (but if you want to get there first the ramp is somewhere in "bl-gen-abs~.pd", perhaps try making it 1 all the way to SR/2).
It seems to me that they are too 'tight' for audio. With higher notes the perceived volume is reduced. Without any proof, I suspect it cuts off more of the harmonics than actually necessary.
- Does multiplying the number of tables cause a penalty in memory only,
or also in CPU usage? Obviously, you need more CPU time to calculate the tables, but once they're calculated, does it require more CPU to have more tables?
The tables are at powers of two (plus 3 extra wrapped guard points for tabread4~) - adapting it to have more in-between tables would be awkward because afaik Pd only does powers of two as block sizes, so FFT filtering wouldn't be possible.
And more tables do consume more CPU - there is some simple maths and a [tabread4~] running all the time for each wavetable level (because you can't switch or change table target at audio rate, I silence all but 2 of them, with the remaining pair being interpolated) - the per-table work is in "bl-tabread4-abs~.pd".
I'd like to have a version with many more tables (so that one could get lower notes without the higher harmonics being cut-off).
Try the ramp adjustment I mentioned above first, it might be that I messed up there. There's also an offset in the index generation, [-~ 1] somewhere after the [log~ 2] in "bl-tabread4~.pd", changing this to [-~ 0.5] or even [-~ 0] should brighten the sound but risks audible aliasing.
In any case, the largest table has 2048+3 points, which corresponds to oscillators below around 22Hz at typical sample rates.
Perhaps you just need to copy a larger table region - inlet arguments to [bl-gen~] are source table, length in samples, and offset in samples. Offset should be at least 1, for tabread4~ guard points, and the table should have at least 3 more points than the supplied length for the same reason. For smoothest results, the source table should be [tabosc4~]-ready (ie, power of 2 plus 3 with the last 3 points the same as the first 3 points).
Claude
On Thu, 2015-02-12 at 16:06 +0000, Claude Heiland-Allen wrote:
Hi all,
Today I implemented bandlimited wavetables in Pd vanilla using the idea behind mipmapping in OpenGL (ie, generate many filtered and downsampled versions of a source, use the most appropriate version(s) by a function of the derivative of the lookup index).
More info and full source (quick start tutorial: bl-example.pd):
https://gitorious.org/maximus/pd-bl
License: same as Pd vanilla.
Advantages over other implementations:
- Can generate wavetables from any waveform stored in a table.
Disadvantages:
- The higher harmonics are reduced compared to an optimal method.
On 13/02/15 11:19, Claude Heiland-Allen wrote:
On 13/02/15 10:32, Roman Haefeli wrote: I'll do some tests later today (but if you want to get there first the ramp is somewhere in "bl-gen-abs~.pd", perhaps try making it 1 all the way to SR/2).
2 weeks later, I finally got around to it...
I tried adjusting the filter ramp, it only made things worse (more aliasing). So it's still the same as it was.
There's also an offset in the index generation, [-~ 1] somewhere after the [log~ 2] in "bl-tabread4~.pd", changing this to [-~ 0.5] or even [-~ 0] should brighten the sound but risks audible aliasing.
In fact the offset was too high already - I added a spectrum view, there were (small, but visible) peaks moving to the right when the frequency of the oscillator was moving to the left. I changed the offset to [-~ 1.5] and the problem seems gone, at least when using [bl-tabread4c~].
The repository now has a [tabread4c~] abstraction using 4x [tabread~] and some maths (still vanilla core, no [expr~] even), and a [bl-tabread4c~] that uses it (same as [bl-tabread4~] except for much nicer sounding interpolation and presumably somewhat higher CPU usage).
Perhaps you just need to copy a larger table region
I increased the size of the source waveform table in the example, now copying shouldn't reduce harmonics (as the largest table is the same size).
Claude
On Thu, 2015-02-12 at 16:06 +0000, Claude Heiland-Allen wrote:
Hi all,
Today I implemented bandlimited wavetables in Pd vanilla using the idea behind mipmapping in OpenGL (ie, generate many filtered and downsampled versions of a source, use the most appropriate version(s) by a function of the derivative of the lookup index).
More info and full source (quick start tutorial: bl-example.pd):
https://gitorious.org/maximus/pd-bl
License: same as Pd vanilla.
Advantages over other implementations:
- Can generate wavetables from any waveform stored in a table.
Disadvantages:
- The higher harmonics are reduced compared to an optimal method.
Still looking for the window_name for the pd-window to hide, rezize or move the pd-window.
With tcl/tk 8.4 this was "." This does not work anymore with tcl/tk 8.5
Unfortunately I cannot find any infrmation on this ...
Information on the actual name or where to look would be greatly appreciated!
Thanks! Ingo
Am 01. März 2015 08:11:15 MEZ, schrieb Ingo ingo@miamiwave.com:
Still looking for the window_name for the pd-window to hide, rezize or move the pd-window.
With tcl/tk 8.4 this was "." This does not work anymore with tcl/tk 8.5
I think it is not related to the tcl/tk version, but rather to the pd-gui rewrite.
I cannot answer the question, though.
mfg.ugd.fhj IOhannes
-- Sent from my pdp-11
Thanks Iohannes!
Makes sense that it is in the pd-gui rewrite. In tcl/tk it says "." stands for the program that is running.
I might take a look at the source code. If anybody has an idea where this could be it could save me probably quite some time ...
Cheers Ingo
Am 01. März 2015 08:11:15 MEZ, schrieb Ingo ingo@miamiwave.com:
Still looking for the window_name for the pd-window to hide, rezize or move the pd-window.
With tcl/tk 8.4 this was "." This does not work anymore with tcl/tk 8.5
I think it is not related to the tcl/tk version, but rather to the pd-gui rewrite.
I cannot answer the question, though.
mfg.ugd.fhj IOhannes
-- Sent from my pdp-11
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Hi all,
Another update to pd-bl:
https://gitorious.org/maximus/pd-bl
I added a 4x upsampled version to the example patch, together with a 10th-order lowpass filter to prevent aliasing when downsampling. The harmonic content is much more present in the top end, the non-upsampled examples now sound very muffled in comparison.
Note that it is crucial to put the phasor~ in the upsampled patch, otherwise the phasor~ will be aliased before even getting to the bl-tabread4c~ -- garbage in, garbage out...
On 26/02/15 20:28, Claude Heiland-Allen wrote:
Disadvantages:
- The higher harmonics are reduced compared to an optimal method.
It seems 4x upsampling fixes this, but CPU usage will be higher.
Enjoy,