51 lines · 1.5 KB · Text
RawDownload
//---------------------------------------------------------------------// name: mfcc-basic.ck// desc: mel-frequency cepstral coefficients//       basic MFCC feature extractor//// version: need chuck version 1.5.0.0 or higher// sorting: part of ChAI (ChucK for AI)//// uncomment for MFCC API:// MFCC.help();//// author: Ge Wang (https://ccrma.stanford.edu/~ge/)// date: Spring 2023//--------------------------------------------------------------------- // synthesis / analysis networkadc => FFT fft =^ MFCC mfcc => blackhole; // set number of coefficients in MFCC (how many we get out)// 13 is a commonly used value; using less here for printing7 => mfcc.numCoeffs;// set number of mel filters in MFCC10 => mfcc.numFilters; // set FFT size2048 => fft.size;// set window type and sizeWindowing.hann(fft.size()) => fft.window;// our hop size (how often to perform analysis)fft.size()::samp => dur HOP; // let one FFT-size of time pass (to buffer)fft.size()::samp => now;// control loopwhile( true ){    //----------------------------------------------------------------    // upchuck() computes our MFCC, automatically computing upstream    // dependencies connected to it using =^ (e.g., FFT)    //----------------------------------------------------------------    mfcc.upchuck();    // print    cherr <= "MFCC: ";    // print the MFCC results    for( int i; i < mfcc.fvals().size(); i++ )    { cherr <= mfcc.fval(i) <= " "; }    // endline    cherr <= IO.newline();    // advance time    HOP => now;}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t