Arbitrary Waveform Array Size

Status
Not open for further replies.

Teenfor3

Well-known member
I have been searching the forums regarding arbitrary waveform related posts.....

....... found this in post for sound pitch control ........
"If you can create 256 sample waveforms, with appropriate bandwidth limiting, this should work great for basic waveform pitch shifting."

.... so I assume array needs to be ..... const int16_t sawtoothWaveTable16bit[256] = {....0 to 255 samples....};....?????

..................found this in post for an Arbitrary Waveform Sawtooth generator....
"First we need to generate a wavetable that works with the Arbitrary Wave form. For that, the wavetable must be an array of "int16_t" values, which will give us values from -32767 to 32767. This array, must have 257 values, being the last the same as the first. So, this array should be like

const int16_t sawtoothWaveTable16bit[257] = {0, 11872, 21985, 29041,..etc...-32523, -29041, -21985, -11872, 0};"
............................

.......................from the GUI notes.....
arbitraryWaveform(array, maxFreq);

Configure the waveform to be used with WAVEFORM_ARBITRARY. Array must be an array of 256 samples. Currently, the data is used without any filtering, which can cause aliasing with frequencies above 172 Hz. For higher frequency output, you must bandwidth limit your waveform data. Someday, "maxFreq" will be used to do this automatically.
......................................................

..............found this in post relating to Arbitrary Waveform example.............
"OK, confirmation (in a comment) that it is an array of 256 elements (not 257, like the sine function uses. Comparing this code to that of the sine function in the same file may however be helpful as they are similar, differing only in how they wrap around the waveform data array)."

...... So I assume sinewave and arbitrary are treated differently....???
........................................................................


I have arbitrary waveform working on Teensy3.2 and it works very well, but a bit confused as to what size of audio data array I should use. I am just reading or playing the array as 1 cycle continuously. Should the array be 256 elements (0 - 255) only, OR 257 elements (0 - 255) + the last added equal to the first. ...???

I find 254, 255, 256, 257 all work and sound similar...???

Just like some confirmation, Thanks.
 
Status
Not open for further replies.
Back
Top