The aim of this project is to generate music by mimicking the frequency distribution of a tone matrix through an algorithmic method.
-
Create a Virtual Environment
For Linux and macOS:
python3 -m venv venv source venv/bin/activate
For Windows:
python -m venv venv .\venv\Scripts\activate
-
Install Packages from
requirements.txt
pip install -r requirements.txt
Music21 is essential for processing music in symbolic form. In this project, we will create a MIDI file using the Music21 library. The notebook music_generation_tone_matrix.ipynb showcases the use of music21
, and you can find the MIDI output generated by the tone matrix algorithm in notebooks/music_tone_matrix.mid.
Another notebook, construct_music_from_images.ipynb, generates music based on color intensity, taking into account all the pixels in the image. We first convert the image to hsv
color channels and use these channels as a reference to determine the corresponding frequencies. We also utilize pedalboard to process the generated music, enhancing its variety. The output sample from this notebook, after processing, can be found at ./notebooks/processed_song_and_harmony_combined.wav, and the MIDI file we generated is available at ./notebooks/freq_to_midi_processed.mid.
- NumPy Documentation: NumPy Docs
- Pandas Documentation: Pandas Docs
- OpenCV Documentation: OpenCV Docs
- Matplotlib Documentation: Matplotlib Docs
- Music21 Documentation: Music21 Docs
- MIDI Player: MIDI Player on GitHub
- Librosa Documentation: Librosa Docs
- Pedalboard Documentation: Pedalboard on PyPI