extracting one instrument from a midi file

GhostandtheMachine's icon

Hello,

I am hoping to be able to load a midi file into my patch and then do a few things to it:

- Be able to handle just the drums, or guitar on their own without the other notes

- Then be able to step through that one track getting all the note values

My goal is to be able to load in a track, and then have the notes trigger visuals, sprite shapes in a jit window, which will scroll down the screen as the song goes on. I think it will be easy to make the sprites, move them, and create new ones, but I am having trouble getting a whole song file down to a single drum track giving notes that I can use to trigger.

thanks for any help

Jon

Luke Hall's icon

Have a look at [detonate], you can [gate] the output based on the midi channel number or use the "mute 4 1" message. Send the object the "next" mesage or a bang to step through the entire file event by event.

lh

GhostandtheMachine's icon

Thanks as always lh.

I will try that out today. So you are saying the different instruments are separated by being on different midi channels? (Sorry I rarely use actually midi song files like this)

I have one more question but I think I'll explain, briefly, what I am trying to do in the end. Basically I have made a patch to use the Rockband drums as a straight midi instrument. I LOVE IT! For something you can get on ebay for under 100.00 it kicks ass as a wireless v-drum kit. The best part is a got the expansion cymbals and had an extra kick pedal from my rockband 1 kit, so what I have now for the sub 100.00 price is snare, three tom's, high hat, crash, ride, bass drum, and high hat pedal. The cymbals and drum plug in the back via 1/8 headphone jacks and luckily (not sure why they did this other than for a high hat pedal) their is ann extra plug where I hook in the second pedal. I then set up the high hat pedal to trigger a high hat closing sample, then switch between an open and closed sample. I am currently running them into reason with the awesome reason drum refill packs.

I am going to post it on the forums for anyone who want's to play with it as well as a standalone but I have one last midi formatting issue to fix. basically a drum hit look like this

green drum

50 128
47 128
50 0
47 0

Obviously id's with note on off. No problem to handle. But then a cymbal looks something like this

green cymbal

50 128
51 128
32 1200
50 0
51 0

These are NOT the real values, I am making them up since I don't have them in front of me. Basically what can happen though is when I am playing a couple pads at once it will either not let two at once happen or it will false trigger casue the number get compressed something like this

blue drum < - -second hit values

52 128
47 128
52 0
47 0

compressed value example

50 128
51 128
52 128
47 128
32 1200
50 0
51 0
52 0
47 0

The problem is that the corresponding colored drums and cymbals will have the same id with a different appended value. what will happen is when the appended id and an incoming hit's id mash up and coincidentally match another drums id's.

My brother mentioned trying to use a stack and pop method but I can't figure out how to incorporate it. Right now I have tried a series of IF statement objects to try and parse it.

My end goal is to have the patch do two things; be a straight midi instrument so the masses of folks with rockband can mess with it easliy, but more over to create a drum teaching tool ala the game it self. What I am shooting for is using midi files to get the notes to hit and then using ms pinky objects to play back mp3s. Basically what I am thinning is basic stuff like when your accuracy percentage goes below a certain amount the volume decreases or something. But this way any song could be learned and played. I think it will be pretty easy to finish, I just need to cleanly display the drum track in a jit a window. I am thinking I will use a simple jit.gl.sketch to make little note boxes.

Any tips on handling the midi so it won't stack like it is, or any tips on how best to turn my midi file into compelling visuals would be much appreciated.

thanks as always

jon

Tj Shredder's icon

It seems your controller sends Midi Notes (as expected). What you refer to instruments, are different notes (not midi channels as in a normal sequencer generated Midifile).
You need to understand more about Midi in general, the web is full of info.
In your case you want to strip the noteoffs. Just place a stripnote into your Midistream and you'll get going...

Stefan