Help for implementing bandlimited waveforms

Status
Not open for further replies.
I came across with a problem that I can't solve and doesn't make much sense to me why it's not working. I implemented a bandlimited sawtooth, using polynomial transition, and it works fine, no aliasing anymore. Next step was creating a band limited pulse wave, through two saws. The idea is loading a delay line buffer with one saw, then inverting its phase and then summing it with another saw, creating one square wave with PWM. The problem is that at the moment that I send the samples to the delay line they never come back, I always get silence. I don't know if I'm getting a NULL somewhere, or if there is something that I just don't know about using these classes with the audio call back.

The classes and one example can be found here: https://github.com/silveirago/teensyATK

My intention is to provide a series of band limited waveforms, among other tools that I think that are being useful on the synth that I'm building. All the help is appreciated!
 
Maybe there's a bug in your delay line code?

With just a quick look, I see this:

Code:
    if(readPointer >= length-1) { readPointer -= length; }
    if(writePointer >= length-1) { writePointer -= length; }

Will this cause these to become -1 in the case where they're equal to 1 less than length?

And why is readPointer declared as a float?
 
Hi Paul, thanks for answering.

Read pointer is a float because you interpolate between sample values.

The length of the array is always > 1. So, if the array contains 512 elements, indexing beyond 511 (say 512) will allow the array to be indexed at index 0 or greater.

With the read pointer, if the indexing value is 511.1 then (I think) the interpolation code would get the value between index 0 and index 511. However, it works in open frameworks as c++ code.
 
Supposed length is 100. When writePointer is 99, it is equal to 100-1. So it gets 100 subtracted. 99 - 100 is -1.
 
I tried doing
Code:
    if(readPointer > length-1) { readPointer -= length; }
    if(writePointer > length-1) { writePointer -= length; }
But, I still just get silence. :/
 
Status
Not open for further replies.
Back
Top