Generating sound using recurrent neural networks.
For more details, see my blog post: https://www.johnglover.net/blog/generating-sound-with-rnns.html
This code is written in Lua and requires Torch. See the Torch installation documentation for more details.
The following packages are also required (and can be installed using luarocks):
$ luarocks install nngraph
$ luarocks install optim
$ luarocks install nn
Also install the following (see the respective repositories for installation instructions):
Run train.lua
with no parameters to get a list of arguments. The audio file that you pass in should be a single-channel wav file. For example (using the included sine tone):
$ th train.lua -audio audio/sine_440.wav -model_file sine_440.t7 -batch_size 10 -seq_length 10 -rnn_size 100 -num_partials 10 -mdn_components 1 -num_layers 1
To generate audio, run sample.lua
(again no parameters for an argument list). For example:
$ th sample.lua -model sine_440.t7 -length 3000 -output sine_resynth.wav
This code is based on a number of great examples:
- char-rnn by Andrej Karpathy
- Oxford University Machine Learning class practical 6
- learning to execute by Wojciech Zaremba
MIT