Open GoogleCodeExporter opened 8 years ago
Because Flash only plays 44.1kHz. So we can only easily resample divisors
thereof.
Original comment by mcgrawian@gmail.com
on 8 May 2012 at 11:30
Original comment by mcgrawian@gmail.com
on 8 May 2012 at 11:30
Got it - maybe there's a way to play the audio from memory, but save as 8kHz
file?
Original comment by b...@smartots.com
on 10 May 2012 at 12:48
If you find a way, let us know, but as far as I know you can only set the
sample rate in one place, so you're stuck resampling either way.
Original comment by mcgrawian@gmail.com
on 10 May 2012 at 1:39
You can replace the decode() function in DecodePipe.as with the following:
private function decode(bytes:ByteArray):ByteArray
{
var decoded:ByteArray = new ByteArray();
var destTime:Number = 0;
var destIncrement:Number = format.rate/44100.0;
var sourceTime:Number = 0;
while (bytes.bytesAvailable)
{
var sample1:Number = getSample(bytes);
var sample2:Number = sample1;
if (format.channels == 2)
{
sample2 = getSample(bytes);
}
sourceTime += 1;
while(destTime<sourceTime) {
destTime += destIncrement;
decoded.writeFloat(sample1);
decoded.writeFloat(sample2);
}
}
decoded.position = 0;
return decoded;
}
this provides a simple resampler that will work with any sample rate.
Original comment by il.demon...@gmail.com
on 4 Dec 2012 at 10:28
Is the above code working in 8K sampled file? My case didn't work. Help!
Original comment by jha...@gmail.com
on 2 Oct 2013 at 1:21
Original issue reported on code.google.com by
b...@smartots.com
on 4 May 2012 at 9:35