[CLAM] Computing MFCCs of an audio file

David García Garzón dgarcia at iua.upf.edu
Fri Aug 8 04:24:11 PDT 2008


Take the lpc.clamnetwork example, that computes not just the lpc but also the 
mfcc. By comparing their configuration parameters side by side with yours you 
may highlight the problem.

The lpc example network just shows the data using a data monitor in realtime. 
If you want to print out such data i suggest you to create a new processing 
to dump the data into a file.

Printing computed data has become a very common task, so i think we should 
write a short tutorial in the wiki on printing the results. Meanwhile you can 
build the processing yourself following those tutorials and those hints:

Setup an SCons file such the one in:
http://iua-share.upf.edu/wikis/clam/index.php/Building_a_processing_library

Create a new processing (MelCepstrumDumper). The processing should have just 
one in port of type CLAM::MelSpectrum (call it _melCepstrumPort) and no 
outports. See:
http://iua-share.upf.edu/wikis/clam/index.php/Creating_a_minimal_processing_object

The processing should have a member that is an std::ofstream
Redefine the ConcreteStart method so that a file is open, redefine the 
ConcreteStop method so that the file is closed and the Do method to take the 
port content and dump it into the file:
bool MelCepstrumDumper::ConcreteStart()
{
	_ouputFile.open("outputfile.txt");
	return true;
}
bool MelCepstrumDumper::ConcreteStop()
{
	_ouputFile.close();
	return true;
}
bool MelCepstrumDumper::Do()
{
	const CLAM::MelCepstrum & melCepstrum = _melCepstrumPort.GetData();
	const CLAM::DataArray & coefficients = melCepstrum.GetCoefficients();
	for (unsigned i=0; i<coefficients.Size(); i++)
		_outputFile << coefficients[i] << " ";
	_outputFile << std::endl;
	_melCepstrumPort.Consume();
}

If you install it in the same location the other plugins installed, you should 
see the new processing in the processing toolbox. Drop it into the canvas, 
connect it and you will get the output file file rewritten any time you play 
start and stop.

DISCLAIMER: I didn't compile that code so it may not work as is.



On Divendres 08 Agost 2008, RAVI GUPTA wrote:
> Hi,
>
> I want to calculate the MFCCs of an audio wave file using CLAM, I had build
> a network in network editor for this but it doesn't display anything.
>
> Can someone help me to sole this problem? I have attached my network file.
>
> Thanx.
>
>
>
>       Download prohibited? No problem. CHAT from any browser, without
> download. Go to http://in.webmessenger.yahoo.com/



-- 
David García Garzón
(Work) dgarcia at iua dot upf anotherdot es
http://www.iua.upf.edu/~dgarcia
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.clam-project.org/pipermail/clam-users-clam-project.org/attachments/20080808/dad0ddc7/attachment-0002.pgp>


More information about the clam-users mailing list