Last active
July 30, 2016 08:57
-
-
Save drodsou/6526447 to your computer and use it in GitHub Desktop.
[algorithm] Reading audio buffer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int divider = 1; | |
if (output.getSampleFrequency() < 44100) divider *= 2; | |
if (output.getChannelCount() == 1) divider *= 2; | |
short[] pcm = output.getBuffer(); | |
for (int i=0; i < pcm.length/divider; i+=1) { | |
outStream.write(pcm[i] & 0xff); | |
outStream.write((pcm[i] >> 8 ) & 0xff); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment