Jump to content

Suggestion for audio convertors


Recommended Posts

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?

Link to comment
Share on other sites

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".

  • Like 2
Link to comment
Share on other sites

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? 😄

Edited by kliepatsch
Error in math
Link to comment
Share on other sites

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.

Edited by Ed Minchau
  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

Please review our Terms of Use