3
\$\begingroup\$

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

\$\endgroup\$
1

1 Answer 1

1
\$\begingroup\$

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();
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .