Skip to content

Instantly share code, notes, and snippets.

@vinay-hebb
Forked from manashmandal/mfcc.py
Created October 18, 2018 15:14
Show Gist options
  • Select an option

  • Save vinay-hebb/5a1571a05a12cde1685f37867498e178 to your computer and use it in GitHub Desktop.

Select an option

Save vinay-hebb/5a1571a05a12cde1685f37867498e178 to your computer and use it in GitHub Desktop.

Revisions

  1. Manash Kumar Mandal revised this gist Nov 21, 2017. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion mfcc.py
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,5 @@
    import numpy as np
    import librosa
    from sklearn.model_selection import train_test_split

    def wav2mfcc(file_path, max_pad_len=11):
    wave, sr = librosa.load(file_path, mono=True, sr=None)
  2. Manash Kumar Mandal revised this gist Nov 21, 2017. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions mfcc.py
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@
    import numpy as np
    import librosa
    from sklearn.model_selection import train_test_split

    def wav2mfcc(file_path, max_pad_len=11):
    wave, sr = librosa.load(file_path, mono=True, sr=None)
    wave = wave[::3]
  3. Manash Kumar Mandal created this gist Nov 21, 2017.
    7 changes: 7 additions & 0 deletions mfcc.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    def wav2mfcc(file_path, max_pad_len=11):
    wave, sr = librosa.load(file_path, mono=True, sr=None)
    wave = wave[::3]
    mfcc = librosa.feature.mfcc(wave, sr=16000)
    pad_width = max_pad_len - mfcc.shape[1]
    mfcc = np.pad(mfcc, pad_width=((0, 0), (0, pad_width)), mode='constant')
    return mfcc