This repository contains the final practical work of the "Pensamiento Computacional" subject of the Artificial Intelligence Engineering degree at the University of San Andres. The work is composed of 2 main parts:
- A program that allows, from a music sheet, to synthesize the predefined notes and generate a wave file which contains all these notes ordered and modularized.
- A program that, starting from a music sheet, sends the notes that you want to play to a real instrument. In this case, the instrument is a metallophone.
To be able to use all the functionalities of both programs, it is necessary to carry out an installation. Execute the following steps:
- Clone the repository.
$ git clone https://github.com/LucioLuque/Tp_final.git- Get in the local repository.
$ cd /path/to/Tp_final- Install the dependencies.
$ pip install -r requirements.txtNote: Install it with pip
First of all, you need the midi file of the song you want to generate. Maybe you can find the song you want to use here. To transform the midi file into a music sheet compatible with the program, we have to use the "midi2score" file. Calling it in the following way, we will get the score of the desired song:
$ python3 midi2score.py -i <MIDI File> -o <Output File> -t <Tracks(CSV)>Note: -t is not generally used
When the requested score has already been created, you will be able to create the wave file. To achieve this, it is necessary to perform the following actions:
$ python3 argparse_synthesizer -p <Music sheet> -i <Instrument> -o <Audio.wav> -f <Frecuency>Note: The wave file will be generated in the folder "synthesizer".
First of all, in order to communicate with the metallophone, it is necessary to download the files from the following repository.
Note: Al the information about how to the clone the repository and install all the dependencies is in the README file of the repository.
After downloading all required files, by invoking the "metallophone" file, it will be possible to communicate with the instrument in the following way:
$ python3 metallophone.py -i <Music sheet name> -o <Instrument IP>Note: Put the "metallophone.py" file and the music sheet in the same folder into the folder "xylophone".
The program does not support certain musical notes. "metallophone.py" is able to raise and lower the octaves of the notes so that they are compatible, but it is recommended to use a song that is within the appropriate range. The supported notes are:
| # | Note | # | b |
|---|---|---|---|
| 1 | C7 | C#7 | Cb7 |
| 2 | B6 | - | Bb6 |
| 3 | A6 | A#6 | Ab6 |
| 4 | G6 | G#6 | Gb6 |
| 5 | F6 | F#6 | - |
| 6 | E6 | - | Eb6 |
| 7 | D6 | D#6 | Db6 |
| 8 | C6 | C#6 | - |
| 9 | B5 | - | Bb5 |
| 10 | A5 | A#5 | Ab5 |
| 11 | G5 | - | - |
| 12 | F5 | - | - |
| 13 | E5 | - | Eb5 |
| 14 | D5 | D#5 | Db5 |
| 15 | C5 | C#5 | - |
| 16 | B4 | - | Bb4 |
| 17 | A4 | A#4 | Ab4 |
| 18 | G4 | G#4 | - |