I would checkout rjlib and the s_osc~ which has bandlimited oscillators ... no need to reinvent the wheel. rjlib is vanilla so it will work fine with libpd.
Also, if you want the analog sound, the creb/moog~ external is kosher for the App store. I have it in PdParty.
On Dec 20, 2013, at 5:27 PM, pd-list-request@iem.at wrote:
From: Tony Hillerson tony.hillerson@gmail.com Subject: [PD] A naive approach to bandlimiting Date: December 20, 2013 at 5:26:59 PM EST To: pd-list@iem.at
Hey guys,
I’m building an iOS and Android app with an “analog" synth component. I’m pretty inexperienced with the DSP world, and my math and theoretical understanding of things is pretty rudimentary. Because I’m building a mobile app, I feel like I need to build each of the components of the synth myself instead, to avoid issues such as those with the App store and the GPL.
I’ve built the oscillator array, now and I have something I’d like to run by this group. I understand enough of the problem of band limiting to know the ill effect to the sound, and that there are a few different approaches people take to solve it. I don’t quite understand enough of how these solutions work, though to know if there’s “a solution” that I should use. After thinking about the problem I tried the approach I lay out below, and I’d like feedback. Is it a naive way of solving the problem? Does it introduce other problems? Is it really inefficient? Here goes:
I have nine tables, which I populate with a collection of geometric wave data using sinesum. Each table has fewer harmonics than the last. Then I use an array of [moses] objects to check the incoming MIDI note and call a "set <tablename>" on a [tabosc4~] before each note is played.
I choose a table with fewer harmonics as the note gets higher, and the boundary is generally the B note in the next octave. So, to produce a sawtooth wave, I have a wavetable with 714 partials for MIDI notes 24 and below, 357 partials for MIDI 36 down to 25, 178 partials from MIDI 48 to 37, and so on until between 128 and 109 I use a table with a single sine wave.
My naive understanding is that this approach is fairly efficient with CPU, but not efficient with memory. I believe it will let me have nice fat low-end notes, but should never have any aliasing as notes go higher in the register.
Anyhow, I hope that was clear enough. What of this approach?
-- Tony Hillerson
Dan Wilcox @danomatika danomatika.com robotcowboy.com