dipzza / ultrastar-song2txt

Tools that automate parts of making a song in the ultrastar txt format
GNU Affero General Public License v3.0
1 stars 0 forks source link

Decide which library to use for loading songs #41

Closed dipzza closed 2 years ago

dipzza commented 2 years ago

Loading song files into a usable data structure is needed to work with them.

This is needed for #40 which advances #7 and possibly to estimate some metadata for #8.

dipzza commented 2 years ago

There is many options to read song files.

Python includes a module for reading / writing WAV files wave

And there is many outside options actively maintained:

Ideally the option/s used should support a great variety of file formats, specially MP3 as it's widely used. There is less support for MP3 as the technology was patented, but the patents have expired now and there is some open implementations now.

Also cross-platform compatibility is desired.

soundfile uses libsndfile to support a large number of file formats and it's fast, but only supports MP3 in the latest release which may be available or not depending on the user's system.

pydub needs the user to manually install ffmpeg or libav to support non-wav files, which may be hard to set up depending on the user's system and uses additional space.

audioread supports by default uncompressed audio formats, and can use a great variety of libraries depending on the user's system (ffmpeg, libav, Gstreamer, Core Audio, MAD) which helps cross-platforms compatibility.

librosa is a library for music and audio analysis, which tries to use soundfile by default but falls-back to audioread to achieve the best compatibility. Also provides a lot of functions to work with the audio with a simple interface which are useful for this project (loading audio normalized to numpy array, transforming between hertz, midi and note representation, estimating audio bpm, ...)

The option which best fulfills the projects needs is librosa, and therefore is the one chosen.