GRUV-master

所属分类:其他
开发工具:Python
文件大小:3012KB
下载次数:3
上传日期:2019-06-13 18:55:27
上 传 者一片真心
说明:  GRUV是一个使用递归神经网络进行算法音乐生成的Python项目,我们可以在这个过程中学习到相关的方法。
(GRUV is a Python project which uses recurrent neural network to generate algorithmic music. We can learn the relevant methods in this process.)

文件列表:
config (0, 2016-01-21)
config\__init__.py (0, 2016-01-21)
config\nn_config.py (596, 2016-01-21)
convert_directory.py (796, 2016-01-21)
data_utils (0, 2016-01-21)
data_utils\__init__.py (0, 2016-01-21)
data_utils\parse_files.py (6624, 2016-01-21)
datasets (0, 2016-01-21)
datasets\YourMusicLibrary (0, 2016-01-21)
datasets\YourMusicLibrary\Test.mp3 (3129574, 2016-01-21)
gen_utils (0, 2016-01-21)
gen_utils\__init__.py (0, 2016-01-21)
gen_utils\seed_generator.py (525, 2016-01-21)
gen_utils\sequence_generator.py (1055, 2016-01-21)
generate.py (2919, 2016-01-21)
nn_utils (0, 2016-01-21)
nn_utils\__init__.py (0, 2016-01-21)
nn_utils\network_utils.py (1470, 2016-01-21)
train.py (2092, 2016-01-21)

# GRUV GRUV is a Python project for algorithmic music generation using recurrent neural networks. Note: This code works with Keras v. 0.1.0, later versions of Keras may not work. For a demonstration of our project on raw audio waveforms (as opposed to the standard MIDI), see here: https://www.youtube.com/watch?v=0VTI1BBLydE Copyright (C) 2015 Matt Vitelli matthew.vitelli@gmail.com and Aran Nayebi aran.nayebi@gmail.com # Dependencies In order to use GRUV, you will first need to install the following dependencies: Theano: http://deeplearning.net/software/theano/#download Keras: https://github.com/fchollet/keras.git NumPy: http://www.numpy.org/ SciPy: http://www.scipy.org/ LAME (for MP3 source files): http://lame.sourceforge.net/ SoX (for FLAC source files): http://sox.sourceforge.net/ Once that's taken care of, you can try training a model of your own as follows: # Step 1. Prepare the data Copy your music into ./datasets/YourMusicLibrary/ and type the following command into Terminal: > python convert_directory.py This will convert all mp3s in ./datasets/YourMusicLibrary/ into WAVs and convert the WAVs into a useful representation for the deep learning algorithms. # Step 2. Train your model At this point, you should have four files named YourMusicLibraryNP_x.npy, YourMusicLibraryNP_y.npy, YourMusicLibraryNP_var.npy, and YourMusicLibraryNP_mean.npy. YourMusicLibraryNP_x contains the input sequences for training YourMusicLibraryNP_y contains the output sequences for training YourMusicLibraryNP_mean contains the mean for each feature computed from the training set YourMusicLibraryNP_var contains the variance for each feature computed from the training set You can train your very first model by typing the following command into Terminal: > python train.py Training will take a while depending on the length and number of songs used If you get an error of the following form: Error allocating X bytes of device memory (out of memory). Driver report Y bytes free and Z bytes total you must adjust the parameters in train.py - specifically, decrease the batch_size to something smaller. If you still have out of memory errors, you can also decrease the hidden_dims parameter in train.py and generate.py, although this will have a significant impact on the quality of the generated music. # Step 3. Generation After you've finished training your model, it's time to generate some music! Type the following command into Terminal: > python generate.py After some amount of time, you should have a file called generated_song.wav Future work: Improve generation algorithms. Our current generation scheme uses the training / testing data as a seed sequence, which tends to produce verbatum copies of the original songs. One might imagine that we could improve these results by taking linear combinations of the hidden states for different songs and projecting the combinations back into the frequency space and using those as seed sequences. You can find the core components of the generation algorithms in gen_utils/seed_generator.py and gen_utils/sequence_generator.py

近期下载者

相关文件


收藏者