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 & HelpSound,  Music Libraries › is it possible to do real time audio effects
Page Index Toggle Pages: 1
is it possible to do real time audio effects? (Read 2161 times)
is it possible to do real time audio effects?
Aug 13th, 2009, 3:59am
 
hi, thx for all the great effort that is put processing and minim.
I have aquestion about the FFT and the inverse FFT from minim.
i would like to see someone do a quick change to the example sketchs from the fft.

i would like to do a FFT from a mp3 file then change the volume for some freq. and do a reverse FFT. the user should now listen to the new sound. it should work like a simple equalizer like in winamp.

I saw an did the examples from the minim homepage but cant figure out how to change the value of different feq. bands.
thx for ur time and help.
Re: is it possible to do real time audio effects?
Reply #1 - Aug 17th, 2009, 9:39am
 
Yes it is possible to do realtime audio effects Wink

i just found this example of an BandPassFilter
but i dont know if i can do multiple filters like this

LowPass       //freq. 1-1000 Hz
BandPass 1  //center freq 1000 Hz
BandPass2   //center freq 2000 Hz
...
HighPass     // freq ...- 10 kHz

anybody out there who can anser if it is practical to build a realtime digital eq this way ?? a quick answer if i should persue this way could help. maybe there a better audio liberys for audio effects then in processing but i didint find free ones


Code:

/**
* Band Pass Filter
* by Damien Di Fede.
*  
* This sketch demonstrates how to use the BandPass effect.
* Move the mouse left and right to change the frequency of the pass band.
* Move the mouse up and down to change the band width of the pass band.
*/

import ddf.minim.*;
import ddf.minim.effects.*;

Minim minim;
AudioPlayer groove;
BandPass bpf;

void setup()
{
 size(512, 200, P2D);
 
 minim = new Minim(this);
 
 groove = minim.loadFile("groove.mp3");
 groove.loop();
 // make a band pass filter with a center frequency of 440 Hz and a bandwidth of 20 Hz
 // the third argument is the sample rate of the audio that will be filtered
 // it is required to correctly compute values used by the filter
 bpf = new BandPass(440, 20, groove.sampleRate());
 groove.addEffect(bpf);
}

void draw()
{
 background(0);
 stroke(255);
 // draw the waveforms
 // the values returned by left.get() and right.get() will be between -1 and 1,
 // so we need to scale them up to see the waveform
 for(int i = 0; i < groove.right.size()-1; i++)
 {
   float x1 = map(i, 0, groove.bufferSize(), 0, width);
   float x2 = map(i+1, 0, groove.bufferSize(), 0, width);
   line(x1, height/4 - groove.left.get(i)*50, x2, height/4 - groove.left.get(i+1)*50);
   line(x1, 3*height/4 - groove.right.get(i)*50, x2, 3*height/4 - groove.right.get(i+1)*50);
 }
 // draw a rectangle to represent the pass band
 noStroke();
 fill(255, 0, 0, 60);
 rect(mouseX - bpf.getBandWidth()/20, 0, bpf.getBandWidth()/10, height);
}

void mouseMoved()
{
 // map the mouse position to the range [100, 10000], an arbitrary range of passBand frequencies
 float passBand = map(mouseX, 0, width, 100, 2000);
 bpf.setFreq(passBand);
 float bandWidth = map(mouseY, 0, height, 50, 500);
 bpf.setBandWidth(bandWidth);
 // prints the new values of the coefficients in the console
 bpf.printCoeff();
}

void stop()
{
 // always close Minim audio classes when you finish with them
 groove.close();
 // always stop Minim before exiting
 minim.stop();
 
 super.stop();
}
Re: is it possible to do real time audio effects?
Reply #2 - Nov 17th, 2009, 8:58am
 
for lo pass or hi pass filters you can use the iirfilter.

check out: unfortunately i can't post links because i have to post 5 normal post before i can do that, well....

check out the minim references and look for IIRfilter!

cheers,
j
Page Index Toggle Pages: 1