0

I developed an Android app with libpd ( [adc~]->[*~ 0.5]->[dac~]). The app works fine. I get the voice from mic in my earpiece.

My questions are:

  1. How can i catch the data from [adc~] into buffer array?

I want to send this buffer over network to another device and load it into [dac~].

  1. How can i load the buffer array into [dac~]?

This action should be done in real/near time. Writefs~ and readfs~ to a disk don't fullfill.

umläute
  • 28,885
  • 9
  • 68
  • 122
Vikkes
  • 463
  • 4
  • 17

1 Answers1

0

well, a buffer in Pd is called [table].

first thing you need to is to instantiate a named table with agiven size. e.g. the following will create a table named "foo" of 44100 samples length (1sec if you are running at 44.1kHz)

 [table foo 44100]

you can write signals into that table with [tabwrite~] (which will start writing whenever it receives a [bang()

 [adc~ 1]
 |
 |  [bang(
 | /
 |/
 [tabwrite~ foo]

and to read a signal from a table, use...[tabread~], or [tabplay~], or [tabread4~], or [tabosc~], or...

 [bang(
 |
 [tabplay~ foo]
 |
 [dac~]
umläute
  • 28,885
  • 9
  • 68
  • 122
  • How to catch the table in java? Should i bang in a loop as long i speak? – Vikkes Feb 11 '16 at 20:47
  • the first question in your comment is unrelated to this "Question". if you have additional questions, please start new ones, and close this one as "done" (if it is indeed answered). – umläute Feb 12 '16 at 14:07
  • the second question in your comment does not make sense to me. (and you could of course *try it out* to see what it does) – umläute Feb 12 '16 at 14:08
  • the relation is at very beginning of this post “I developed an Android app with libpd ” In JAVA I do " … loadPatch() +... initPd() .. + ... dispatcher = new PdUiDispatcher() + ... dispatcher.addListener([table foo], new PdListener() .." . In PD thanks you tip: I do “[table foo 44100] + [adc~ 1]-> [bang(-> [tabwrite~ foo]” The first Question regards: how to receive the [table foo]? I don't see method e.g receiveArray (). The second question was: Should I bang in a new Thread as long I speak ? In general do you have a Java example for reading the table foo?. Thx – Vikkes Feb 12 '16 at 17:38
  • ok I found PdBase.readArray and PdBase.writeArray, Will try this one – Vikkes Feb 12 '16 at 18:11