galacticglum / composer

A deep learning enabled music generator module built in Python and using TensorFlow.
GNU General Public License v3.0
28 stars 6 forks source link

I try to generate MusicRNN and Transformer demo #12

Closed mikmeng closed 4 years ago

mikmeng commented 4 years ago

Hi GalacticGlum,

I think your project is very great job, thank you for sharing your source code.

There are generated demos in Google Drive. Those musics have not regular, pls you have a look, is there any problem? Could you share your musics which have been generated by this project?

Yesterday I consult from educational institution, I want to become a composer, haha. They told me I need to spend $2400 for one year, 48 classes. I can learn music theory, chord, computer software for composer, etc... I think if I have a enough time, I will !

Best regards Mike Meng

galacticglum commented 4 years ago

Thanks 🙂

Well first thing first, this is not a fully featured music generator, so don't expect to be able to make production-ready music with composer; however, your outputs sound like your model has not been trained enough, or perhaps you don't have enough training data. You could try reducing the hyperparameters to make the model smaller (run composer make-config my_custom_config.yml and modify it to your liking), which should help the model retain information though at the cost of complexity and length.

As for my results, I have published an album of curated samples (note: songs 1, 2, 3, and 13 were arranged by a human composer, with the melody only generated by the AI).

mikmeng commented 4 years ago

Hi Buddy,

Thank you for your reply. Your album sounds good! Your project is very great.

Those trained data were downloaded by download_piano_ecomp.py script, when I have trained Epoch 9, it was quit, is it correct? I don't know what have happend. There are not any errors or tips.

The default configuration file for Composer.

dataset: time_step_increment: 10 max_time_steps: 100 velocity_bins: 32

Each sample will be stretched in time uniformly by up to +/- 10%.

time_stretch_range:
    start: 0.90
    stop: 1.10
# Each sample will be pitch shifted down all intervals from -4 to 4 (major third).
pitch_shift_range:
    start: -4
    stop: 4
# Indicates whether silence from the start of the MIDI files should be trimmed away.
trim_start: true

Configuration for MusicRNN model.

music_rnn: model: window_size: 200 embedding_size: 256 lstm_layers_count: 3 lstm_layer_sizes: 512 lstm_dropout_probability: 0.3 use_batch_normalization: true train: batch_size: 64 learning_rate: 0.001

Configuration for Transformer-Decoder model.

transformer: model: window_size: 1024 embedding_size: 256 decoder_layers_count: 8 attention_head_count: 16 use_relative_attention: false attention_dropout_rate: 0.1 residual_dropout_rate: 0.1 layer_normalization_epsilon: 0.00001 scale_attention: true initializer_mean: 0 initializer_stddev: 0.02 use_layer_normalization: true train: batch_size: 1 learning_rate: 0.001

Sorry, I don't know how to reduce the hyperparameters, I don't know why my generated midi songs are so short. Yes, I know, it only can generate fragment.

I think if I try to collect some types of music as training data, the generated midi songs are simliar with them, right?

galacticglum commented 4 years ago

Just play around with some of the hyperparameters and then observe the results (it's really experimental). Most of them are pretty standard so you can just search them up and you'll find some information about what they do, or just refer to the codebase. Here's a brief summary of some of the more tricky ones:

I trained on multiple datasets, including one that I manually collected by scraping piano videos and automatically transcribing them. I believe my dataset was close to 5k hours of piano music.

The Yamaha e-comp dataset is good, but the default hyperparameters are for a fairly large model and so I think the model is underfitting on the dataset.

mikmeng commented 4 years ago

Can I put some of songs in your album into short video in "抖音" app (that is a short video platform in China like TikTok) ? It means I make a short video to introduce your project, I think there are many Chinese guies to focus your project, include AI senior developer, business man, etc...

galacticglum commented 4 years ago

Yea, go nuts. Fine by me. I'd just appreciate a link back to this GitHub :)