Code Monkey home page Code Monkey logo

rapping-neural-network's Introduction

Rapping-neural-network

I made this for my high school's programming club - which I'm the president/founder of.

It's a neural network that has been trained on rap songs, and can use any lyrics you feed it and write a new song (it now writes word by word as opposed to line by line) that rhymes and has a flow (to an extent).

Listen to / read the example at the bottom of this readme - it is the result of feeding the network ~6,000 Kanye West lines.

Write song

Install (with python 2.x)

pip install -U -r requirements.txt 

Fill "lyrics.txt" with rap lyrics of your choosing - the more the better - avoid putting things like "[bridge]" or "[intro]" in there - only put in actual lines from the song - and separate each line by a newline (the newline format is found on most websites that host lyrics, so you should have no trouble copying and pasting. The more songs the better - a few hundred lines should be fine, but you tend to get better results as the number of lines tends towards infinity.

python deeprap.py

deeprap.py will show you some of its processes, and once it terminates, 'neural_rap.txt' will contain the song the neural network has composed. By default, the neural network no longer uses full lines from the lyrics you give it, but now it writes the song word by word with the help of a Markov chain. This means that it actually writes original lyrics.

More info on deeprap.py, training the network on your own lyrics, and how the trained nets are stored

deeprap.py contains a variable on line 15 - "training". You can set training to 0 to have it just write a song from the lyrics you give it (this is the default value, and is probably what most people will use it for) - but if you actually want to train the network on your own set of lyrics change the value of "training" to 1, and it will train a network on the lines in "lyrics.txt". Keep in mind: the trained networks are saved as folders titled the number of epochs the network has been trained for. If you already have folders named "100", "200", etc. in the same directory as deeprap.py when you try to train a network, you should move these somewhere else to avoid confusion. The trained network folders contain 2 files, an xml file of the actual trained neural network, and a text file containing the list of rhymes the neural network was trained with. This is needed because since the neural network just works with numbers (each type of rhyme is interpreted as a float value) - this list is there so the network always interprets the same rhymes as their corresponding float values, regardless of the data you feed it.

Generate sound

python speechtest.py 

beat.mp3 or beat2.mp3 is the beat

Let's hear something it made

Okay... Here's a song it wrote word by word - excuse the vulgarities, the neural network wrote it and not me. http://pastebin.com/raw/5y1x9vHk

And here is the recording of "speechtest.py" using those lyrics, and "beat2.mp3". https://www.youtube.com/watch?v=N8P3i8gBaVI&feature=youtu.be

rapping-neural-network's People

Contributors

robbiebarrat avatar jc1987 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.