I'm trying to save microphone output into an mp3 file using ShineMP3Encoder. Everything works except that when I try to set sampling rate to 22K samples per second, I get an error.
var mic:Microphone = Microphone.getMicrophone();
mic.rate = 22;
Error #2044: Unhandled error:. text=Invalid samplerate
Is there a list of allowable rates for ShineMP3Encoder?
Just in case, here's where I use ShineMP3Encoder:
mp3encoder = new ShineMP3Encoder(wavData);
mp3encoder.start();
Found the hard-coded values of allowable sample rates in main.c inside the ShineMP3Encoder source code:
static int find_samplerate_index(long freq)
{
static long mpeg1[3] = {**44100, 48000, 32000**};
int i;
for(i=0;i<3;i++)
if(freq==mpeg1[i]) return i;
ERROR("Invalid samplerate");
return -1;
}
Since the only value that equals one of the Microphone sample rates is 44100, other sample rates will cause the error.