Vikkes February 2016

libpd on android: read [adc~] into buffer

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.

Answers


umläute February 2016

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~]

Post Status

Asked in February 2016
Viewed 3,104 times
Voted 13
Answered 1 times

Search




Leave an answer