[PD] LibPd on microcontroller

cyrille henry ch at chnry.net
Tue May 10 10:47:01 CEST 2016


hello,

Le 10/05/2016 00:37, Christof Ressi a écrit :
> Hi,
>
> I've read your mail, it actually was the key source of inspiration for trying out DSP on a microcontroller!
>
>> in fact, I did not recommend audio processing on hardware that did not have support for float arithmetic.
>> (only me or crazy nerd do that).
>
> I might be crazy as well then :-). I just wanna give it a try and see how far I'll get. I'm just excited about the low price of these modules, given their rather fast speed (and of course the integrated WiFi functionality!). I'm dreaming of tiny effect/sound modules that do a certain DSP job and receive/send messages via WiFi.
>
>
>> a micro controller to use is for example the cortex M4. You  can find them on the teensy hardware.
>
> Apparantly the Teensy 3.x uses the non-FPU version of the cortex M4:
> https://forum.pjrc.com/threads/25909-Teensy3-1-and-FPU-%28Floating-Poitn-Unit%29
crap.

>
> Right now I can't see any advantage over the ESP8266. Also it costs about 4 times as much!
unless you are planning to produce 100 000 of this hardware, 20$ is nothing regarding 1 month of work.
I think you should start using the ESP8266 for the wifi and connect them to a teensy and it's audio feature. Then, you'll be able to optimized the teensy with you DSP code, and eventually put it in the ESP8266.


>
> Some guy made a benchmark test between ESP8266, Teensy 3.1 and Arduino Due:
> http://forum.arduino.cc/index.php?topic=337653.0
>
> The ESP8266 wins for floating points (and loses clearly for integers).
floating point are about 10 time slower than int. You can't use them.

according to this benchmark, on the ESP826 chip, this line of code need 431ms:
   for (int i = 0; i < 100000; i++) a += a * a + 1000.7 / a - 40.4;

at 44.1KHz, you have only 22µs between audio sample.
let's say that you can use 15µs for each sample, the rest for the wifi, audio codec communication, etc.

1 sample computation should then be faster than :
   for (int i = 0; i < 4; i++) a += a * a + 1000.7 / a - 40.4;
(note the i<4) : this is not much for serious DSP stuff.


using int on the ESP826, 1 sample computation should be faster than :
   for (int i = 0; i < 37; i++) b += b * b + 1000 / b - 40;

on the OCS synth, i reduce the moog filter (same algo than the one i send to this list) to:

20 time the >> or << instruction
23 : addition or substraction
12 : 32 bit multiplication
6 : 64 bit multiplication

it is the most CPU hungry module.


> Since you got DSP stuff working on an Arduino Due, it should also work on an ESP8266, I guess... But it's my task to find out.
it work, but only if you find how an elephant can fit in a show box.

>
> By the way, what kind of interface did you actually choose for the audio output and have you tried several methods?
I know only 1 way to go : i2s.
i use a WM8731.

cheers
c

>
> Thanks for sharing your experience!
>
> Christof
>
>
>
>
>
>
>
>
>> Gesendet: Montag, 09. Mai 2016 um 17:39 Uhr
>> Von: "cyrille henry" <ch at chnry.net>
>> An: pd-list at lists.iem.at
>> Betreff: Re: [PD] LibPd on microcontroller
>>
>> hello,
>>
>> I recently send a mail in this list describing my experience of audio synthesis on microcontroler, but i did not use libpd.
>>
>> i did not recommend libpd for microcontrolers.
>>
>> in fact, I did not recommend audio processing on hardware that did not have support for float arithmetic.
>> (only me or crazy nerd do that).
>>
>> a micro controller to use is for example the cortex M4. You  can find them on the teensy hardware.
>> teensy also provide a audio synthesis library, and is supported by arduino IDE.
>>
>> You can also have a look at the heavy compiler if you want to embedded a pd patch.
>>
>> Cyrille
>>
>>
>>
>>
>> Le 09/05/2016 17:01, Christof Ressi a écrit :
>>> Hi,
>>>
>>> has anyone experience in using LibPd on a microcontroller?
>>> I wanna try to run some rather basic DSP code on this guy here:
>>> https://www.olimex.com/Products/IoT/MOD-WIFI-ESP8266-DEV/open-source-hardware
>>> There are some existing Arduino/C++ frameworks and I thought I could either write my own small DSP library in C++ or use LibPd.
>>>
>>> I understood that LibPd is completely independed of audio drivers and external libraries and since it's plain C code it should work on everything that can run code. However, I have only encountered LibPd in the context of other applications (processing, openFrameworks) and mobile devices so far. Do you think it could work on an ESP8266? I'm also a bit concerned about efficiency, as computation power is rather limited:
>>>
>>> "ESP8266EX is embedded with Tensilica L106 32-bit micro controller (MCU), which features extra low
>>> power  consumption  and  16-bit  RSIC. The  CPU  clock  speed  is  80MHz.  It  can  also  reach  a  maximum
>>> value  of  160MHz.  Real  Time  Operation  System  (RTOS)  is  enabled.  Currently,  only  20%  of  MIPS  has
>>> been  occupied  by  the  WiFi  stack,  the  rest  can  all  be  used  for  user  application  programming  and
>>> development."
>>>
>>> Christof
>>>
>>> _______________________________________________
>>> Pd-list at lists.iem.at mailing list
>>> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
>>>
>>
>> _______________________________________________
>> Pd-list at lists.iem.at mailing list
>> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
>>
>
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
>



More information about the Pd-list mailing list