#+AUTHOR: Maarten Versteegh
- HAC Sample code ** Usage This code has two main scripts: [[https://github.com/mwv/hac/blob/master/src/train_codebook.py][train_codebook.py]], which trains a VQ codebook on a directory of audio files; and [[https://github.com/mwv/hac/blob/master/src/sig2hac.py][sig2hac.py]], which converts a single audiofile to its HAC representation.
*** Training a codebook
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.
*** Converting audio files
To convert audiofile myfile.wav to its hac representation myhac.pkl using codebook mycodebook.pkl:
: python sig2hac.py mycodebook.pkl myfile.wav myhac.pkl
** Requirements
- [[http://www.python.org][python 2.7.x]]
- [[http://www.numpy.org/][numpy]]
- [[http://www.scipy.org/][scipy]]
- [[http://cournape.github.io/audiolab/][scikits.audiolab]]
- [[http://www.ar.media.kyoto-u.ac.jp/members/david/softwares/samplerate/][scikits.samplerate]]
- [[http://www.scikit-learn.org/][sklearn]]
- [[http://www.github.com/mwv/spectral][spectral]]