Changing the sample rate


#1

If you want to change the sample rate of the Tympan, you can look at the example program 01-Basics\ChangeSampleRate.ino.

The only line that you need to change is

const float sample_rate_Hz = 24000.0f ;

This will set the Tympan to run at a sample rate of 24 kHz. If you want to run at another speech, simply change the value!

When changing the value, be aware that it will only work for a discrete number of choices. Right now, the list of valid values is set in the file in the Tympan library “output_i2s_f32.cpp”. In there, there is a line with all the valid choices:

{ 2000, 8000, 11025, 16000, 22050, 24000, 32000, 44100, (int)44117.64706 , 48000, 88200, (int)(44117.64706 * 2), 96000, 176400, (int)(44117.64706 * 4), 192000};

If you choose a different value, the system will probably not work. But, if one of these values works for you, feel free to make the change.

If you’re going to run the computationally-intensive algorithms, you may not be able to run at the higher sample rates. But, if you’ve got a relatively light amount of processing, you can run the Tympan up into the ultrasound!

Chip