// title: mousetheremin // author: justinwenloyang // description: // Simple mouse theremin for Designing Digital Music and Interaction // code: //PLACE MOUSE CURSOR ON EACH OF THE NUMBERS IN ORDER AND HIT CMD-RETURN ( // 1): // Initialize var currMidiNum, noteNames, octaves, screenRes, yres; ~pitchLo = \a0; ~pitchHi = \c8; //MIDI NOTE DICTIONARY ////Allows you to input a symbol and get out the midi note number ////Use only these symbols: //// \c, \cs, \d, \eb, \e, \f, \fs, \g, \gs, \a, \bb, \b ~mnd = (); currMidiNum = 0; noteNames = [\c, \cs, \d, \eb, \e, \f, \fs, \g, \gs, \a, \bb, \b]; octaves = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; octaves.do{ |it ix| noteNames.do{ |it2 ix2| ~mnd.put((it2 ++ it).asSymbol, currMidiNum); currMidiNum = currMidiNum+1; } }; //FUNCTION TO LOOK UP Y-LOCATION FOR A PITCH screenRes = "system_profiler SPDisplaysDataType | grep Resolution".unixCmdGetStdOut.findRegexp("(?