Skip to content

Instantly share code, notes, and snippets.

@aravindpai
Created July 10, 2019 07:25
Show Gist options
  • Save aravindpai/c9f585ff02564c19908ee88b5eed1a06 to your computer and use it in GitHub Desktop.
Save aravindpai/c9f585ff02564c19908ee88b5eed1a06 to your computer and use it in GitHub Desktop.
train_audio_path = '../input/tensorflow-speech-recognition-challenge/train/audio/'
all_wave = []
all_label = []
for label in labels:
print(label)
waves = [f for f in os.listdir(train_audio_path + '/'+ label) if f.endswith('.wav')]
for wav in waves:
samples, sample_rate = librosa.load(train_audio_path + '/' + label + '/' + wav, sr = 16000)
samples = librosa.resample(samples, sample_rate, 8000)
if(len(samples)== 8000) :
all_wave.append(samples)
all_label.append(label)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment