Best way to add MFCC, Delta and Delta Delta coefficients for feature extraction

626 views
Skip to first unread message

Good Robot

unread,
Jul 22, 2022, 6:20:15 AM7/22/22
to librosa
Hello,

I am trying to get information from audio files that are basically impulses, or bursts.  I am trying to figure out the best way to add MFCCs, Delta and Delta-Delta.

for 40 features each or n_mfcc=40, I tried using this approach:

def extract_features(file_name):
    try:
        durationSeconds = 1
        audio, sample_rate = librosa.load(file_name, res_type='kaiser_fast')
        trimmed = librosa.util.fix_length(audio, size=int(sample_rate * durationSeconds))
        mfccs = librosa.feature.mfcc(y=trimmed, sr=sample_rate, n_mfcc=nmfcc)
        mfcc_delta = librosa.feature.delta(mfccs)
        mfcc_delta2 = librosa.feature.delta(mfccs, order=2)   
 
        mfccs = (np.hstack((np.std( mfccs, axis=1), np.std( mfcc_delta, axis=1) , np.std( mfcc_delta2, axis=1))))

    except Exception as e:
        print("Error encountered while parsing file: ", file_name)
        return None

    return  mfccs

However, when I use this approach, my accuracy score is very poor, on the order of 65%. 

As a starting point, I just wanted to verify if this approach to extract the MFCCs and its Deltas are correct and that the output makes sense?  If not,  what is the best practice to extract the Delta and Delta-Delta with the MFCC feature extraction.

Any guidance will be sincerely appreciated!

Thank you!

Brian McFee

unread,
Jul 22, 2022, 7:44:21 AM7/22/22
to librosa
The stacking seems okay, but your aggregation is only including the standard deviations.  You might want to try include the means as well, at least for mfcc.  Mean of delta is a bit less informative, but it shouldn't hurt to include.

Good Robot

unread,
Jul 22, 2022, 9:14:56 AM7/22/22
to Brian McFee, librosa
THANK YOU!

On Fri, Jul 22, 2022 at 7:44 AM Brian McFee <brian...@nyu.edu> wrote:
    EXTERNAL EMAIL : Exercise caution when responding, opening links, or opening attachments.
 
--
You received this message because you are subscribed to a topic in the Google Groups "librosa" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/librosa/FNMNZA7SQ3s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to librosa+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/librosa/df17792c-bc9f-49af-a5e1-3879b4af0dc8n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages