Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
codews
codews's Profile
1
Posts
0
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Stuck on a project
[1 Reply]
23-Nov-2010 03:39 PM
Forum:
Core Library Questions
Hi all,
i have a university project to record a sample of my voice,use fft on it, find the fundamental frequency of it and find which is the nearest note of this frequency. Final step is to turn the audio into midi using the promidi library.
So far i have done this:
import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
AudioInput in;
Minim minim;
FFT fft;
void setup()
{
minim = new Minim(this);
in = minim.getLineIn(Minim.MONO, 16384, 44100);
fft = new FFT(in.bufferSize(), in.sampleRate());
}
void draw()
{
fft.forward(in.mix);
PlotSpectrum();
}
void PlotSpectrum()
{
for(int i=1; i < fft.specSize() - 1; i++)
{
line(width * i / fft.specSize(), height - 20*log10(fft.getBand(i)),width * (i-1) / fft.specSize(), height - 20*log10(fft.getBand(i-1
)));
}
}
int getMaxFreqIndex()
{
int maxi=1;
float maxSpec = fft.getBand(1);
for(int i=2; i < fft.specSize(); i++)
{
if(maxSpec < fft.getBand(i))
{
maxSpec=fft.getBand(i);
maxi=1;
}
}
return maxi;
}
float log10(float x)
{
return (log(x)/log(10));
}
Could anyone help to go any further?
«Prev
Next »
Moderate user : codews
Forum