We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Visual content based on audio pitch...
Page Index Toggle Pages: 1
Visual content based on audio pitch... (Read 928 times)
Visual content based on audio pitch...
Jan 27th, 2010, 3:20pm
 
I will start by explaining I am very new to this.

I am looking to create an interactive experience for a school project and would appreciate some insight or helpful information on how I might get started.

A summary of my intent for the project:

"Feedback will be presented on a screen that the user can interact with via microphone communication. The user will be presented with various questions that they will need to answer in order to get a visual response.

The louder a person speaks into the mic, the more chaotic the feedback — Imagery will be intense and confusing, audio will be loud and hard to hear. Whispering into the mic will result in faint imagery and quiet audio feedback that is hard to understand. Speaking slowly, calmly, and in a balanced tone will prompt a harmonious visual and audio representation."

Basically, I need to figure out how to generate content based on audio pitch/tone. Too ambitious for a n00b?
Re: Visual content based on audio pitch...
Reply #1 - Jan 28th, 2010, 12:34am
 
you could start by doing a Fourier transform of the sound, you know like those LED equalizers on old stereos. This is the simplest code I could come up with. More on the minim documentation: http://code.compartmental.net/tools/minim/manual-fft/  

Code:

import ddf.minim.signals.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;

String filename = "full path to a wav or mp3 file here";

FFT fftLog1;
Minim minim;
AudioPlayer groove1;

void setup() {
 size(600,400);
 minim = new Minim(this);
 groove1 = minim.loadFile(filename);
 groove1.loop(); //repeat each song
 //create the FFT logarithmic scale
 fftLog1 = new FFT(groove1.bufferSize(),groove1.sampleRate());
}

void draw() {
 background(0);
 stroke(255);
 fftLog1.forward(groove1.mix); //play both channels
 for(int i = 0; i < fftLog1.specSize(); i++) {
   line(i, height, i, height - fftLog1.getBand(i));
 }
 fill(255);
}
Page Index Toggle Pages: 1