GithubHelp home page GithubHelp logo

performance-made / generate-music Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kiecodes/generate-music

0.0 0.0 0.0 7 KB

This repository belongs to the youtube video " Can AI make music?" (https://www.youtube.com/watch?v=aOsET8KapQQ) If you haven't seen it, please consider watching the video if you need a better understanding of the code.

License: MIT License

Python 100.00%

generate-music's Introduction

Can AI make music?

Hello. Thank you for being here. This repository belongs to the youtube video Can AI make music?. If you haven't seen it, please consider watching the video, to get a better understanding of this code.

Can AI make music?

Content

The following files are included:

File Description
algorithms/genetic.py The genetic algorithm library. You can find more about it here: https://github.com/kiecodes/genetic-algorithms
mgen.py The actual implementation of the music generation using a genetic algorithm.
requirements.txt Python library requirements to use with pip.

How to use this script

First you need to install the requirements you need to run everything. This repository contains a requirements.txt file.

To install the needed requirements:

$ pip install -r requirements.txt 

To start the script call:

$ python mgen.py

The script will ask you to define couple parameters:

Name Description
Number of bars Length of the generated melody in bars
Notes per bar Number of notes inside of a bar
Number of steps Number of pitches per note
Introduce pauses Should the algorithm introduce pauses betwen notes or do you want a constant stream of notes?
Key Key of the scale the melody should fit in
Scale Type of scale the melody shoud fit in
Scale Root Pitch of the scale (ex.: 4 means C4 is the root note of a scale in C)
Population Size Number of melodies per generation to rate and recombine
Number of mutations Max number of mutations that should be possible per child generated
Mutation probability Probability for a mutation to occur

After you defined all parameters above the genetic algorithm will generate a population of melodies and play each one back to you. After each playback you can rate the melody.

Each generation all melodies are saved in midi format to disk using the following system:

<timestamp>/<generation>/<rating>.mid

Contribution

This melody generation script is far from perfect and any contribution is welcome. Please feel free to fork this repository. Any pull request or comment is welcome!

Have a great day Coders!

generate-music's People

Contributors

thekie 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.