mfb
Prev | Orchestra Opcodes and Operators | Next

## mfb

mfb — Mel scale filterbank for spectral magnitudes.

## Description

Applies a Mel scale filterbank to an array containing a series of magnitude bins.

## Syntax

    kout[] mfb kin[],klow,khigh,ibands

## Initialization

ibands -- number of bands in the Mel filter bank. Determines the size of the output array.

## Performance

kout[] -- output array containing the MFB with ibands bands. It will be created if it does not exist.

kin[] -- input array containing the input magnitude bins.

klow -- lowest frequency (rounded to the nearest bin centre frequency).

khigh -- highest lowest frequency (rounded to the nearest bin centre frequency).

## Examples

Here is an example of the mfb opcode. It uses the file mfb.csd.

Example 548. Example of the mfb opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>
    <CsOptions>
    </CsOptions>
    <CsInstruments>
    ksmps = 64
    instr 1

     ifftsize init 1024
     ibins init ifftsize/2
     kIn[] init ifftsize
     kcnt init 0
     p3 = filelen("fox.wav")
     asig diskin "fox.wav"
     kIn shiftin asig
     kcnt += ksmps
     if kcnt == ifftsize then
      kFFT[] = rfft(kIn)
      kPows[] = pows(kFFT)
      kMFB[] = log(mfb(kPows,300,8000,32))
      kmfcc[] = dct(kMFB)
      kcnt = 0
      kfb = 0
      while kfb < 32 do
       printf("mfcc[%d] = %.3f \n", kfb+1, kfb, kmfcc[kfb])
       kfb += 1
      od
     endif

    endin
    </CsInstruments>
    <CsScore>
    i1  0 1
    </CsScore>
    </CsoundSynthesizer>

## See Also

Vectorial opcodes, array opcodes, dct

## Credits

Author: Victor Lazzarini
NUI Maynooth
2016

New in version 6.08

Prev | Up | Next
metro | Home | midglobal