This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cStringIO import StringIO | |
import os | |
import numpy as np | |
import scipy.io.wavfile | |
import tensorflow as tf | |
output_path = os.path.expanduser('~/Desktop/test.tfrecord') | |
sample_path = os.path.expanduser('~/Desktop/test.wav') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mel spectrum constants. | |
_MEL_BREAK_FREQUENCY_HERTZ = 700.0 | |
_MEL_HIGH_FREQUENCY_Q = 1127.0 | |
def mel_to_hertz(mel_values): | |
"""Converts frequencies in `mel_values` from the mel scale to linear scale.""" | |
return _MEL_BREAK_FREQUENCY_HERTZ * ( | |
np.exp(np.array(mel_values) / _MEL_HIGH_FREQUENCY_Q) - 1.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import librosa | |
import matplotlib | |
import matplotlib.pyplot as plt | |
matplotlib.rcParams['svg.fonttype'] = 'none' | |
import numpy as np | |
from scipy.io.wavfile import read as readwav | |
# Constants |