cpuguy96 / StepCOVNet

Deep Learning to Create StepMania SM FIles
Apache License 2.0
15 stars 2 forks source link

Using librosa.load to resample audio files #8

Closed jhaco closed 7 months ago

jhaco commented 1 year ago

Since we're already using the Librosa library for some of our audio processing, we could cut down on a lot of the wav_converter code by using librosa.load

By default, librosa.load will resample to 22,050 hz, reduce the number of channels to 1 (mono), and normalize the data so that values will range from -1 to 1.

Since we want to create 16,000 hz, mono wav files, we can adjust the conversion function to do this using

import librosa
import soundfile as sf

input_audio_data, sample_frequency = librosa.load(filename, sr=16000)
sf.write(file_output_path, input_audio_data, sample_frequency)

Thoughts?

jhaco commented 1 year ago

I'll also add this functionality to SMDataTools. StepCOVNet shouldn't need to do any file conversion imo

jhaco commented 7 months ago

https://www.tensorflow.org/io/tutorials/audio

Could make an uplift task that includes this new feature and do away with librosa altogether