[CLAM] STFT configuration
Patrick Drury
patrickdrury at hotmail.co.uk
Tue Jul 8 12:49:47 PDT 2008
Hi,
I'm using CLAM to develop an automated music transcription system for my MSc project. I'm using the SpectralAnalysis and the SpectralPeakDetection classes to produce an array of frequency peaks and their relative strengths. At the moment the output of my system looks something like this for a 3000 sample chunk of piano at C5 (44100Hz Sample rate):
Number of peaks = 56
1. Mag = 1 Freq = 527.066 Note = C5
2. Mag = 0.433355 Freq = 1106.62 Note = C#6
3. Mag = 0.234237 Freq = 2495.64 Note = D#7
4. Mag = 0.0988229 Freq = 2956.98 Note = F#7
5. Mag = 0.127852 Freq = 3501.44 Note = A6
6. Mag = 0.121919 Freq = 3885.22 Note = B7
7. Mag = 0.149638 Freq = 4367.42 Note = C#8
8. Mag = 0.157781 Freq = 5109.65 Note = D#8
9. Mag = 0.0964647 Freq = 5422.36 Note = E8
This is almost correct, having checked it against spectra produced by various audio applications but I have only managed to acheive this after spending ages configuring the window size manually:
//STFT method, performs the STFT on a
//chunk of Audio and puts the data into a
//CLAM::Spectrum object
void AMTPeakDetect::STFT()
{
SpectralAnalysisConfig config;
cout << "Enter Size:";
int size;
cin >> size;
audioData.SetSize(size);
int windowSize = 679;
int spectrumSize = 513;
config.SetSamplingRate(audioData.GetSampleRate());
config.SetWindowSize(windowSize);
spectrum.SetSize(spectrumSize);
spectrum.SetScale(EScale::eLog);
SpectralAnalysis(sa);
sa.Configure(config);
sa.Start();
sa.Do(audioData, spectrum);
sa.Stop();
}
Is there a way of setting the window size automatically to a value which produces a correct result? If not how would one calculate the optimum window size to choose. I've also tried using various different window types. Any help on this matter will be greatly appreciated.
Thanks
Patrick
_________________________________________________________________
Play and win great prizes with Live Search and Kung Fu Panda
http://clk.atdmt.com/UKM/go/101719966/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.clam-project.org/pipermail/clam-users-clam-project.org/attachments/20080708/b84d3d38/attachment-0002.htm>
More information about the clam-users
mailing list