Xylobot

Communication

  • Packet Format:
    • Char 0: '[' START OF PACKET
    • Char 1: '#' where # = instruemnt ID (currently 2) eg('2')
    • Char 2: '#' where # = notes to play this beat (currently max of 5) eg('3')
    • Char [3,x): 'A' where A = note to play, scaling A-Q to 0-16, where 0-9 are white keys and 10-16 are black
    • Char x: ']' END OF PACKET
  • New intermediate representation (could adapt for use in other instruments)
    • plaintext file, whitespace insensitive.
    • all numbers are positive integers unless otherwise indicated.
    • headers are tuples enclosed by square brackets:
      • [<resolution>, <range>, <tracks>]
      • <resolution> denotes the number of milliseconds (or whatever time interval is most convenient) spent on each tick.
      • <range> denotes the number of different pitches that the instrument can play.
      • <tracks> is the number of simultaneous notes that the instrument can play.
    • notes are tuples enclosed by parentheses:
      • (<pitch>, <sustain>, <progress>)
      • <pitch> is a number between 1 and <range>, inclusive, that denotes the pitch of the note. A number not within the range (0 or otherwise) indicates silence.
      • <sustain> is the number of ticks to maintain the note.
      • <progress> is the number of ticks after which to play the following note.
    • curly brackets enclose {comments}.
    • There is no restriction on the order of headers, notes or comments, provided that the file STARTS with a header.
    • A dash (-) indicates that the previous value for the current slot should be used. For example:
      • "(4, 16, 0) (8, -, -)" plays two notes, 4 half-steps apart, simultaneously with the same duration.
    • The number of tracks should be taken as a guide to how many notes should be processed at one time. Due to the time-sensitive nature of music, if every note in a group has progess = 0, then the interpreter should simply keep reading until progress > 0 and play the next upcoming note group.
    • instruments that do not have sustain, like the Xylobot, can safely ignore the second item in a note tuple.
    • notes can also indicate non-standard actions, like the opening and the closing of a high-hat.
  • Boards:
    • Arduino Board:
      • listens for packets on serial, waiting until it gets a full packet to parse '[' through ']'
      • converts the note decimal to binary, and outputs it on pins 8-12.
      • played for 30 milliseconds total
      • this binary enters the mux board
      • if a chord is played, the output switches between the notes every 50 microseconds
      • timing controlled by timing of serial inputs
      • 1 is indicated by LOW, 0 is indictated by HIGH (reverse logic)
      • Enable Bit (pin 7) must be set low for the mux to transmit
      • when no note is being played, enable bit is set high and note is switched to note 0 (C4)
      • Bin4 is special (not in the mux board) so it is regular logic. LOW=off HIGH=on
    • Mux/inverter Board:
      • takes 5 binary pins from arduino, as well as enable pin
      • outputs a high on none or any one of 16 outputs
      • 17th outputs is directly from
      • takes 5V DC and ground from arduino
      • HIGH HIGH HIGH HIGH LOW -> 0 (C4)
      • LOW HIGH HIGH HIGH LOW -> 1 (D4)
      • ...
      • HIGH HIGH HIGH HIGH HIGH -> 16 (D#5)
    • MOSFET Board:
      • takes in 17 digital ins, corrosponding to the 0-16 on the mux.
      • if any of those digital ins is HIGH, the corresponding solenoid will go up
      • Also has a ground and +12V pin for the solenoids
      • the ground must be connected to the ground on the mux board!