Jim's
Tutorials

Fall 2016
course
navigation

Oct 27

I tried messing around with different ways to move data around with the python-OSC/SocketServer architecture. Alongside the original /note message address to listen for, I added three more addresses:
This runs the motif_detection function, which searches for repeated patterns in the most recent portion of notes stored.
This runs the queue_next_motif function, which randomly picks one of the motifs stored to play next by putting all of the notes in the note_queue.
This runs the generate_motif function, which randomly generates and stores a new motif for the program to utilize. The function is called a few times when the program is first run in order to give it some material to work with before I begin singing. Currently, every motif it generates is completely random, but I hope to amend it and use some of music21's builtin key analysis tools to generate motifs that are related to previous motifs.
All three of these messages should be called regularly. I first tried including calls to the functions inside other functions. For example, for every five notes the store_new_note function receives, the motif_detection function would be called; this code is currently commented out in store_new_note. But when I did this, the structure looked like spaghetti code and became more difficult to understand. I think it could still be possible to structure the control flow this way if I stick to the limited number of functions I'm calling, but I'd rather find something better that won't restrict me in the long run. For now, I have added the three messages to the voice_input Max patch, each of which is called at its own regular interval. This complicates the system's Max (input) -> Python (analysis) -> Max structure (output) structure, but in general I think having calls come from outside the improv_agent program could make it run more cleanly.
I've been having trouble figuring out how to delay sending each note from Python over OSC. From what I understand, I can't use time.sleep because that will cause the entire program to stop.
I'm working with my test_input Python test file because I haven't made much progress on quantizing the notes, but I hope to have the system completely working (in some simple form) in the next few days and can then try working with the much more irregular data from actual singing.
Three of the permutation functions I wrote have to do with going in and out of tune. I was originally planning on rewriting my protocol to use frequency instead of MIDI note value in order to be able to do microtonal work, but I'm scrapping that for now for the sake of getting a version of the project completed. I'm keeping the functions in the code to work on later.
http://cs.marlboro.edu/ courses/ fall2016/jims_tutorials/ tbedford/ Oct_27
last modified Thursday October 27 2016 2:20 pm EDT