Hello I would like to downsample 16 bit pcm audio to 8 bit and then upsample the same from 8 bit back to 16 bit in android. I am using this which seems to work:
int tempint;
for (int i=1, j=0; i<tempBuffer.length; i+=2, j++)
{
tempint = ((int) tempBuffer[i]) ^ 0x00000080;
tempBuffer[j] = (byte) tempint;
Log.e("test","------------* COUNTER -> "+j+" BUFFER VALUE -> "+tempBuffer[j]+"*-----------");
}
where tempbuffer is a short [] and tempint is an int. Can anyone tell me if this works fine because I am a starter, also I am using this to convert the byte [] back to a short []
for (int x=1, j=0; x<music.length; x+=2, j++)
{
tempint = ((int) music[x])& 0xFF;
music[j] = tempint.shortValue();
Log.e("maxsap","------------*"+ music[j]+"*-----------");
}
which I am not sure it is working.