0

I have written a Pure Data patch, which works on PC (Windows); when I integrate it with Android, an audio file is saved, but it contains no data. I confirmed that the file is there using ES file explorer, and I granted app permissions for recording audio in Android Studio.

[![Pure data patch.

Max N
  • 1,134
  • 11
  • 23
iBharath
  • 31
  • 9

2 Answers2

0

Your patch has undefined trigger order issues. It is not clear from the visual patch if

  1. in the recording section the filename gets passed first of the start message gets initiated first.
  2. in the playback section the 0/1 from the toggle gets received by two receivers, one of which sets the filename, the other one passes the 0/1 to [readsf~]

Additionally you are recording a stereo file but playing back only mono. I tried to stick to your patch as close as possible, but I use "bang" [bng] objects instead of "toggle" [tgl] objects because they are better suited for initiating things rather then switching between two states.

enter image description here

Max N
  • 1,134
  • 11
  • 23
  • Does the order matter, i use the same patch on PC, i runs perfectly. The problem arises only when integrate in android. A rec.wav file is created for the duration of the record but the problem is there is no content for the duration/i hear nothing. – iBharath Oct 04 '15 at 14:42
  • Is there no audio, e.g. the soundfile consists of a constant 0, or is it only that you can't playback the file? have you tried copying the soundfile back to the computer for playback there? – Max N Oct 06 '15 at 04:15
  • the audio file contains constant 0, even i tried loading it in matlab and it showed a all zero matrix. – iBharath Oct 06 '15 at 17:47
  • The patch you provided works perfectly well in PC, but when i load it on my phone ,running at background, the patch records a wave of zero amplitude,but the duration is what i recorded. I hear nothing and MATLAB plot also shows zero amplitude. – iBharath Oct 08 '15 at 07:34
0

It's necessary to initialize the number of channels in the initPd function with Android Studio. It was set to 0. When changed to AudioParameters.suggestInputChannels();, I was able to get the audio.

Max N
  • 1,134
  • 11
  • 23
iBharath
  • 31
  • 9