{"id":15696271,"url":"https://github.com/johnlk/ChopinAI","last_synced_at":"2025-03-11T21:31:56.160Z","repository":{"id":91012766,"uuid":"85907222","full_name":"johnlk/ChopinAI","owner":"johnlk","description":"This project solicits the help of the LSTM neural network to generate a unique music file based on previous works by Chopin. ","archived":false,"fork":false,"pushed_at":"2024-12-22T18:24:57.000Z","size":382659,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-26T09:45:01.257Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","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/johnlk.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}},"created_at":"2017-03-23T04:30:58.000Z","updated_at":"2024-12-22T18:25:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"b8fa37dd-ba8f-45d2-ba3d-d57d775f68ee","html_url":"https://github.com/johnlk/ChopinAI","commit_stats":null,"previous_names":["johnlk/chopinai"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlk%2FChopinAI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlk%2FChopinAI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlk%2FChopinAI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnlk%2FChopinAI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnlk","download_url":"https://codeload.github.com/johnlk/ChopinAI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243115766,"owners_count":20238810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-03T19:08:34.487Z","updated_at":"2025-03-11T21:31:56.146Z","avatar_url":"https://github.com/johnlk.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Computer Generated Chopin Music\n\nThis project uses deep learning to generate classical piano music in the style of Chopin through a novel text-based approach. This project converts MIDI files into text representations that can be easily processed by RNNs.\n\nBest output found here: `output/2024-pytorch-rnn/temp-0.8/tmp.mid`\n\n## Project History \u0026 Evolution\n\n### 2017 Version\nThe project originally used Andrej Karpathy's char-rnn implementation for generating music. This version produced interesting results (preserved in `output/2017-karpathy-LSTM/`) but relied on external dependencies and older deep learning frameworks.\n\n### 2024 Update\nAfter 7 years, the project was modernized with a custom PyTorch-based implementation. The new version features:\n- Simplified architecture using PyTorch's built-in LSTM modules\n- More efficient training pipeline\n- Better code organization and documentation\n- Improved generation quality through modern deep learning practices\n\n## Technical Overview\n\n### Architecture\nThe current implementation uses a character-level RNN built with PyTorch, consisting of:\n- Embedding layer for character encoding\n- Multi-layer LSTM network\n- Dropout regularization for preventing overfitting\n- Linear output layer for character prediction\n- Mini-batch training with CUDA GPU support\n\n### Data Processing Pipeline\n1. **MIDI Collection**: Source MIDI files are stored in `data/midi/`\n2. **Text Conversion**: MIDI files are converted to ASCII format using conversion tools in `src/conversion/`\n3. **Data Preprocessing**: ASCII files are stored in `data/ascii/` and processed into training data\n4. **Training**: The PyTorch model is trained on the text representation\n5. **Generation**: New music is sampled from the model at different temperature settings\n\n### Model Parameters\n- Training options:\n  - Hidden layer size: 256 (configurable)\n  - Number of LSTM layers: 2 (configurable)\n  - Dropout rate: 0.2\n  - Batch size: 128\n  - Sequence length: 100\n- Temperature settings tested: 0.4, 0.8, 1.0\n  - Higher temperatures produce more creative but potentially error-prone compositions\n  - Lower temperatures generate more conservative, structured pieces\n\n## Generated Outputs\nThe project maintains both historical and current outputs:\n- `output/2018-karpathy-LSTM/`: Original char-rnn generated pieces\n- `output/2024-pytorch-rnn/`: New PyTorch model generations\n  - `temp-0.4/`: Conservative generation\n  - `temp-0.8/`: Balanced creativity/structure\n  - `temp-1.0/`: Most experimental generation\n\nThe MIDI files can be played using standard music software like GarageBand or this [web player](https://midiplayer.ehubsoft.net/).\n\n## Technical Roadmap\n1. Extended Training: Increase training duration and dataset size\n2. Architecture Tuning:\n   - Experiment with larger hidden layer sizes\n   - Test different dropout rates\n   - Try additional LSTM layers\n3. Data Augmentation: Add more Chopin compositions to training set\n4. Evaluation Metrics: Implement quantitative measures of musical quality\n\n## Implementation Details\nThe core implementation is in `src/model/`, featuring:\n- `train.py`: Model definition and training logic\n- `generate.py`: Text generation utilities\n- Efficient batch processing\n- CUDA optimization for GPU acceleration\n- Configurable sequence length for capturing musical patterns\n- Checkpoint saving/loading for iterative training\n\nFor detailed usage instructions and parameters, see the model documentation in `src/model/README.md`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnlk%2FChopinAI","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnlk%2FChopinAI","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnlk%2FChopinAI/lists"}