Feature Extraction
Feature extraction utilities for audio processing.
This module provides functions to extract features such as MFCCs and spectrograms.
Author: Esgr0bar
extract_mfcc(y, sr, n_mfcc=13)
Extract MFCC features from an audio signal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
ndarray
|
Audio time series. |
required |
sr |
int
|
Sample rate of the audio. |
required |
n_mfcc |
int
|
Number of MFCCs to return. |
13
|
Returns:
Type | Description |
---|---|
numpy.ndarray: MFCC feature matrix. |
Source code in src/feature_extraction.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
extract_spectrogram(y, sr, n_fft=2048, hop_length=512)
Extract spectrogram from an audio signal.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
ndarray
|
Audio time series. |
required |
sr |
int
|
Sample rate of the audio. |
required |
n_fft |
int
|
Number of samples per FFT. |
2048
|
hop_length |
int
|
Number of samples between successive frames. |
512
|
Returns:
Type | Description |
---|---|
numpy.ndarray: Spectrogram matrix. |
Source code in src/feature_extraction.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|