Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

How do I record a sound to PCM format and replay it from there?

share|improve this question
1  
Check documentation code.google.com/p/libgdx/wiki/Audio –  XiaoChuan Yu Jun 13 '13 at 15:09

1 Answer 1

to record:

AudioRecorder recorder = Gdx.audio.newAudioRecorder(sampleRate, isMono);
short[] pCM = new float[1024]; // 1024 samples
recorder.readSamples(pCM, 0, pCM.length);
recorder.dispose();

to play back:

AudioDevice device = Gdx.audio.newAudioDevice(sampleRate, isMono);
device.writeSamples(pCM, 0, pCM.length);
device.dispose();
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.