bob-core allows a user to custom configure midi device mappings, music contexts, scale definitions and sequencer/sequence settings. this is interesting if one is interested in making music with different bpms, non-traditional scales, with external or software midi devices, etc. . .
don't worry there are full xml files at the bottom of this page that you can just download/save and play with. . .
every sequence has a group of tracks, every track has a midi transmitter, every midi transmitter has a receiver and every receiver has a device index that corresponds to a device on your system. you can get these device indexes by running bob with the "-d" command line option. then you can map each track to a device. . .be it internal or external.
here is an example of one transmitter with one receiver using the device at index "1". . .maybe the device is the Java Sound Synthisizer or something. . .
<!-- BobMidiSequence --> <bean id="sequence" class="com.jamesbryangraves.bob.midi.BobMidiSequence"> <constructor-arg><ref bean="musicContext"/></constructor-arg> <property name="tracks"> <list> <!-- BobTrack(s) --> <bean id="melodyTrack" class="com.jamesbryangraves.bob.midi.BobMidiTrack"> <property name="channel" value="0"/> <property name="transmitter"> <ref bean="transmitter"/> </property> </bean> ... <!-- Transmitter (i.e. which device) --> <bean id="transmitter" class="com.jamesbryangraves.bob.midi.BobMidiTransmitter"> <property name="receiver"> <bean id="receiver" class="com.jamesbryangraves.bob.midi.BobGenericReceiver"> <property name="deviceIndex" value="1"/> </bean> </property> </bean>
the music context is the musically interesting information (bpm, key, scale, meter, etc). . .
here is an example a simple example of a context in which bob will generation music in 4/4 in the key of C major at 60 bpm.
resolution is how fine grained you want bob to produce notes. . . if you provide 16 (as below) bob will not produce any note with a value less than a 16th note. . .valid values would be:
1 whole note 2 half note 4 quarter note 8 eight note 16 sixteenth note 32 thrity-second note . . .
unfortunately although phrase size is implemented its not fully functional at this time. . .
<!-- The Default Music Context --> <bean id="musicContext" class="com.jamesbryangraves.bob.music.MusicContext"> <property name="meterNumerator" value="4"/> <property name="meterDenominator" value="4"/> <property name="resolution" value="16"/> <property name="bpm" value="60"/> <property name="key" value="C"/> <property name="scale"> <ref bean="majorScale"/> </property> <property name="phraseSize" value="4"/> </bean>
the composer is the "who" is generating music. there are 3 generators at this time. . .Melody, ChordProgression and Percussion.
Melody is a single note diatonic line.
ChordProgression is a 4 part diatonic voice lead progression.
Percussion is traditional bass, snare and hit-hat with some random stuff here and there.
there is nothing to prevent one from having 4 melody lines to produce counterpoint or 10 percussion generators for a percussion ensamble, etc the only limiting factor is your processor speed.
here is an example of one of each. . .
<!-- Bob's Composing Element --> <bean id="composer" class="com.jamesbryangraves.bob.music.Composer"> <property name="listeners"> <list> <ref bean="sequencer"/> </list> </property> <property name="musicGenerators"> <list> <bean name="melody" class="com.jamesbryangraves.bob.music.Melody"/> <bean name="chords" class="com.jamesbryangraves.bob.music.ChordProgression"/> <bean name="percussion" class="com.jamesbryangraves.bob.music.Percussion"/> </list> </property> <property name="musicContext"> <ref bean="musicContext"/> </property> </bean>
the order here is important. . .it corresponds to the track order specified in the sequence. . .see the sequence and track stuff above.
i really tried to provide as much freedom as possible here. . .why?. . . because people asked for it.
scale size is used to determine beginnings and ends of scales.
a scale state provides how many half steps to the next note going up and to the next note going down.
scale steps is where in the scale size notes occur.
i feel like there is redundant information between scale steps and scale states. . .but i'm still working on the algorithms to fix that sorry.
major scale example. . .
<!-- Scales --> <bean id="majorScale" class="com.jamesbryangraves.bob.music.Scale"> <property name="scaleSize" value="12"/> <property name="scaleStates"> <list> <bean class="com.jamesbryangraves.bob.music.ScaleState"> <property name="up" value="2"/> <property name="down" value="-1"/> </bean> <bean class="com.jamesbryangraves.bob.music.ScaleState"> <property name="up" value="2"/> <property name="down" value="-2"/> </bean> <bean class="com.jamesbryangraves.bob.music.ScaleState"> <property name="up" value="1"/> <property name="down" value="-2"/> </bean> <bean class="com.jamesbryangraves.bob.music.ScaleState"> <property name="up" value="2"/> <property name="down" value="-1"/> </bean> <bean class="com.jamesbryangraves.bob.music.ScaleState"> <property name="up" value="2"/> <property name="down" value="-2"/> </bean> <bean class="com.jamesbryangraves.bob.music.ScaleState"> <property name="up" value="2"/> <property name="down" value="-2"/> </bean> <bean class="com.jamesbryangraves.bob.music.ScaleState"> <property name="up" value="1"/> <property name="down" value="-2"/> </bean> </list> </property> <property name="scaleSteps"> <list> <value>0</value> <value>2</value> <value>4</value> <value>5</value> <value>7</value> <value>9</value> <value>11</value> </list> </property> </bean>
this example uses the bob-macosx extension package. the melody and chord progessions use the same transmitter. . .where as the percussion uses a different one. . .