[android-developers] Re: AudioRecord works with short but static with byte

2010-01-08 Thread Jason Proctor
ok, but why must you address the samples as bytes? why not just deal with them in their native format? at a guess, the hardware doesn't support 8 bit recording. you could scale the 16 bit samples down to 8 bit, but watch out for the fact that 16 bit samples are signed, and 8 bit samples are no

[android-developers] Re: AudioRecord works with short but static with byte

2010-01-08 Thread Biosopher
I agree Jason. It seems requesting the 16 bit format results in a short array being returned: AudioFormat.ENCODING_PCM_16BIT. For byte[], I would need to use this format: int audioEncodingFormat = AudioFormat.ENCODING_PCM_8BIT; Curiously it seems that AudioFormat.ENCODING_PCM_8BIT doesn't seem t

[android-developers] Re: AudioRecord works with short but static with byte

2010-01-08 Thread Jason Proctor
AudioRecorder is copying each *sample* into the buffer you provide, element by element. if you don't give it enough space for the sample, you get truncation. and static. the read(byte[]) method is there for the situation where you set up AudioRecorder to give you 8-bit samples. i'd confirm t

[android-developers] Re: AudioRecord works with short but static with byte

2010-01-08 Thread Biosopher
Interesting point, Jason. However I'm reading a byte at a time so each short is read (just one byte at a time). There shouldn't be anything leftover to be missed. More important though, I'm reading the byte[] using a method provided by Android's AudioRecord. read(byte[] audioData, int offsetInB