0

I migrated from Eclipse to AndroidStudio; I can get sounds from the project I've built with AndroidStudio/libpd but can not use mic to enter sound into Pd.

this is how I set audio parameters:

private void initPd() throws IOException {
AudioParameters.init(this);
        int srate = Math.max(44100, AudioParameters.suggestSampleRate());
        PdAudio.initAudio(srate, 1, 2, 8, true);

this is how I set the permission in AndroidManifest.xml

<uses-permission android:name="android.permission.RECORD_AUDIO" />

this is the error I've got

AudioFlinger could not create record track, status: -1
E/libOpenSLESīš• android_audioRecorder_realize(0x62839188) error creating AudioRecord object
Ike
  • 1
  • 1

1 Answers1

1

I had a similar issue, and although I know this question is old, it may help others searching for a solution. With help from the contributors on the libpd github page, I found the cause(s) for receiving no input in my project...

Firstly, my targetsdkversion was API 23. As pointed out: "Requesting permissions in API 23+ is something that needs to be done in the app itself, not in the pd-for-android library." So I changed the target sdk version to 22.

Additionally, I had not added permission to my manifest to use the microphone. So adding this line to the Androidmanifest:

<uses-permission android:name="android.permission.RECORD_AUDIO" />

Finally, I forgot to change the number of input channels from 0 when changing the source source from a osc~ to adc~. So my initPD method now looks like:

int sampleRate = AudioParameters.suggestSampleRate();
int inpch = AudioParameters.suggestInputChannels();
PdAudio.initAudio(sampleRate, inpch, 2, 8, true);

That did the trick for me.. Hopefully it helps you or someone else.

markos14
  • 78
  • 11