Yes its a bug, sounds like the WAV header is wrong. You'll have to hack at that source to fix it..
On Apr 29, 5:51 pm, pac <[email protected]> wrote: > I'm developing with Android 2.1 on a Nexus One with firmware 2.1 > update 1. > > I'm using the RehearsalAudioRecorder class from here: > > http://rehearsalassist.svn.sourceforge.net/viewvc/rehearsalassist/and... > > public RehearsalAudioRecorder(boolean uncompressed, int audioSource, > int sampleRate, int channelConfig, > int audioFormat) > { > try > { > rUncompressed = uncompressed; > if (rUncompressed) > { // RECORDING_UNCOMPRESSED > if (audioFormat == > AudioFormat.ENCODING_PCM_16BIT) > { > bSamples = 16; > } > else > { > bSamples = 8; > } > > if (channelConfig == > AudioFormat.CHANNEL_CONFIGURATION_MONO) > { > nChannels = 1; > } > else > { > nChannels = 2; > } > > aSource = audioSource; > sRate = sampleRate; > aFormat = audioFormat; > > framePeriod = sampleRate * TIMER_INTERVAL / > 1000; > bufferSize = framePeriod * 2 * bSamples * > nChannels / 8; > if (bufferSize < > AudioRecord.getMinBufferSize(sampleRate, > channelConfig, audioFormat)) > { // Check to make sure buffer size is not > smaller than the > smallest allowed one > bufferSize = > AudioRecord.getMinBufferSize(sampleRate, > channelConfig, audioFormat); > > // Set frame period and timer > interval accordingly > framePeriod = bufferSize / ( 2 * > bSamples * nChannels / 8 ); > > Log.w(RehearsalAudioRecorder.class.getName(), "Increasing buffer > size to " + Integer.toString(bufferSize)); > } > > aRecorder = new AudioRecord(audioSource, > sampleRate, > channelConfig, audioFormat, bufferSize); > if (aRecorder.getState() != > AudioRecord.STATE_INITIALIZED) > throw new Exception("AudioRecord > initialization failed"); > // > aRecorder.setRecordPositionUpdateListener(updateListener); > > aRecorder.setPositionNotificationPeriod(framePeriod); > } else > { // RECORDING_COMPRESSED > mRecorder = new MediaRecorder(); > > mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); > > mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); > > mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); > } > cAmplitude = 0; > fPath = null; > state = State.INITIALIZING; > } catch (Exception e) > { > if (e.getMessage() != null) > { > Log.e(RehearsalAudioRecorder.class.getName(), > e.getMessage()); > } > else > { > Log.e(RehearsalAudioRecorder.class.getName(), > "Unknown error > occurred while initializing recording"); > } > state = State.ERROR; > } > } > > Here's how I'm instantiating it: > RehearsalAudioRecorder recorder = new > RehearsalAudioRecorder( > > RehearsalAudioRecorder.RECORDING_UNCOMPRESSED, > MediaRecorder.AudioSource.MIC, > 16000, > AudioFormat.CHANNEL_IN_FRONT, > > AudioFormat.CHANNEL_CONFIGURATION_MONO); > > I write a .wav file to the SD card. I specified mono, and I checked > that CHANNEL_CONFIGURATION_MONO is indeed set in the AudioRecord > object. But when I try to play the file, it's treated as if it's > stereo, and voices sound like chipmunks. Apparently the header > information is wrong. For instance, I open the .wav file in Audacity, > and Audacity says it's stereo. > > Is this a bug? What can I do? > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group > athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

