This code has two main scripts: train_codebook.py, which trains a VQ codebook on a directory of audio files; and sig2hac.py, which converts a single audiofile to its HAC representation.
To train a codebook on directory /path/to/audiofiles/
and store the output in codebook.pkl
:
python train_codebook.py /path/to/audiofiles/ codebook.pkl
Note that the script will recursively search the input directory for files with the .wav
extension.
To convert audiofile myfile.wav
to its hac representation myhac.pkl
using codebook mycodebook.pkl
:
python sig2hac.py mycodebook.pkl myfile.wav myhac.pkl