A music improvisation toy - by Tong Zhang MUSIC 256A, Fall 2011-12 Stanford University
Overview Music Planet is designed as a music improvisation toy software for people to explore the magical music world. The motivation here is to let the widest range of people easily experience music improvisation, whether the user is a very young age child who barely knows anything about music theory or a professional musician.
How it works As the name of the software suggests, the main user interface is a freely rotatable 3D spherical planet covered by musical-note-mapped hexagons / pentagons. As a player spins the planet by dragging the mouse upon it, music notes would be triggered by one / multiple probes that are distributed at the surface of the planet. Along with the planet, there are also a set of control panels for adjusting the keys / octaves / beats / probe number / music instruments properties of the music planet (see figure below).
Features descriptions The Planet - dragging the planet would make it spin along the drag direction. The more times you drag, the faster it would spin. Double click within the planet would make it stop. The "Dual Star" - waveform / FFT visualization widget. Keys - to control the set of keys that would be selected to be mapped onto the hexagons / pentagons on the planet. Octaves - to control the set of octaves that would be selected to be mapped onto the hexagons / pentagons on the planet. Beats - to control the beats type and ON/OFF. Beats tempo is proportional to the absolute spinning speed of planet. Probes - to enable / disable probes on the planet; the sliders at the side control the type of music instrument for each probe. One can toggle the "sync instrument" button to force same music instrument for all probes / cancel this constraint. View Panel - (at the bottom right of the interface) to rotate the view angle to the planet; press center button would reset the view angle.
Behind the scene Some details of the software implementation:
- In order to achieve natural dragging effect on the planet at any orientation, the dynamic transformation glMultMatrixf() (instead of glRotatef()) is applied to the planet object on the OpenGL canvas. Each drag motion is detected by tracking the mouse travel from pressing to releasing the mouse button. This travel displacement is converted to a 3D drag-force vector in the global coordinate, and then transformed to a vector in local coordinate space of the planet based on current planet orientation. (Good thing I have mechanical engineering background, so that I feel quite comfortable with those coordinates transformations.) - The tempo of the beats is proportional to the absolute spinning speed of the planet. - When a beat arrives, any enabled probe would read the music note info of the hexagon / pentagon it is currently located and trigger the note. - If there is not any music note info registered at that particular hexagon / pentagon, then a random note would be picked from currently assigned keys / octaves pool. - If the keys / octaves assignment is changed, all note info registration on hexagons / pentagons would be cleared so that new added keys / octaves can be presented as soon as possible. - All note-on periods would be tracked so that the notes would be automatically turned off when it is time. In this version of the software, note-on period for all notes are set to be 1.25 times the tempo period. This gives the notes a little bit after-hearing. - In this version of the software, probe No. 0 is always located at (0, 0, R) in the global coordinates (R is the radius of the planet). The other probes would randomly create its location on planet surface when they are enabled.
Open sources used JUCE (Jules' Utility Class Extensions) - an all-encompassing C++ class library for developing cross-platform software FluidSynth - a real-time software synthesizer based on the SoundFont 2 specifications HexPlanet - a demo of a technique to tile a spherical planet with hex tiles, for example for use in a strategy game. chuck-fft - Ge Wang (firstname.lastname@example.org), Perry R. Cook (email@example.com)