damellis / PCM

Arduino library for simple playback of audio samples using pulse-code modulation.
http://hlt.media.mit.edu/?p=1963
81 stars 25 forks source link

On changing the sample rate #3

Closed ofloveandhate closed 7 years ago

ofloveandhate commented 7 years ago

I see #define SAMPLE_RATE 8000 in PCM.c.

Does this mean I can change the sample rate to 4000hz just by changing this one number, effectively letting me double the length of my samples, but at lower quality? Are there other implications to changing this number? Must it be a divisor or multiple of 8000?

damellis commented 7 years ago

From a quick look at the code, you should be able to set SAMPLE_RATE to more-or-less anything. Let us know how it goes!

ofloveandhate commented 7 years ago

indeed, simply changing this parameter effectively changes the playback rate. i tried it with 4000 and 16000, results as expected. thanks!