Inspiration

Composers follow two steps when creating compositions. Firstly, they craft the melody, and secondly, they incorporate background music to enhance the melody. The AI composer contributes to the efficiency of melody creation. As a composer myself, I often lack inspiration to start a composition.

What it does

The AI Composer helps me by making the initial melody for me; I can then build upon and make the melody sound better. This not only kickstarts and streamlines the compositional process but also allows human composers to infuse the composition with emotion and ensure its overall quality.

How we built it

The research methodology revolves around the extraction of intricate musical patterns from existing compositions. The existing compositions are found in a dataset of 118 songs featuring Tchaikovsky, Bartok and other classical composers and are stored in Musical Instrument Digital Interface (MIDI) file format. Due to the files being MIDI which is designed to be a middleman between sound files and code, python is easily able to extract the notes from the songs easily with the help of packages(mido- for reading MIDI files- and MIDIUtil- to create MIDI files; read more in implementation). The algorithm reads the notes off the MIDI files and creates a large list of all the notes that were used to write the pieces. The next step would be to find the probability of different notes occur and create a melody; however, the complexity of different key signatures (* = explain key signatures to non-musician) would be added. 2 solutions to this problem are finding the most probable intervals, or transposing() all of the songs to a particular key signature. I chose finding the intervals to avoid the complexity of modulation() in the songs and more importantly, due to the ability to influence the probability based on the context of the notes. For example, say the most probable interval to go from a note is whole step - so if the original note is C, the next note would be D. If the note preceding C was G, then the next probable note would not be a whole step but a major third outlining the C major chord* - so the next note from C would be E. So the next step in the algorithm is to turn the list of all the notes to the list of all the intervals and the intervals preceding those intervals(For context). This is easily done - by just subtracting a note by the notes preceding it. Then the list of intervals is then created into a numpy array of a list of probabilities. The probabilities are then used to create the melody. The melody is then turned into a MIDI file using MIDIUtil. *Below is a sample code to create a MIDI file with random notes. The user inputs length and tempo and the code outputs a melody with random notes. '''python from midiutil import MIDIFile import os import random numberOfBars = input("give desired number of bars ") tempo = input("give desired tempo ") # In BPM numberOfBars = int(numberOfBars) tempo = int(tempo) maxBeatsInBar = numberOfBars*16; quarterNote = 4 track = 0 channel = 0 volume = 100 # 0-127, as per the MIDI standard time=0 MyMIDI = MIDIFile(1)
MyMIDI.addTempo(track, time/4, tempo) while maxBeatsInBar>=time: randomNote = random.randint(36, 108) MyMIDI.addNote(track, channel, randomNote, time/4, quarterNote/4, volume) time=time+quarterNote #print(randomNote) with open("random_melody.mid" , "wb") as output_file: MyMIDI.writeFile(output_file) '''

Accomplishments that we're proud of

Here is a sample melody by the composer. link And here is the real end result with the my human composition based on the AI melody link

What's next for AI Music Composer Model

Evaluating the fit and performance of the model. It takes 182 files to generate 1 AI melody in 5-15 seconds. I will scale the model to analyze more than 1000 files with the help of a GPU. This will add more composers' influence to the AI, which will add variety to the patterns the AI uses to compose. Expand the amount of genres the AI composes in. Currently the composer is in classical style, I will expand to Jazz, Pop, and Indie. The combination of music and AI is a powerful tool for teaching, accessibility and well being. I would like to deep dive into AI driven personalized video game music to elevate the experience of immersive video gaming using AI NPCs and personalized music motifs

Conclusion

  • The successful integration of artificial intelligence into efficiency of music composition. 4* speed while creating composition
  • The system's capability to autonomously generate original compositions can spark innovative composers and musical pathways.
  • It contributes to ongoing ethical dialogues concerning AI's involvement in creative processes, enhancing the ever-evolving landscape of music creation in the digital era.
  • The AI music composer signifies the collaboration between programming and musical creativity, thus confirming the viability and influence of AI-driven methodologies in artistic expression.

Built With

Share this project:

Updates