Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 2.45 KB

File metadata and controls

42 lines (30 loc) · 2.45 KB

Music Generation Using an Algorithmic Approach

The aim of this project is to generate music by mimicking the frequency distribution of a tone matrix through an algorithmic method.

Getting Started

  1. 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
  2. Install Packages from requirements.txt

    pip install -r requirements.txt

Exploring Music Generation with Music21 and Image Processing

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.

References