Skip to content

A c++ implementation of some music composition algorithms, allowing fully computer-generated music.

Notifications You must be signed in to change notification settings

RandyParedis/autoplay

Repository files navigation

autoplay

Build Status

autoplay is a simple C++ library of a combination of some music composition algorithms (autoplayer is the executable for it). The target of this project is to create music software that can automatically generate good melodies in a lovely rhythm with a gentle dynamic, using advanced programming techniques.

For more information on how this project works, please take a look at the wiki pages. I'm sure you'll find what you're looking for there.

Functionality

By setting the right values and commandline arguments, you are currently able to generate okay-sounding multi-part scores and get a MusicXML representation of the score.

Triplet-like structures lie outside the scope of this project, wherefore they are not generated.

What's in autoplay?

Because most people like lists, I've listed the possibilities of autoplay below.

  • Customizable!
  • Pseudo-random (with a wide range of possible engines)!
  • A wide range of pitch, rhythm and chord note count generation algorithms!
  • Exports to MusicXML, a format used in many score-writing software!
  • Integratable in other projects!

Execution

To execute autoplay, one simply has to execute the executable autoplayer. This will allow the user to add certain flags and fetch some options. For more info, please execute autoplayer with the flag -h or --help, or take a look at the Configuration wiki.

Installation

The installation of the project is rather simple. Just clone this repository and compile via cmake. That's all there is to it. Oh, don't forget to clone the dependencies (submodules) as well.

Dependencies

RtMidi 3.0.0

This project makes use of the RtMidi library, current version 3.0.0. This library allows for real-time playback of the music. Maybe this dependency will be removed/togglable later on.

To install this dependency, you have to install and update the submodules of this repo. The necessary files will be linked automatically during compilation.

Dependencies

RtMidi itself comes with a few dependencies, as can be found here.

Boost

Boost is definitely a powerful library that can handle a lot of different things. In the scope of this project, Boost is used for easy JSON and XML parsing and generation.

You must have Boost installed on your system for this to work.

Google Test

The Google Testing Framework is a useful tool for writing and testing unit tests. Of course randomization is difficult to test, but a series of algorithms can be tested anyways.

You must have gtest installed.

GTest Installation (Ubuntu 18.04 LTS)
sudo apt-get install libgtest-dev cmake
cd /usr/src/gtest
sudo cmake CMakeLists.txt
sudo make
sudo cp *.a /usr/lib
GTest Installation (Mac OSX)
sudo wget https://github.com/google/googletest/archive/release-1.7.0.tar.gz
sudo tar xf release-1.7.0.tar.gz
cd googletest-release-1.7.0
sudo cmake -DBUILD_SHARED_LIBS=ON .
sudo make
sudo cp -a include/gtest /usr/include
sudo cp -a libgtest_main.so libgtest.so /usr/lib/

TRNG (Tina's Random Number Generator)

Due to the random nature of the results of autoplay, trng was added. This library will handle all random actions that happen during the music generation.

After painstakingly trying to install trng similarly to how RtMidi was installed, the decision was made to keep it as a submodule, but describe how to install the library into the opt folder.

TRNG Installation (Ubuntu 18.04 LTS)

For a detailed description, please read the trng.pdf in the trng/doc folder (page 96).

  1. Install and Update the submodule
  2. Make sure autoconf, automake and libtool are installed. This can be done with sudo apt-get install autotools-dev autoconf libtool-bin.
  3. Run autoreconf on the trng folder to make sure everything works as desired.
  4. Configure trng in the opt directory with your preferred compiler (e.g. GNU C++ 7) using the following command: sudo CXX=g++-7 ./configure --prefix=/opt/trng.
  5. Run sudo make and sudo make install.

If you don't want to use /opt/trng as the folder for trng, you can do so, but must compile cmake of this project with the flag -DTRNG_LOC set to your home directory of trng.

TODO: Add scripts for this, so it will work easily on travis and possibly other OS.

Progress Log

Date Update
07-11-2018 Added RtMidi library for easy playback.
13-10-2018 Started looking at different file formats to export to:
- MIDI (might have issues with the non-generality)
- MusicXML (standard open format for exchanging digital sheet music)
13-10-2018 Added TRNG as a pseudo-random number generator.
14-10-2018 Added Boost and started the concept of the RPG.
14-10-2018 Did some research on different music generation algorithms
14-10-2018 Added Travis CI
14-10-2018 Created the Randomizer class to handle all randomization without the need to keep on using the same code over and over again.
15-10-2018 Added gtest.
20-10-2018 Added tests for Note class.
21-10-2018 Added Clef and Measure class and added tests for the latter.
23-10-2018 Added zupply for logging, progress bars and command line argument parsing.
24-10-2018 Started work on Instrument class, by using a very basic implementation. Currently, only piano instruments are implemented in the music::instruments namespace, but this is enough for the current working version.
Also added a music::instruments::findByName(const std::string&) function to find an instrument by name (precursor to config file support).
27-10-2018 Added Part, Score and MIDIPlayer classes.
27-10-2018 Added Config class.
28-10-2018 Added pipeline that executes autoplayer: It parses arguments, probes output ports, generates the music and plays it.
03-11-2018 Added modularity for Instruments and Styles.
04-11-2018 Added multiple part support.
Also expanded Instrument set to 80 different instruments.
05-11-2018 Added different/custom Clef support.
10-11-2018 Fixed Rhythmic Instrument Support
17-11-2018 Added Brownian Motion as a pitch algorithm.
18-11-2018 Added rest-ratio and length parameters to config file.
18-11-2018 Added 1/f Noise and Centralized as a pitch algorithm.
22-11-2018 Fixed MidiPlayer playback with ties, added bpm and time signature to styles.
22-11-2018 Added Brownian Motion as a rhythm algorithm.
24-11-2018 Added support for chords, BUT MIDIPlayer currently only plays bottom note of each chord and no multiple-note chords are being generated by the algorithms (yet).
25-11-2018 Config file now requires styles.json, instruments.json and clefs.json.
Also added automatic beaming of notes of a type less than a quarter note.
28-11-2018 Fixed MidiPlayer to a better algorithm.
01-12-2018 Added better chord generation support (or rather: made it better).
Also added chord-progression as a style option.
02-12-2018 Added Accompaniment as a pitch algorithm.
02-12-2018 Started work on Markov Chains.
08-12-2018 Made autoplay run from anywhere; e.g. got rid of execution folder requirement.

About

A c++ implementation of some music composition algorithms, allowing fully computer-generated music.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published