{"id":21073319,"url":"https://github.com/valentinvignal/midigenerator","last_synced_at":"2026-03-01T02:32:46.271Z","repository":{"id":39737137,"uuid":"192938427","full_name":"ValentinVignal/midiGenerator","owner":"ValentinVignal","description":"Generate midi file with deep neural network :notes:","archived":false,"fork":false,"pushed_at":"2023-03-25T00:12:05.000Z","size":2845,"stargazers_count":33,"open_issues_count":3,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-04T22:16:15.737Z","etag":null,"topics":["deep-neural-network","keras","midi","music21","pygame","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ValentinVignal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-06-20T14:50:14.000Z","updated_at":"2024-12-24T21:14:21.000Z","dependencies_parsed_at":"2025-05-16T06:41:27.432Z","dependency_job_id":null,"html_url":"https://github.com/ValentinVignal/midiGenerator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ValentinVignal/midiGenerator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinVignal%2FmidiGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinVignal%2FmidiGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinVignal%2FmidiGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinVignal%2FmidiGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ValentinVignal","download_url":"https://codeload.github.com/ValentinVignal/midiGenerator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ValentinVignal%2FmidiGenerator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29959083,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T01:47:18.291Z","status":"online","status_checked_at":"2026-03-01T02:00:07.437Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-neural-network","keras","midi","music21","pygame","tensorflow"],"created_at":"2024-11-19T19:00:46.439Z","updated_at":"2026-03-01T02:32:41.258Z","avatar_url":"https://github.com/ValentinVignal.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Midi Generator\n\n## Introduction\n\nThis project aim to train different neural networks on midi dataset to\ngenerate music\n\n## Context\n\nThis repository contains the code of my Master Thesis for my Master in the School of Computing of the [National University of Singapore](https://www.comp.nus.edu.sg/) ***\"\"Music completion with deep probabilistic models\"***\n\nThe Report, Abstract and Presentation's slides are available [here](https://github.com/ValentinVignal/Dissertation-Report)\n\n## Files\n\n### `bayesian-opt.py`\n\n```\npython bayesian-opt.py\n```\n\nIt is used to find the best hyper parameters to train a model\n\n### `compute_data.py`\n\n```\npython compute_data.py\n```\n\nIt is used to compute the `.mid` files of the dataset and create the\n*numpy* arrays used to train a model.\n\n### `generate.py`\n\n```\npython generate.py\n```\n\nLoads a trained model and generate music from it.\n\n### `train.py`\n\n```\npython train.py\n```\n\nCreates or loads a model, train it, and also generate music at the end.\n\n# How to use it\n\n## Setup\n\nFirst, get a midi dataset and save all the song in a folder `Dataset`\nThe emplacement of this folder has to be at the emplacement `../../../../../storage1/valentin/`. \nTo change it, go in the files `src/GlobalVariables/path.py` and modify it.\nThe midi files have to be in a folder.\nThe name of the folder is the name of the dataset\n\n## Get the information of the dataset\n\nTo get the information of the dataset, run\n\n```\npython debug/check_dataset.py \u003cDATANAME\u003e\n```\n\nMain options:\n- `data` is the name of the dataset name\n- `-h` or `--help` plot the options of the file\n- `--notes-range` the range of the notes. Default is `0:88`\n- `--instruments` the instruments separated by a `,` (ex: `Piano,Trombone`)\n- `--bach` for bach dataset (4 voices of piano)\n- `--mono` to specify to use mono encoding for monophonic music\n- `--no-transpose` don't transpose the songs in C major or A minor\n\nThe file will print the number of available songs and the `notes-range` to specify to not loss any data\n\n## Compute the dataset\n\nTo extract the tensors from a midi dataset and save them\n\n```\npython compute_data.py \u003cDATANAME\u003e\n```\n\nThe main options are:\n- `data` is the name of the dataset\n- `-h` or `--help` will print the options of the file\n- `--notes-range` to specify the range of the notes to consider\n- `--instruments` the instruments separated by a `,` (ex: `Piano,Trombone`)\n- `--bach` for bach dataset (4 voices of piano)\n- `--mono` to specify to use mono encoding for monophonic music\n- `--no-transpose` don't transpose the songs in C major or A minor\n\n## Train and use a model\n\nTo train, evaluation, create songs with a model, run\n\n```\npython train.py\n```\n\nThe main options are:\n- `-h` or `--help` to print the options of the file\n- `-d` or `--data` the name of the dataset\n- `--data-test` the name of the test dataset\n- `-m` or `--model` to specify the model to use (`modelName,nameParam,nbSteps`)\n- `-l` or `--load` to load the id of the model (`name-modelName,nameParam,nbSteps-epochs-id`)\n- `--mono` is used to use a monophonic dataset\n- `--no-transposed` is used to not use a transpose dataset (to C major or A minor)\n- `-e` or `--epochs` number of epochs\n- `--gpu` specifies the GPU to use\n- `-b` or `--batch` the batch size\n- `--lr` specifies the learning rate\n- `--no-rpoe` is used to not used the RPoE layer (Recurrent Product of Experts)\n- `--validation` the proportion of the data tu use as a validation set\n- `--predict-offset` the offset of prediction (use `2` for the band player script)\n- `--evaluate` to evaluate the model on the test dataset\n- `--generate` do the _generate_ task\n- `--generate-fill` do the _fill_ task\n- `--redo-generate` do the _redo_ task\n- `--noise` value of the noise in the inputs of the training data\n- `-n` or `--name` to give a name to the model\n- `--use-binary` use the sigmoid loss for a _note\\_continue_ for monophonic music\n\nTo get the _best results_ from the report, run:\n\n```\npython train.py -d DATANAME --data-test DATATESTNAME -m MRRMVAE,1,8 --use-binary --mono --evaluate --generate --generate-fill --redo-generate\n```\n\n## Band Player\n\nThis file load a trained model and use a it to play with the user in real time\n\n```\npython controller.py\n```\n\nThe main options are:\n- `-h` or `--help` to print the options of the file\n- `--inst` to specify what instrument sound the user wants\n- `--tempo` specify the tempo\n- `-l` or `--load` to load the id of the model (`name-modelName,nameParam,nbSteps-epochs-id`)\n- `--played-voice` the voice played by the user in the band\n- `--inst-mask` list of the mask to choose the voices the user wants to play with\n(to play the first voice and with the second and last voice for a model with 5 voices: `[1,1,0,0,1]`)\n- `--nb-steps-shown` the number of steps showed on the piano roll plot\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalentinvignal%2Fmidigenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalentinvignal%2Fmidigenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalentinvignal%2Fmidigenerator/lists"}