// ION iED05 USB Drum Kit MIDI Mapper - Free your USB drums! // Jaywat@hotmail.com // http://www.wibwobweb.com/ied05midi // This is a script to translate the game control signals from the // ION iED05 USB Drum Kit to general midi percussion // I'm sure it could be improved, so feel free! // Specifically, the velocities might be tweakable, but my math sucks! // MIDI setup // device 3 should equal Midi In Port 2 - make sure your application is using the same port or edit it here! midi.DeviceOut = 3 debug = midi.OutDevName midi.GeneralMidi = true midi.DefaultChannel = 10 // MIDI percussion channel // Midi.Channel10.volume = 100% // you might not want to override your software. If you do, uncomment this! var.senseThreshold = -1.00 // range of velocity is -1 to 1 // you can change this to change global sensitivity if you experience any problems due to lack of calibration // you can edit these variables to tweak the velocities of the various drums, // since it's pretty darned hard to calibrate the drum kit as a game controller. // For example, my Snare plays too loud with a gentle tap, so I've offset it by a negative amount var.RedDrumOffset = 0 var.YellowDrumOffset = -3000 var.GreenDrumOffset = 0 var.BlueDrumOffset = 0 var.PurpleDrumOffset = -2000 var.BronzeDrumOffset = -3000 var.WaitTime = 100 ms // waits are important. if you don't add them, GlovePIE polls so fast it sends multiple signals // if you are a far better drummer than me and you're experiencing drops in your drum hits, try lowering this number // BUTTON 1 - RED DRUM (Closed HiHat) // joystick.x controls button 1 velocity // yes, we could refer to it as midi.ClosedHiHat, e.g. midi.ClosedHiHat = Joystick1.Button1, but then you can't specify velocities, // which is why we're referring to the notes that the drums are mapped to and explicitly setting it to the percussion channel if Joystick1.x > var.senseThreshold then var.RedDrum = MapEnsureRange(Smooth(Joystick1.x, 5), -1,1, 5,100) * 10 + var.RedDrumOffset% wait var.WaitTime else var.RedDrum = false endif // BUTTON 2 - YELLOW DRUM (Snare) // joystick.y controls button 2 velocity // equivalent to midi.AcousticSnare if Joystick1.y > var.senseThreshold then var.YellowDrum = MapEnsureRange(Smooth(Joystick1.y, 5), -1, 1, 5,100) * 10 + var.YellowDrumOffset% wait var.WaitTime else var.YellowDrum = false endif // BUTTON 3 - GREEN DRUM - (High Tom) // joystick.slider controls button 3 velocity // equivalent to midi.HighTom if Joystick1.slider > var.senseThreshold then var.GreenDrum = MapEnsureRange(Smooth(Joystick1.slider, 5), -1, 1, 5,100) * 10 + var.GreenDrumOffset% wait var.WaitTime else var.GreenDrum = false endif // BUTTON 4 - BLUE DRUM (High Mid Tom) // joystick.roll controls button 4 velocity // equivalent to midi.HighMidTom if Joystick1.roll > var.senseThreshold then var.BlueDrum = MapEnsureRange(Smooth(Joystick1.roll, 5), -1, 1, 5,100 ) * 10 + var.BlueDrumOffset% wait var.WaitTime else var.BlueDrum = false endif // BUTTON 5 - PURPLE DRUM (Cymbal) // joystick1.yaw controls button 5 velocity // equivalent to midi.CrashCymbal1 if Joystick1.yaw > var.senseThreshold then var.PurpleDrum = MapEnsureRange(Smooth(Joystick1.yaw, 5), -1, 1, 5,100 ) * 10 + var.PurpleDrumOffset% wait var.WaitTime else var.PurpleDrum = false endif // BUTTON 6 - BRONZE DRUM (Low Tom) // joystick1.pitch controls button 6 velocity // equivalent to midi.LowTom if Joystick1.pitch > var.senseThreshold then var.BronzeDrum = MapEnsureRange(Smooth(Joystick1.pitch, 5), -1, 1, 5,100 ) * 10 + var.BronzeDrumOffset% wait var.WaitTime else var.BronzeDrum = false endif // Button 7 is the cymbal (Purple Drum) rim mute button ... // but I can't find a way to mute it. ie, this bit doesn't work. Boo! // But potentially, you could make the rim switch do something else here! if Joystick1.Button7 then var.PurpleDrum = 0 midi.CSharp4 = false endif // BUTTON 9 - RIGHT PEDAL (Bass Drum) // equivalent to midi.BassDrum1 // not really necessary to do this since it doesn't have velocity, // but for the sake of modularity and readability... if Joystick1.button9 then var.RightPedal = 100% wait var.WaitTime else var.RightPedal = false endif // BUTTON 10 - LEFT PEDAL (Open HiHat) // equivalent to midi.OpenHiHat if Joystick1.button10 then var.LeftPedal = 100% wait var.WaitTime else var.LeftPedal = false endif // note, you can’t set those Midi values inside the IF // because IF statements in GlovePIE cause it to send the midi message // again even if it hasn’t changed, whereas outside IF statements it // only sends a MIDI message if it has changed. // Potentially you could remap the notes to change drums/kits, but these should work for most GM Percussion // and you'd be advised to set up a midi drum map of your own to match these notes instead midi.FSharp3Velocity = var.RedDrum% midi.E3Velocity = var.YellowDrum% midi.C4Velocity = var.GreenDrum% midi.A3Velocity = var.BlueDrum% midi.F3Velocity = var.BronzeDrum% midi.CSharp4Velocity = var.PurpleDrum% midi.ASharp3Velocity = var.LeftPedal // we can refer to them explicitly as percussion midi.C3Velocity = var.RightPedal // if we don't care about setting velocity // debug = 'Red: ' + var.reddrum + ', Yellow: ' + var.yellowdrum + ', Green: ' + var.greendrum + ', Blue: ' + var.bluedrum + ', Bronze: ' + var.bronzedrum + ', Purple: ' + var.purpledrum + ', Left Pedal: ' + var.LeftPedal + ', Right Pedal: ' + var.RightPedal // outputtofile('Red: ' + var.reddrum + ', Yellow: ' + var.yellowdrum + ', Green: ' + var.greendrum + ', Blue: ' + var.bluedrum + ', Bronze: ' + var.bronzedrum + ', Purple: ' + var.purpledrum + ', Left Pedal: ' + var.LeftPedal + ', Right Pedal: ' + var.RightPedal)