Anonymous commenting enabled / on the bottom of the page is a vote for next tutorials

Sunday, March 13, 2011

Pure Data Visual Microphone

Showing the Webcam input in GEM

1. Open up a new PureData window, and add a "ADC~" Object. ADC object is the reverse of the "DAC~" object, the ADC object listens to the microphone
make sure in your PD preferences, the right microphone is selected

2. Add a "env~" object, this object outputs the Amplitude ( in DB ) from the microphone, connect a numberbox to it to see the value.

3. Let's start making the GEMpart
( for more information about GEM: )

3.1 Add a "gemwin" object, this will declare the rendering engine
3.2 The "create,1" and "destroy" messageboxes are used to open or close the rendering view.

4. now the rendering chain for our object that will represent the volume.
4.1 Add a "gemhead" object

4.2 Connect it to the rectangle object, this will draw a rectangle in the viewport
a rectangle object is always defined with 2 arguments (width and height) so make the object "rectangle 0.2 0.2" . now u see 2 inlets for the rectangle object
we can control the width and height ( see next steps )

5. Now we can connect the volume output of the microphone to the size of the rectangle, but the number we get is to high so we'll divide it by 25 to get a number somewhat in the range between 1 - 3. ( you can always give it your own settings )

5.1 Divide the incoming number with 25 by putting a "/ 25" object.

5.2 We will add a "average 5" object. average 5 takes the 5 previous numbers and outputs the average of them, this could be "average 10" the result is a smoother motion in the graphics, the numbers increment in a slower smoother way.

5.3 Now we connect our new number to the Right inlet of the rectangle if you want to make a vertical line representing the sound, or to the left inlet, or both?.

Now you can press the CREATE button and see the result.

im always curious about your own project with this! so if you make a modification or a nice version of it i will be glad to see it


  1. Super!

    But, I wish the inline images were big enough to read directly.

    Thank you.

  2. [ you can click the images to enlarge them ]

  3. Hi, I would just like to really say Thank you! I am just starting with PD, I tend to get confused, but your tutorials are clear and interesting, so really thanks. when I'll get better I'll post. :)

    One question: my microphone has some noise that makes the rectangle (and the numbers) shake a bit. Is there a way to kind of put a limit? (if the value is under a certain value, consider it 0?)

    Thanks a lot again,

    1. Yes you can use the [average 20] it will average the 20 previous frames making it look a loot smoother.. or [average 10] for 10 previous frames