Melody Generator

From CCRMA Wiki
Revision as of 10:47, 8 December 2010 by Ravik (Talk | contribs)

Jump to: navigation, search

Melody Generator


  • To *aid* musicians in creating melodies
  • To modify melodies out of existing ideas


  • Personal interest in softwares that 'use' 'intelligence'


  • It's a challenge of placing notes in time
  • The code almost exclusively is about designating time values to different pitches as the melody proceeds
  • Take several attributes from the user input.
  • Ideas considered for this project to create the output: Scale and 'speed' of the input
  • The user interacts initially by giving an input and the engine immediately takes over the control, computes and plays the output.

Design Considerations

  • The program uses the RtAudio and RtMidi libraries for computing realtime audio and accepting real time input from the user.
  • The Karplus Strong synth model is the 'voice' of the project.
  • The number of notes that the user would like to give as the input can be set within the program. (This is kinda clumsy, so I am ACTUALLY working on trying to gauge the input in a different way)
  • A heavy amount of information is used from the input:
    • For example, if the user enters an input starting in C4, the output is in C Major. The system currently looks for the C Major, D Minor and G Major scales.
    • Another piece of information that's used from the input is the timing. If the average deltatime between different notes of the input is within a certain threshold, the song is considered 'fast-paced' otherwise, the overall contour of the song is in terms of its speed is mild.
    • For inputs with less average deltatime, the AABA model is used to generate the melody
  • Software Design/Architecture
    • The system basically consists of the Karplus Strong synth class, a timer section, a scales section and a melody generation section.
    • The Karplus Strong synth class is mostly derived from HW2 of this course, save a FEW changes.
    • The timer section is implemented within the RtAudio Callback fucntion (functon audio_callback)
    • The scales and melody are implemented in separate header files for clear delineation of functionality and modularity.
    • Scales header file is called 'Scales.h' and Melody header file is called 'Melody.h'.


  • A good measure of testing is how *tasteful* the output sounds. This is a matter of preference, taste and a little bit of intuition into the next possible note.


  • I worked on the project by myself (Ravi Kondapalli, ravik at ccrma)


  • Get an OOP version of Karplus Strong working
  • Implement the timer logic
  • Implement a pitch logic into the timer
  • Design a way so that RtAudio waits until RtMidi is done with the user input
  • Build the scales and check the user input
  • Build the melody
  • Graphics? 2D Contour?