Generates video game music using neural networks. https://youtu.be/UWxfnNXlVy8
hackerpoet / composer Goto Github PK
View Code? Open in Web Editor NEWGenerates video game music using neural networks.
Home Page: https://youtu.be/UWxfnNXlVy8
Generates video game music using neural networks.
Home Page: https://youtu.be/UWxfnNXlVy8
Generates video game music using neural networks. https://youtu.be/UWxfnNXlVy8
What about advanced naming files that you/we export, this include .midi, .wav and,maybe, files in your future projects
Under "advanced" i mean adding number, or date/time in file name, like "song_01.midi", "song_02.midi", or some "song_hh.mm.ss", or even "song-{random_integer}".
One inaccurate "m" press - and old file is lost under new file.
Thanks
I downloaded your program and I really like it. I even shared it with my friends.
I would really like to be able not only to convert the tunes to wav or mp3, but to recreate them for future use.
My idea is to show/change the value of the sliders with a text label. This way, I can write down the values and use them later, or pass them to a friend, so that he can use them/play with them.
Maybe even copy the values as a text array to the clipboard, so that I can easily save them in a text file.
I have windows and can run this just fine, but a friend of mine can't because he has a mac, and he can't use Wine to run it because of the most recent Mac OS update. Any possibility of a mac port/version?
.
Please may the project be released under a libre software license such as GNU-AGPL-3.0-or-later?
At the moment the project is proprietary.
Hi guys,
I am trying to understand the implementation and architecture of the network model.
There is an option to make use of Embedding layers to represent the midi files. I know their use as vector representation of words in a given vocabulary but I don't understand how the midi samples can take the role of words, since we don't want the generator to use the exact same vocabulary as in a language neural network right ? Otherwise, he won't create new note patterns thanks to learned low-level features.
I'm sure there is smth I don't quite get but I can't find what, so that's why I'm asking for your help :).
Thanks.
Hi! I loved your video. It's criminal that it doesn't have more views.
I was wondering where you sourced you midi files? I can understand you not wanting to include them, but could do with a pointer.
I apologize if this is something obvious, but I stumbled across you video and I just wanted to try to train it to see what different results I get. Im fairly new to programming and i only really know scratch, tibasic, and GDscript(Godot game engine) right now.
So the application was working after the fix in Issue #2, however after going back to do a training session, and returing to live_edit, I got this:
Fatal Python error: (pygame parachute) Segmentation Fault
by doing some print-debugging, I found the area this error occurs at to be here:
import pygame
print "Loading Encoder..."
try:
print("Load Model")#The line below is where the error occurs and the program terminated. Around line 180 in the original code.
model = load_model(dir_name + 'model.h5')
print("enc")
enc = K.function([model.get_layer('encoder').input, K.learning_phase()],
[model.layers[-1].output])
enc_model = Model(inputs=model.input, outputs=model.get_layer('pre_encoder').output)
I tried reinstalling Anaconda and all libraries multiple times to try and correct this, however it still occurs, and now there's also another problem with train.py, with the output only showing 'Loading Keras...' then exiting the entire program after a few seconds, without any error statements.
While doing research online about the former issue, I found that pygame can actually be pretty buggy between versions also, so if it helps I used pipreqs to get my current version layout, in case maybe I'm using a too upgrade or downgraded version of any of these:
matplotlib==2.2.2
pygame==1.9.4
pydot==1.2.4
numpy==1.14.3
Keras==2.2.2
mido==1.2.8
Theano==1.0.2
pyaudio==0.2.11
crashes on line below. start, end and sample_ix are 0.0, 11.8, 0.0. On other runs it is a positive number (1.66666), but as an array index, should sample_ix be a float? not sure what is being done.
sample = samples[sample_ix]
In the video there is mention that slider 1 controls the time signature but what do the others do?
I was thinking that if the samples were to be transposed, the training wouldn't be as dependent of the key as it is right now (I've trained on Bach Chorales and all the results I've heard were on the same key even though the originals were in several different keys. Has anyone tested this already? I'll branch if I find any promising results. This will also be a part of my MSc thesis so if some referrencing is needed, I'd be delighted to know from you!
embarrassed to say but this brought tears to my eyes.
there was a song i made on my kalimba and since forgot how to play.
playing around with this not only have the same progression but its much more complex.
playing each note directly to my soul.
heres a thought if ppl are afraid of a single ai taking over the world wat would happen if everyone had there own ai?
saw this on a comment, thought the idea was pretty cool
not sure how this would actually sound, but why not?
--
thanks
So I tried to run load_songs.py and got:
ERROR /Users/dinoz4vrick/music_for_nn/DemonCastlePinnacle.mid
ERROR /Users/dinoz4vrick/music_for_nn/Ff7-Jenova_Absolute.mid
ERROR /Users/dinoz4vrick/music_for_nn/Gestation.mid
ERROR /Users/dinoz4vrick/music_for_nn/CastlevaniaLevel1AS.mid
ERROR /Users/dinoz4vrick/music_for_nn/BKendsolo.mid
ERROR /Users/dinoz4vrick/music_for_nn/ahead_on_our_way_piano.mid
ERROR /Users/dinoz4vrick/music_for_nn/Z8.mid
ERROR /Users/dinoz4vrick/music_for_nn/trailblood.mid
ERROR /Users/dinoz4vrick/music_for_nn/cpt_clawswamp.mid
^^^^^^ WARNING ^^^^^^
/Users/dinoz4vrick/music_for_nn/BanjoTooie.mid
Detected multiple distinct time signatures.
^^^^^^ WARNING ^^^^^^
[]
ERROR /Users/dinoz4vrick/music_for_nn/DOS.mid
ERROR /Users/dinoz4vrick/music_for_nn/FF3_Battle_(Piano).mid
ERROR /Users/dinoz4vrick/music_for_nn/circus_charlie_1_4.mid
ERROR /Users/dinoz4vrick/music_for_nn/Cohens_Masterpiece.mid
ERROR /Users/dinoz4vrick/music_for_nn/Suteki_Da_Ne_(Piano_Version).mid
ERROR /Users/dinoz4vrick/music_for_nn/caitsith.mid
^^^^^^ WARNING ^^^^^^
/Users/dinoz4vrick/music_for_nn/At_Zanarkand_Piano_Collection_(Unofficial).mid
Detected multiple distinct time signatures.
^^^^^^ WARNING ^^^^^^
[]
ERROR /Users/dinoz4vrick/music_for_nn/n64_f0x_sm01_piano.mid
ERROR /Users/dinoz4vrick/music_for_nn/edc.mid
ERROR /Users/dinoz4vrick/music_for_nn/Oppressed.mid
ERROR /Users/dinoz4vrick/music_for_nn/ff4-airship.mid
^^^^^^ WARNING ^^^^^^
/Users/dinoz4vrick/music_for_nn/magustheme-piano.mid
Detected multiple distinct time signatures.
^^^^^^ WARNING ^^^^^^
[]
ERROR /Users/dinoz4vrick/music_for_nn/ff7themep.mid
ERROR /Users/dinoz4vrick/music_for_nn/faxoverworld.mid
ERROR /Users/dinoz4vrick/music_for_nn/FFVII_BATTLE.mid
ERROR /Users/dinoz4vrick/music_for_nn/electric_de_chocobo.mid
ERROR /Users/dinoz4vrick/music_for_nn/dkcddtBADparade.mid
^^^^^^ WARNING ^^^^^^
/Users/dinoz4vrick/music_for_nn/Aion_Tower_Of_Eternity.mid
Detected multiple distinct time signatures.
^^^^^^ WARNING ^^^^^^
[]
ERROR /Users/dinoz4vrick/music_for_nn/dk_title.mid
^^^^^^ WARNING ^^^^^^
/Users/dinoz4vrick/music_for_nn/Ff7-One_Winged.mid
Detected multiple distinct time signatures.
^^^^^^ WARNING ^^^^^^
[]
ERROR /Users/dinoz4vrick/music_for_nn/norKEM.mid
ERROR /Users/dinoz4vrick/music_for_nn/AsaZanarkand.mid
ERROR /Users/dinoz4vrick/music_for_nn/dino_riki_1.mid
ERROR /Users/dinoz4vrick/music_for_nn/N-Gin.mid
ERROR /Users/dinoz4vrick/music_for_nn/dkl-bosssolo.mid
ERROR /Users/dinoz4vrick/music_for_nn/Finalfantasy5gilgameshp.mid
ERROR /Users/dinoz4vrick/music_for_nn/byakuyagensoutanPIANO.mid
ERROR /Users/dinoz4vrick/music_for_nn/CKFF6DBp.mid
ERROR /Users/dinoz4vrick/music_for_nn/DKONG.mid
ERROR /Users/dinoz4vrick/music_for_nn/Cids.mid
ERROR /Users/dinoz4vrick/music_for_nn/lurk_in_dark.mid
ERROR /Users/dinoz4vrick/music_for_nn/Motzhand_Quickie.mid
ERROR /Users/dinoz4vrick/music_for_nn/dkl-constructsolo.mid
ERROR /Users/dinoz4vrick/music_for_nn/dkcddt-wrinkle64SOLO.mid
ERROR /Users/dinoz4vrick/music_for_nn/4_-3_Magic_Hearts.mid
ERROR /Users/dinoz4vrick/music_for_nn/corridor.mid
^^^^^^ WARNING ^^^^^^
/Users/dinoz4vrick/music_for_nn/3-Athene_Sonata.mid
Detected multiple distinct time signatures.
^^^^^^ WARNING ^^^^^^
[]
^^^^^^ WARNING ^^^^^^
/Users/dinoz4vrick/music_for_nn/FFX-Ending_Theme(Piano_Version)_-by_Angel_FF.mid
Detected multiple distinct time signatures.
^^^^^^ WARNING ^^^^^^
[]
^^^^^^ WARNING ^^^^^^
/Users/dinoz4vrick/music_for_nn/ff4pclov.mid
Detected multiple distinct time signatures.
^^^^^^ WARNING ^^^^^^
[]
ERROR /Users/dinoz4vrick/music_for_nn/AT.mid
ERROR /Users/dinoz4vrick/music_for_nn/Final_Fantasy_7-Judgement_Day_Piano.mid
ERROR /Users/dinoz4vrick/music_for_nn/sobf.mid
ERROR /Users/dinoz4vrick/music_for_nn/In_Zanarkand.mid
ERROR /Users/dinoz4vrick/music_for_nn/ff2japantown.mid
ERROR /Users/dinoz4vrick/music_for_nn/waltz_de_choco.mid
ERROR /Users/dinoz4vrick/music_for_nn/z_aeristhemepiano.mid
ERROR /Users/dinoz4vrick/music_for_nn/6-_Orpheus'Journey.mid
ERROR /Users/dinoz4vrick/music_for_nn/BK_FP_Piano.mid
ERROR /Users/dinoz4vrick/music_for_nn/ff4pcpro.mid
ERROR /Users/dinoz4vrick/music_for_nn/dkcddtjanglebesolo.mid
^^^^^^ WARNING ^^^^^^
/Users/dinoz4vrick/music_for_nn/act_raiser-north_wall.mid
Detected multiple distinct time signatures.
^^^^^^ WARNING ^^^^^^
[]
ERROR /Users/dinoz4vrick/music_for_nn/Z23.mid
ERROR /Users/dinoz4vrick/music_for_nn/Final_Fantasy_Matouyas_Cave_Piano.mid
ERROR /Users/dinoz4vrick/music_for_nn/continue.mid
^^^^^^ WARNING ^^^^^^
/Users/dinoz4vrick/music_for_nn/redwings.mid
Detected multiple distinct time signatures.
^^^^^^ WARNING ^^^^^^
[]
ERROR /Users/dinoz4vrick/music_for_nn/2-_A_brave_Warrior.mid
ERROR /Users/dinoz4vrick/music_for_nn/ff4_piano_collections-main_theme.mid
ERROR /Users/dinoz4vrick/music_for_nn/dkl-blimpsolo.mid
ERROR /Users/dinoz4vrick/music_for_nn/BT_Character_Parade_Piano.mid
^^^^^^ WARNING ^^^^^^
/Users/dinoz4vrick/music_for_nn/silentlight-piano.mid
Detected multiple distinct time signatures.
^^^^^^ WARNING ^^^^^^
[]
ERROR /Users/dinoz4vrick/music_for_nn/Rachel_piano.mid
ERROR /Users/dinoz4vrick/music_for_nn/dkcddtwrinklesolo.mid
ERROR /Users/dinoz4vrick/music_for_nn/wings.mid
ERROR /Users/dinoz4vrick/music_for_nn/Here_comes_trouble_piano_V2.mid
ERROR /Users/dinoz4vrick/music_for_nn/Z-Infinity--.mid
ERROR /Users/dinoz4vrick/music_for_nn/dayafter.mid
ERROR /Users/dinoz4vrick/music_for_nn/FF6epitaph_piano.mid
ERROR /Users/dinoz4vrick/music_for_nn/BT_Witchyworld_Piano.mid
ERROR /Users/dinoz4vrick/music_for_nn/B-K_RBBAquatic_Piano.mid
ERROR /Users/dinoz4vrick/music_for_nn/DKCDKQ-bayousolo.mid
ERROR /Users/dinoz4vrick/music_for_nn/Animania.mid
ERROR /Users/dinoz4vrick/music_for_nn/dkl.mid
ERROR /Users/dinoz4vrick/music_for_nn/BT_Spiral_Mountain_Piano.mid
ERROR /Users/dinoz4vrick/music_for_nn/EAGLE.mid
ERROR /Users/dinoz4vrick/music_for_nn/dkcddt-ccalypsolo.mid
ERROR /Users/dinoz4vrick/music_for_nn/FFIII_Edgar_And_Sabin_Piano.mid
ERROR /Users/dinoz4vrick/music_for_nn/ultros.mid
ERROR /Users/dinoz4vrick/music_for_nn/ff1deadp.mid
ERROR /Users/dinoz4vrick/music_for_nn/Z9-2.mid
ERROR /Users/dinoz4vrick/music_for_nn/CVAoS-Heart_of_Fire-piano.mid
ERROR /Users/dinoz4vrick/music_for_nn/GV.mid
ERROR /Users/dinoz4vrick/music_for_nn/BlueStone_LastDungeon.mid
ERROR /Users/dinoz4vrick/music_for_nn/BT_Dragon_Bosses_Piano_100.mid
^^^^^^ WARNING ^^^^^^
/Users/dinoz4vrick/music_for_nn/BanjoKazooie.mid
Detected multiple distinct time signatures.
^^^^^^ WARNING ^^^^^^
[]
ERROR /Users/dinoz4vrick/music_for_nn/BaldursGate-Safe_in_Beregost.mid
ERROR /Users/dinoz4vrick/music_for_nn/secretotforest-piano.mid
ERROR /Users/dinoz4vrick/music_for_nn/cearleonpiano.mid
ERROR /Users/dinoz4vrick/music_for_nn/DKC_Map2.mid
ERROR /Users/dinoz4vrick/music_for_nn/cchitcat.mid
ERROR /Users/dinoz4vrick/music_for_nn/BKigloosolo.mid
ERROR /Users/dinoz4vrick/music_for_nn/athena_lvl_2.mid
^^^^^^ WARNING ^^^^^^
/Users/dinoz4vrick/music_for_nn/Aion_Death_Waltz.mid
Detected multiple distinct time signatures.
^^^^^^ WARNING ^^^^^^
[]
ERROR /Users/dinoz4vrick/music_for_nn/DKCDKQ-lavasolo.mid
ERROR /Users/dinoz4vrick/music_for_nn/mumbofixed.mid
ERROR /Users/dinoz4vrick/music_for_nn/rufus.mid
ERROR /Users/dinoz4vrick/music_for_nn/mkingdom.mid
ERROR /Users/dinoz4vrick/music_for_nn/IsleOHags_Cauldron_Keep_Piano.mid
ERROR /Users/dinoz4vrick/music_for_nn/ff4-fight1.mid
ERROR /Users/dinoz4vrick/music_for_nn/Life_Stream.mid
ERROR /Users/dinoz4vrick/music_for_nn/ebsnowschool.mid
ERROR /Users/dinoz4vrick/music_for_nn/FP.mid
ERROR /Users/dinoz4vrick/music_for_nn/DDRSo_Deep_Piano.mid
ERROR /Users/dinoz4vrick/music_for_nn/columns-clothos-midi.mid
ERROR /Users/dinoz4vrick/music_for_nn/JENOVA.mid
ERROR /Users/dinoz4vrick/music_for_nn/LostPaintingPiano.mid
ERROR /Users/dinoz4vrick/music_for_nn/thenightmarebegins.mid
^^^^^^ WARNING ^^^^^^
/Users/dinoz4vrick/music_for_nn/FF4.mid
Detected multiple distinct time signatures.
^^^^^^ WARNING ^^^^^^
Saving 0 samples...
How do I fix it? I downloaded some sources from https://www.vgmusic.com/music/other/miscellaneous/piano/
I did not edit file, just changed dirs = ["/Users/dinoz4vrick/music_for_nn"]
(my os is macos)
Hello,
i really like the music but its kinda short. Any Idea on how to make the Song longer? Like 2 mins?
Hello! Tried to compile your code. I compiled load_song.py first - no problems. Then I tried train.py and got
Traceback (most recent call last):
File "/Users/dinoz4vrick/PycharmProjects/musicGenerator/train.py", line 118, in
assert(end_ix == num_samples)
NameError: name 'end_ix' is not defined
the notes in the midi files don't seem to have any duration or length, as seen in a midi editor. they do seem to have "starts" or pulses
I've been trying to train a new model, but either midi.midi_to_sample() raises: "Detected multiple distinct time signatures." or try: samples = midi.midi_to_samples(path) raises an exception error.
Is there a special configuration or preparation for the midi files?
There are several errors I got when I trained using the VAE mode. The first training had no problems at all and it ran smoothly. However, after I tried to use live_edit
on the result, it says that global name
VAE_B1 is not defined
, then I tried to continue training and got the same error. I solved this by defining VAE_B1 inside the function. This solved the problem but raised another error. I trained it from scratch, and when I tried to continue the training, what I got is ValueError: Unknown loss function:vae_loss
I don't know how to use this project to compose music, any one can help me ?
Hi, I'm new to neural networks and also to python, but I'm planning to try and do a similar project to this, I'm wondering about the input and the output of this network and have a few questions, how does it take in the files? does it just take in midi files, or does it take them in and then processes them I'm some way to make it easier for the network to read? As for the output how are the files outputted and in what format are they outputted?
Thanks alot for any help that can be given
Would you consider adding a requirements.txt with package versions?
Loading Songs...
Music\Shake It Off.mid
ERROR Music\Shake It Off.mid
Music\ifineeded.mid
ERROR Music\ifineeded.mid
Music\Eight Days a Week.mid
ERROR Music\Eight Days a Week.mid
Saving 0 samples...
Done
I'm using a Mac. I debugged it a bit and I get the exception on the line -> mid = MidiFile(fname) that is in midi.py file. It's strange because when I use the python interpreter with any midi file there's no problem.
First of all, I want to thank you for sharing this code. It's really impressive.
I trained my model using around 60 melodies of pop music and I am able to produce several catchy melodies. There are still some random notes scattered around, but that can be solved with a little polishing and more song samples.
I'm wondering if you could make a pop music generator using the same principle. The song midis can be divided into three parts: verse, pre-chorus, and chorus, and then use another layer of autoencoder.
For the structure, it can selected by the user on the live edit.
I'm looking for a way to generate a composition by using a string of characters as a seed. Any way to implement that?
I don't know if this is normal, but my model building takes more than an hour and takes around 3 hours to get the model.h5. Is it possible to save the training progress and continue it later on?
I could at least spot that the compiled version has the instrument buttons. Also, would you mind releasing the model?
So I was trying to edit one of the midis I had gotten exported from the application, but when I try to edit the midi via online or in apps (caustic, MidiEditor, Onlinesequencer.net), and all have this fairly annoying issue in where the notes either don't show up, barely play at all (very faint, toned clicks), or are uneditable (Onlinesequencer.net and Caustic both have this issue in where I cannot select these notes that the app has exported, meaning I still have to re-write the entire midi based on hearing it along from the app itself.) examples of the issue are in the images
I don't know if this is intentional or if there's a fix, help would be greatly appreciated
Hi! I've been trying to set up the Composer's source for the past few days, and have finally got to a point where I can run the 'train.py' file and 'load_songs.py' file successfully. However, when trying to run 'live_edit.py', I've gotten to 2 points where online resources have been unable to help me. One I've been able to dummy out for now, and the other I can't get past.
Here's the current log of the first error:
Traceback (most recent call last):
File "D:\Projects\Neural Net\Music Project 2018\Composer-master\live_edit.py", line 77, in <module>
piano_sample = np.fromfile('PianoNote.bin', dtype=np.float32)
IOError: [Errno 2] No such file or directory: 'PianoNote.bin'
I assumed this was some kind of piano sample that was missing to play back the midi, so I replaced it with a dummy raw wave for now, and got this error after implementing it:
D:\Projects\Neural Net\Music Project 2018\Composer-master>live_edit.py
D:\python\Anaconda2\lib\site-packages\numpy\core\_methods.py:26: RuntimeWarning: invalid value encountered in reduce
return umr_maximum(a, axis, None, out, keepdims)
D:\Projects\Neural Net\Music Project 2018\Composer-master\live_edit.py:78: RuntimeWarning: invalid value encountered in divide
piano_sample /= np.amax(piano_sample)
Loading Keras...
Theano Version: 1.0.2
Using Theano backend.
Keras Version: 2.2.2
Traceback (most recent call last):
File "D:\Projects\Neural Net\Music Project 2018\Composer-master\live_edit.py", line 182, in <module>
from custom_layers import PartiallyConnected
ImportError: No module named custom_layers
I've tried installing custom_layers with both conda and pip, and both were unable to find it. I've also tried looking online, and any 'custom_layers.py' file I've found either doesn't have the PartiallyConnected part or is uses tensor instead of keras.
Any help would be greatly appreciated!
Hi,
I can't seem to find any link or information about the song dataset you are using for your code.
Could I have access to it?
Thanks
I think this is a great program and I absolutely love it, but I am unable to find the .wav files. It can't write .mid files either, but that may be on my computer. It doesn't give that error when I try to save it in .wav format so I think that it did write the file.
Where are the .wav files saved? I've searched through my downloads, documents, and music but I couldn't find it
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.