[Thinking this should go to linux-audio-dev, so I've cc'd it for now] --- Paul Winkler <[EMAIL PROTECTED]> wrote: > On Thu, May 16, 2002 at 07:01:54PM +0100, Mike Rawes > wrote: > > On Thu, 16 May 2002 13:18:03 +0300 > > <[EMAIL PROTECTED]> wrote: > > > > > [...] when you take two saws with difference in phase and > > > differentiate you'll get (variable with phase difference) pulse > > > wave. > > > > This is exactly what the 'blop' pulse plugin does. I did a similar thing > > with a pair of parabolas to get a waveform that morphs from sawtooth to > > triangle with phase difference. > > How efficient are these techniques?
At the moment, not very: I use a set of bandlimited wavetables, each of which contains a fixed number of harmonics, and have a maximum playback frequency (=Nyquist/Max harmonic). A good description of the method by Joe Wright is found here: www.musicdsp.org/files/bandlimited.pdf Each cycle (which is either per-sample or per block, depending on the type of frequency port: Audio or Control): 1. The wavetable to playback is looked up in a binary (AVL) tree using the frequency as a key against the maximum playback frequency (This needs to be replaced with something less elaborate). 2. A sample is retreived from a wavetable using the 3rd order spline code from www.musicdsp.org (as of blop-0.1.1. Previous v0.1.0 was linear) 3. To avoid harmonics jumping out of nowhere when pitch sliding down or disappearing when pitching up, a corresponding sample (same phase) is retrieved from an adjacent wavetable using the same method. This is then mixed linearly with the first sample. 4. To get a variable pulse, steps 2 and 3 are repeated with the shifted phase. The result is subtracted from the first sample (not phase shifted). 5. Finally, because the differentiation causes DC shift (for a pulse), or amplitude scaling (for a variable slope triangle), an additional operation is performed to correct this. Briefly: One AVL tree lookup, Four cubic spline interpolations, Two linear interpolations, A difference, A small correction fudge (a few adds and multiplies) So, in sum, could be simpler! I'd be interested to see how you did yours (in particular the anti-aliasing hack - do you use wavetables?) Mike > I just spent the > better part > of a day fixing up one of my old csound orcs (now a > SAOL orc) which > does square or PWM waves, with an antialiasing hack > which > I haven't seen elsewhere, is computationally very > simple, > and sounds pretty darn good if I do say so myself... > especially now that it's not completely borken. > I used a totally incorrect earlier version for years > and > just lived with the aliasing, until I realized the > other > day that I'd done everything totally backwards. ;) > > I'll post the sfront orc/sco if anyone's interested, > it's a very short text file. I also have a 192 k > bzipped > test output file which is interesting to listen to > (and look at a plot of)... I'll send that to anyone > who asks, > too. > > -- > > Paul Winkler > home: http://www.slinkp.com > "Muppet Labs, where the future is made - today!" __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com
