1

I am working on an Arduino based DMX control mechanism. It turns out that I need the help of the Pure Data. I am only 4 days familiar to Pd and so I expect some help from here.

In Pd I want to get the audio from the system speaker out (or microphone), analyze it, and separate different freq bands like high, mid, low to trigger sending message accordingly to the Arduino via comport.

I tried and succeed in implementing DMX signal generation in Arduino and sending messages from Pd to Ardunio. I am stuck at audio processing and decision taking. Can you please help me solve my problem?

Max N
  • 1,134
  • 11
  • 23
Anandu v t
  • 31
  • 5

3 Answers3

3

what's wrong with [hip~] (high-pass) and [lop~] (low-pass) separating the frequency bands? you can always stack them in order to get higher-order filters.

or use iemlib's high-quality high-order bessel, chebycheff and butterworth filters.

umläute
  • 28,885
  • 9
  • 68
  • 122
2

Have a look at the FFT example that comes with PD : doc/3.audio.examples/I01.Fourier.analysis.pd

FFT analysis demo

My PD skills are pretty rusty, but here's a rough stab getting the microphone (adc~) into the FFT example:

basic FFT demo

#N canvas 0 22 794 545 10;
#X obj 16 34 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1
;
#X obj 16 64 adc~;
#X obj 14 129 peakamp~ 40;
#X floatatom 14 159 5 0 0 0 - - -;
#X obj 108 312 tabwrite~ \$0-real;
#X obj 150 273 tabwrite~ \$0-imaginary;
#X obj 163 7 loadbang;
#X obj 112 87 fft~;
#X msg 344 289 \; pd dsp 1;
#N canvas 0 22 450 300 (subpatch) 0;
#X array \$0-real 64 float 2;
#X coords 0 64 64 -64 256 200 1;
#X restore 467 87 graph;
#N canvas 0 22 450 300 (subpatch) 0;
#X array \$0-imaginary 64 float 2;
#X coords 0 64 64 -64 256 200 1;
#X restore 467 333 graph;
#X obj 153 230 metro 40;
#X text 219 6 when the patch loads;
#X text 44 37 enable mic(ADC);
#X text 103 70 pass data to FFT;
#X text 21 109 test peak amp.;
#X text 163 214 every 40ms;
#X text 162 245 plot imaginary and real FFT components;
#X text 351 265 enable DSP;
#X connect 0 0 1 0;
#X connect 0 0 11 0;
#X connect 1 0 2 0;
#X connect 1 0 7 0;
#X connect 2 0 3 0;
#X connect 6 0 8 0;
#X connect 6 0 11 0;
#X connect 6 0 0 0;
#X connect 7 0 4 0;
#X connect 7 1 5 0;
#X connect 11 0 4 0;
#X connect 11 0 5 0;

(save the above snippet as a file with .pd extension)

You may want to access multiple FFT bins and average sections of them (e.g. high, mid, low), but hopefully the above will help as a starter.

Be sure to also check the help page for the fft~ object.

George Profenza
  • 50,687
  • 19
  • 144
  • 218
2

you use [adc~] to get your signal from microphone then use [fft~] to analyse it or any other filters/analyser object. To communicate with arduino use [comport].

you will find lot of information reading the "help" of this objects, and send some code to get a more specific help.

good luck !

Dadep
  • 2,796
  • 5
  • 27
  • 40