Coder Social home page Coder Social logo

georgedavila / ai_generated_music_world_anthems Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 32.64 MB

Using Recurrent Neural Networks to generate novel music. Use national anthems as training data aiming for a sort of AI-generated World Anthem.

License: MIT License

ai_generated_music_world_anthems's Introduction

AI_Generated_Music_World_Anthems

Using AI to generate novel music. Use national anthem instrumentals as training data aiming for a sort of AI-generated 'World Anthem'. At least one the robots will like. Mainly based on music generating AI I worked on previously.

Training Data --- Downloaded national anthems from sites listed below. Anthems are public domain, so good to use as training data. Use two main audio file types: MP3 and MIDI. Include zipped and unzipped versions for MIDI folder.

Clearly longer algorithms will have more impact on output. Could splice them to equal-length samples for a more equal distributions. We just use the full anthems here.

Methods

Import some data and audio management libraries. Use Machine Learning methods decribed below.

LSTM Recurrent Neural Networks

Pretty standard. Reading material:


The image above shows the structure of LSTM RNN's (replacing emails with music). Use LSTM's because they help weight each anthem more equally. Other algorithms will weight the last parts of the training data more heavily (which can have its uses). E.g. if we play Canada's anthem last on some non-LSTM NN's, we might notice notice that is sounds 50% like Canada's rather than a properly protioned 1/196-th.

MP3 format

MP3s are higher-fidelity but bit harder to work with for our purposes. MP3s of course are just direct recordings, so they capture the subtleties of the music much better. However, this added complexity makes it harder to train AI on them.

MP3 Anthems sourced from http://anthemworld.com required manual download so only picked a few, mainly larger population, nations. More training data the better, please feel free to let me know if you have all of them in mp3 format, will credit accordingly.

Included EU and AU anthems in this set to give a bit more representation.

MIDI format

MIDIs play the notes of songs using an electric piano type sound. Plays just major notes, whereas in real music/sound there are obviously plenty of subtle frequency transitions. But their relative simplicity makes it a bit easier for our AI to work with them, expect a more intelligible output for this reason.

MIDI Anthems sourced from http://www.midiworld.com/search/5/?q=national%20anthems Which has 136 anthems listed, so about 60 nations are still missing from this set. Easier to download from here but still had to do it manually, so please let me know if I missed anything. Careful if you use it yourself, some of the last ones are unofficial renditions and anthems.

Visual Representation of MIDI files

MIDI files can be assigned a visual representation of a sequence of lines as shown in the image below. If we so chose we could take the midi files as pure images, use tensorflow image recognition techniques to analyze the images and generate new images (with a choice to fill in or erase boxes containing irregularities such as curves) which would be our new music. Don't do that here but its something to explore. Perhaps irregularities such as 'curves' generated mightbe regarded as the transition sound frequencies that we would hear in actual music.


Tensorial Representation of MIDI files

Could alternatively assign notes at each time step a binary value so that each time step is represented by a vector of note on/off modesThis would give us a tensor of 0's and 1's for each musical piece and a greater tensor of all these pieces to train our data on. Would then get tensor outputs based on patterns our ML model parsed out.

I would imagine some audio software do treat MIDIs as tensors in this manner or a similar manner. But not too familiar obtaining such tensors from the files.

Misc

There are philharmonic albums of their renditions of the anthems and things like that. I don't use those here because 1) costs money 2) may not classify as public domain same way regular anthems do and 3) the AI may pick some of the style of the philharmonic, not capturing as much uniqueness of each anthem and making the AI a bit less robust.

Could put in state/municipality anthem instrumentals if we want more data.

Lyrics

Used instrumentals here but could also include lyrics using framework like TensorFlow Seq2Seq:

Probably best to train lyric and instrumentals separately so as to avoid any odd amalgamtion of sound and words. Especially true of MIDIs since, as we mentioned, they only capture major notes whereas voices have actual transitions in frequencies so might sound wierd and choppy.

Although if you want a better better integration of lyrics and instruments, i.e. 'flow', training them together might be better.

Notes on training lyrics:

  • Put them in same language.
  • Easier and more stable to just work on them as text rather than sound. Then you can sing it if you want.
  • A lot of overlap in Anthem lyrics, e.g. country this country that, so you can probably get a very nice Anthem-sounding text generator.
  • Could put in state/municipality anthem text for more training data if you don't get enough from national anthems to make a good quality anthem text generator.

Don't do lyrics yet here.

ai_generated_music_world_anthems's People

Contributors

georgedavila avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.