[CLAM] Re: CLAM digest, Vol 1 #187 - 4 msgs

eduard eaylon at iua.upf.es
Tue Jul 19 04:35:37 PDT 2005


Hi Rhywek,

I had the same problem a few weeks ago. I think you must set the following:
1. number of bands in MelFilterBankConfig
2. number of mel coefficients (NumMelCoefficients) as well as the number 
of cepstrum coefficients in CepstralTransformConfig.

A piece of code that would work is as follows:

//member variables:

   Frame                         _frame;
   MelFilterBank           _melFilterBank;
   CepstralTransform   _cepstralTransform;
   MelCepstrum            _melCepstrum;
   MelSpectrum            _melSpectrum;


// member functions:

void ConfigureMelCepstrumTransform()
{
   // Configure melfilter bank to obtain mel spectrum from spectrum:

   MelFilterBankConfig melConf;
   melConf.SetSpectrumSize( _fftSize/2 + 1);
   melConf.SetSpectralRange( _sr/2.);
   melConf.SetLowCutoff( 20. );
   melConf.SetHighCutoff( _sr/2. );
   melConf.SetNumBands( 20 );    
<--------------------------------------------------------must set this
   _melFilterBank.Configure(melConf);

   // Configure Cepstral Transformation:

   _melSpectrum.SetSpectralRange( _sr/2. );
   _melSpectrum.SetLowCutoff( 20. );
   _melSpectrum.SetHighCutoff( _sr/2. );
   _melSpectrum.SetNumBands( 20 );
   _melCepstrum.AddCoefficients();
   _melCepstrum.UpdateData();
   CepstralTransformConfig cepsConf;
   cepsConf.SetNumMelCoefficients( 20 );      
<------------------------------------------------must set this
   cepsConf.SetNumCepstrumCoefficients( 12 );
   _cepstralTransform.Configure( cepsConf );
}

void ComputeCepstralTransform()
{
   _melSpectrum.SetCenterTime( _frame.GetCenterTime() );
   _melCepstrum.SetCenterTime( _frame.GetCenterTime() );
   _melFilterBank.Start();
   _melFilterBank.Do( _frame.GetSpectrum(), _melSpectrum );
   _melFilterBank.Stop();
   _cepstralTransform.Start();
   _cepstralTransform.Do( _melSpectrum, _melCepstrum );
   _cepstralTransform.Stop();
}



Eduard


clam-request at iua.upf.es wrote:

>Send CLAM mailing list submissions to
>	clam at iua.upf.es
>
>To subscribe or unsubscribe via the World Wide Web, visit
>	http://iua-mail.upf.es/mailman/listinfo/clam
>or, via email, send a message with subject or body 'help' to
>	clam-request at iua.upf.es
>
>You can reach the person managing the list at
>	clam-admin at iua.upf.es
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of CLAM digest..."
>
>
>Today's Topics:
>
>   1. CepstralTransform (Rhywek)
>   2. Re: CepstralTransform (David Garcia Garzon)
>   3. =?iso-8859-2?Q?Re:_[CLAM]_CepstralTransform?= (=?iso-8859-2?Q?Rhywek?=)
>   4. Re: Re: [CLAM] CepstralTransform (Miguel =?ISO-8859-1?Q?Ram=EDrez_J=E1vega?=)
>
>--__--__--
>
>Message: 1
>Date: Mon, 18 Jul 2005 14:05:56 +0200
>From: Rhywek <rhywek at o2.pl>
>To: clam at iua.upf.es
>Subject: [CLAM] CepstralTransform
>
>Hello, all.
>I am running into a problem with MFCC extraction. Here is the relevant code:
>
>...
>      CLAM::XMLStorage::Dump(melSpectrum,
>                   "melSpectrum",
>                   "debugmelSpectrum.xml");
>
>        CLAM::CepstralTransformConfig cepstralTransformConfig;
>
>       
>cepstralTransformConfig.SetNumMelCoefficients(floor(3*log(fs)));//It is
>30 here
>        cepstralTransformConfig.SetNumCepstrumCoefficients(13);
>        cepstralTransformConfig.SetUseBase10(false);
>
>        CLAM::CepstralTransform cepstralTransform(cepstralTransformConfig);
>
>        CLAM::MelCepstrum melCepstrum;
>
>        cepstralTransform.Start();
>
>        cepstralTransform.Do(melSpectrum,melCepstrum);
>
>        cepstralTransform.Stop();
>        
>        CLAM::XMLStorage::Dump(melCepstrum,"MFCC","MFCC.xml");
>...
>
>After execution the file "debugmelSpectrum.xml" contains one long line:
><melSpectrum><SpectralRange>22050</SpectralRange><CenterTime>0</CenterTime><Lo
>wCutoff>0</LowCutoff><HighCutoff>22050</HighCutoff><NumBands>30</NumBands><Coe
>fficients size="30">189.915 132.907 44.3864 34.6573 16.0021 26.2483
>28.6773 17
>.0859 38.7323 15.6943 17.6948 83.4548 52.0764 41.1847 25.1965 10.6456
>11.1537
>6.51261 4.43087 4.85767 4.84433 4.58867 4.33651 4.24629 4.20944 3.9518
>3.70034
> 3.66503 3.54066 3.77783</Coefficients></melSpectrum>
>
>I suppose it is correct data.
>But the file "MFCC.xml" contains oneline line:
><MFCC><CenterTime>0</CenterTime><LowCutoff>0</LowCutoff><HighCutoff>22050</Hig
>hCutoff><Coefficients size="13">0 0 0 0 0 0 0 0 0 0 0 0
>0</Coefficients></MFCC>
>
>Now why the coefficients are all 0? I browsed the code of the Do method
>and it should work as it is... I also wanted to debug it, but I ran into
>different problem - I could not see the variables and objects. I use gdb
>for debugging and if I write "p melFloor" or any other local variable,
>it complains. So I tried to make it like this:
>CXXFLAGS="-ggdb" make CONFIG=release -C build
>but then I set the breakpoint like:
>b CLAM::CepstralTransform::Do(CLAM::MelSpectrum const&, CLAM::MelCepstrum&)
>But when I run the program with "run", the debugging was hardly
>possible. When I tried to list the code with "l" it shown something like:
>1      <<C++-namespaces>>: No such file or directory.
>       in <<C++-namespaces>>
>
>So could you please give me some hints how to debug CLAM programs in gdb?
>
>Thanks in advance,
>Rhywek.
>
>
>
>
>--__--__--
>
>Message: 2
>From: David Garcia Garzon <dgarcia at iua.upf.es>
>Organization: Institut Universitari de l'Audiovisual
>To: clam at iua.upf.es
>Subject: Re: [CLAM] CepstralTransform
>Date: Mon, 18 Jul 2005 14:46:11 +0200
>
>I also don't know exactly what is happening there but i can give you some=20
>hints on debugging CLAM. Firstly, you should compile with CONFIG=3D'debug'.=
>=20
>CXXFLAGS options are overwritten by the CONFIG selection. We found kdbg and=
>=20
>ddd being good graphical front ends for gdb you could use them for easier=20
>debugging. DynamicTypes, like MelCepstrum, have some limitations with=20
>debuggers inspection, you should print them in XML as you already did.
>
>
>A Dilluns 18 Juliol 2005 14:05, Rhywek va escriure:
>  
>
>>Hello, all.
>>I am running into a problem with MFCC extraction. Here is the relevant
>>code:
>>
>>...
>>      CLAM::XMLStorage::Dump(melSpectrum,
>>                   "melSpectrum",
>>                   "debugmelSpectrum.xml");
>>
>>        CLAM::CepstralTransformConfig cepstralTransformConfig;
>>
>>
>>cepstralTransformConfig.SetNumMelCoefficients(floor(3*log(fs)));//It is
>>30 here
>>        cepstralTransformConfig.SetNumCepstrumCoefficients(13);
>>        cepstralTransformConfig.SetUseBase10(false);
>>
>>        CLAM::CepstralTransform cepstralTransform(cepstralTransformConfig=
>>    
>>
>);
>  
>
>>        CLAM::MelCepstrum melCepstrum;
>>
>>        cepstralTransform.Start();
>>
>>        cepstralTransform.Do(melSpectrum,melCepstrum);
>>
>>        cepstralTransform.Stop();
>>
>>        CLAM::XMLStorage::Dump(melCepstrum,"MFCC","MFCC.xml");
>>...
>>
>>After execution the file "debugmelSpectrum.xml" contains one long line:
>><melSpectrum><SpectralRange>22050</SpectralRange><CenterTime>0</CenterTim=
>>    
>>
>e>
>  
>
>><Lo
>>wCutoff>0</LowCutoff><HighCutoff>22050</HighCutoff><NumBands>30</NumBands=
>><
>>Coe fficients size=3D"30">189.915 132.907 44.3864 34.6573 16.0021 26.2483
>>28.6773 17
>>.0859 38.7323 15.6943 17.6948 83.4548 52.0764 41.1847 25.1965 10.6456
>>11.1537
>>6.51261 4.43087 4.85767 4.84433 4.58867 4.33651 4.24629 4.20944 3.9518
>>3.70034
>> 3.66503 3.54066 3.77783</Coefficients></melSpectrum>
>>
>>I suppose it is correct data.
>>But the file "MFCC.xml" contains oneline line:
>><MFCC><CenterTime>0</CenterTime><LowCutoff>0</LowCutoff><HighCutoff>22050=
>>    
>>
></
>  
>
>>Hig hCutoff><Coefficients size=3D"13">0 0 0 0 0 0 0 0 0 0 0 0
>>0</Coefficients></MFCC>
>>
>>Now why the coefficients are all 0? I browsed the code of the Do method
>>and it should work as it is... I also wanted to debug it, but I ran into
>>different problem - I could not see the variables and objects. I use gdb
>>for debugging and if I write "p melFloor" or any other local variable,
>>it complains. So I tried to make it like this:
>>CXXFLAGS=3D"-ggdb" make CONFIG=3Drelease -C build
>>but then I set the breakpoint like:
>>b CLAM::CepstralTransform::Do(CLAM::MelSpectrum const&, CLAM::MelCepstrum=
>>    
>>
>&)
>  
>
>>But when I run the program with "run", the debugging was hardly
>>possible. When I tried to list the code with "l" it shown something like:
>>1      <<C++-namespaces>>: No such file or directory.
>>       in <<C++-namespaces>>
>>
>>So could you please give me some hints how to debug CLAM programs in gdb?
>>
>>Thanks in advance,
>>Rhywek.
>>
>>
>>
>>_______________________________________________
>>CLAM mailing list
>>CLAM at iua.upf.es
>>http://www.iua.upf.es/mtg/clam
>>    
>>
>
>=2D-=20
>David Garc=EDa Garz=F3n <david.garcia at removespam.iua.upf.es>
>Phone: 034 93 542 21 99
>Music Technology Group, Institut Universitari de l'Audiovisual
>Universitat Pompeu Fabra
>
>=2D-=20
>David Garc=EDa Garz=F3n <david.garcia at removespam.iua.upf.es>
>Phone: 034 93 542 21 99
>Music Technology Group, Institut Universitari de l'Audiovisual
>Universitat Pompeu Fabra
>
>
>
>--__--__--
>
>Message: 3
>From: =?iso-8859-2?Q?Rhywek?= <rhywek at o2.pl>
>To: clam at iua.upf.es
>Date: Mon, 18 Jul 2005 15:35:00 +0200
>Subject: [CLAM] =?iso-8859-2?Q?Re:_[CLAM]_CepstralTransform?=
>
>  
>
>>I also don't know exactly what is happening there but i can give
>>    
>>
>you some 
>  
>
>>hints on debugging CLAM. Firstly, you should compile with
>>    
>>
>CONFIG='debug'. 
>I do this.
>  
>
>>CXXFLAGS options are overwritten by the CONFIG selection. We found
>>    
>>
>kdbg and 
>  
>
>>ddd being good graphical front ends for gdb you could use them for
>>    
>>
>easier 
>  
>
>>debugging.
>>    
>>
>Thanks, I will check them.
>
>  
>
>>DynamicTypes, like MelCepstrum, have some limitations with 
>>debuggers inspection, you should print them in XML as you already did.
>>    
>>
>
>Yes I did it and it gives absolutely no clue about what is wrong. On
>one step it is OK, but the next one gives only zeros, so I wanted to
>inspect what is going on in the meantime. And to do that I want to
>inspect simple int, double, std::vector, etc. and not dynamic types,
>but I cannot do this. Anyone has a clue how I could do that?
>
>And still if there is someone with CLAM experience who could take a
>look at my code and say what is wrong, I would highly appreciate that.
>
>  
>
>>A Dilluns 18 Juliol 2005 14:05, Rhywek va escriure:
>>    
>>
>>>Hello, all.
>>>I am running into a problem with MFCC extraction. Here is the
>>>      
>>>
>relevant
>  
>
>>>code:
>>>
>>>...
>>>      CLAM::XMLStorage::Dump(melSpectrum,
>>>                   "melSpectrum",
>>>                   "debugmelSpectrum.xml");
>>>
>>>        CLAM::CepstralTransformConfig cepstralTransformConfig;
>>>
>>>
>>>
>>>      
>>>
>cepstralTransformConfig.SetNumMelCoefficients(floor(3*log(fs)));//It is
>  
>
>>>30 here
>>>        cepstralTransformConfig.SetNumCepstrumCoefficients(13);
>>>        cepstralTransformConfig.SetUseBase10(false);
>>>
>>>        CLAM::CepstralTransform
>>>      
>>>
>cepstralTransform(cepstralTransformConfig);
>  
>
>>>        CLAM::MelCepstrum melCepstrum;
>>>
>>>        cepstralTransform.Start();
>>>
>>>        cepstralTransform.Do(melSpectrum,melCepstrum);
>>>
>>>        cepstralTransform.Stop();
>>>
>>>        CLAM::XMLStorage::Dump(melCepstrum,"MFCC","MFCC.xml");
>>>...
>>>
>>>After execution the file "debugmelSpectrum.xml" contains one
>>>      
>>>
>long line:
>  
>
><melSpectrum><SpectralRange>22050</SpectralRange><CenterTime>0</CenterTime>
>  
>
>>><Lo
>>>
>>>      
>>>
>wCutoff>0</LowCutoff><HighCutoff>22050</HighCutoff><NumBands>30</NumBands><
>  
>
>>>Coe fficients size="30">189.915 132.907 44.3864 34.6573 16.0021
>>>      
>>>
>26.2483
>  
>
>>>28.6773 17
>>>.0859 38.7323 15.6943 17.6948 83.4548 52.0764 41.1847 25.1965
>>>      
>>>
>10.6456
>  
>
>>>11.1537
>>>6.51261 4.43087 4.85767 4.84433 4.58867 4.33651 4.24629 4.20944
>>>      
>>>
>3.9518
>  
>
>>>3.70034
>>> 3.66503 3.54066 3.77783</Coefficients></melSpectrum>
>>>
>>>I suppose it is correct data.
>>>But the file "MFCC.xml" contains oneline line:
>>>
>>>      
>>>
><MFCC><CenterTime>0</CenterTime><LowCutoff>0</LowCutoff><HighCutoff>22050</
>  
>
>>>Hig hCutoff><Coefficients size="13">0 0 0 0 0 0 0 0 0 0 0 0
>>>0</Coefficients></MFCC>
>>>
>>>Now why the coefficients are all 0? I browsed the code of the Do
>>>      
>>>
>method
>  
>
>>>and it should work as it is... I also wanted to debug it, but I
>>>      
>>>
>ran into
>  
>
>>>different problem - I could not see the variables and objects. I
>>>      
>>>
>use gdb
>  
>
>>>for debugging and if I write "p melFloor" or any other local
>>>      
>>>
>variable,
>  
>
>>>it complains. So I tried to make it like this:
>>>CXXFLAGS="-ggdb" make CONFIG=release -C build
>>>but then I set the breakpoint like:
>>>b CLAM::CepstralTransform::Do(CLAM::MelSpectrum const&,
>>>      
>>>
>CLAM::MelCepstrum&)
>  
>
>>>But when I run the program with "run", the debugging was hardly
>>>possible. When I tried to list the code with "l" it shown
>>>      
>>>
>something like:
>  
>
>>>1      <<C++-namespaces>>: No such file or directory.
>>>       in <<C++-namespaces>>
>>>
>>>So could you please give me some hints how to debug CLAM
>>>      
>>>
>programs in gdb?
>  
>
>>>Thanks in advance,
>>>Rhywek.
>>>
>>>
>>>
>>>_______________________________________________
>>>CLAM mailing list
>>>CLAM at iua.upf.es
>>>http://www.iua.upf.es/mtg/clam
>>>      
>>>
>>-- 
>>David García Garzón <david.garcia at removespam.iua.upf.es>
>>Phone: 034 93 542 21 99
>>Music Technology Group, Institut Universitari de l'Audiovisual
>>Universitat Pompeu Fabra
>>
>>-- 
>>David García Garzón <david.garcia at removespam.iua.upf.es>
>>Phone: 034 93 542 21 99
>>Music Technology Group, Institut Universitari de l'Audiovisual
>>Universitat Pompeu Fabra
>>
>>
>>_______________________________________________
>>CLAM mailing list
>>CLAM at iua.upf.es
>>http://www.iua.upf.es/mtg/clam
>>
>>    
>>
>
>
>
>
>--__--__--
>
>Message: 4
>Subject: Re: [CLAM] Re: [CLAM] CepstralTransform
>From: Miguel =?ISO-8859-1?Q?Ram=EDrez_J=E1vega?= <mramirez at iua.upf.es>
>To: Rhywek <rhywek at o2.pl>
>Cc: clam at iua.upf.es
>Date: Mon, 18 Jul 2005 15:56:44 +0200
>
>
>  
>
>>And still if there is someone with CLAM experience who could take a
>>look at my code and say what is wrong, I would highly appreciate that.
>>
>>    
>>
>
>Just send an e-mail to the list with the code attached :)
>
>Miguel.
>
>
>
>
>
>--__--__--
>
>_______________________________________________
>CLAM mailing list
>CLAM at iua.upf.es
>http://iua-mail.upf.es/mailman/listinfo/clam
>
>
>End of CLAM Digest
>
>  
>






More information about the clam-users mailing list