Page 1 of 1

Suggestion for audio convertors

Posted: Tue Jun 01, 2021 5:24 pm
by Yazwho

Hello! I don't suppose anyone can recommend an audio convertor that can output data that the Vera can take, eg 12,207Hz 8bit audio. Tto something like a wav file so I can process it? Either a PC app, or on a website?

The best I've found is around 16kHz. (or 16bit) Nothing where you can specify the sample rate \ bitrate exactly.

Any suggestions?


Suggestion for audio convertors

Posted: Tue Jun 01, 2021 5:26 pm
by SlithyMatt

I use Audacity, and it works great for any bitrate you want. That's what I used to generate all the tracks for this demo: 





 


Suggestion for audio convertors

Posted: Tue Jun 01, 2021 5:30 pm
by Elektron72


Just now, SlithyMatt said:




I use Audacity, and it works great for any bitrate you want. That's what I used to generate all the tracks for this demo: 



Go to File > Export > Export Audio... and select "Other uncompressed files" from the file type dropdown. Change the header to "RAW (header-less)" and select either "Signed 8-bit PCM" or "Signed 16-bit PCM".


Suggestion for audio convertors

Posted: Tue Jun 01, 2021 7:36 pm
by kliepatsch

One could also do the math how much one needs to pitch up a sample at, say, 20 kHz, so that it has the original pitch when being played back at the target sample rate.

If I am not mistaken, the pitch in semi tones should be

st = log_2(f_e/f_t) * 12,

where f_e is the sampling frequency you are exporting at, and f_t is the sampling frequency of your target platform. The log_2 gives the pitch in octaves. Multiply it by 12 to get semitones.

Does that make sense? ?


Suggestion for audio convertors

Posted: Tue Jun 01, 2021 7:42 pm
by Ed Minchau

I use Audacity too. 12970 Hz stereo 16bit audio works pretty well, decent dynamic range and sound quality. 

Edited to add:  The PCM audio buffer only holds 4096 bytes; it is a first-in first-out rotating buffer.  If it gets below 1kb of data it can trigger an interrupt, if you want to set it up that way.

An advantage of using a stereo 16 bit audio (4 bytes per sample) is that for any frequency that is a multiple of 5 (like 12970) there will be an exact number of bytes needed to play 1/20 of a second of audio.  For 12970 Hz, that's 2594 bytes every 1/20 of a second.  It's not exactly 12970 Hz, but it is so close that it would take about an hour of audio playback before you got out by a tenth of a second or so. 

That 2594 is just a little over 60% of the size of the buffer, so you can load the first 1/20 of a second of audio, start playback, wait 1/60 of a second, load the next 1/20 second of audio, and thereafter load another 2594 bytes every 1/20 of a second; if it is timed just right the audio won't overflow or underflow the buffer and you'll get continuous playback.


Suggestion for audio convertors

Posted: Wed Jun 02, 2021 6:03 pm
by Yazwho

Audacity it is! 

Thanks,