How to get midi working?
-
- One Eyed Hopeful
- Posts: 6
- Joined: Thu Sep 03, 2015 4:24 pm
How to get midi working?
I've read that freepie now can be used for midi but I can't grasp how to pull it off. I'd like to be able to use both gamepads and an extra qwerty-keyboard as midicontrollers with my music software (Which is jeskola buzz). If someone could push me towards a pedagogic tutorial I'd be utterly grateful.
Thx
Anders
Thx
Anders
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
Re: How to get midi working?
You can check this thread for some samples
http://www.mtbs3d.com/phpBB/viewtopic.php?f=139&t=20537
edit: aha, we only support reading. Can look into writing too
http://www.mtbs3d.com/phpBB/viewtopic.php?f=139&t=20537
edit: aha, we only support reading. Can look into writing too
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
Re: How to get midi working?
I did a test shot, I havent tested it so cant tell if it works
Somethign like this to send on port 0, channel 0, control mode note off, data = 127
edit: I do not support the these bits, maybe they are needed for the program to work?
Somethign like this to send on port 0, channel 0, control mode note off, data = 127
Code: Select all
midi[0].data.channel = 0
midi[0].data.status = MidiStatus.NoteOff
midi[0].data.dataOne = 127
Code: Select all
11110000= F0= 240 System Exclusive ** **
11110001= F1= 241 MIDI Time Code Qtr. Frame -see spec- -see spec-
11110010= F2= 242 Song Position Pointer LSB MSB
11110011= F3= 243 Song Select (Song #) (0-127) none
11110100= F4= 244 Undefined (Reserved) --- ---
11110101= F5= 245 Undefined (Reserved) --- ---
11110110= F6= 246 Tune request none none
11110111= F7= 247 End of SysEx (EOX) none none
11111000= F8= 248 Timing clock none none
11111001= F9= 249 Undefined (Reserved) --- ---
11111010= FA= 250 Start none none
11111011= FB= 251 Continue none none
11111100= FC= 252 Stop none none
11111101= FD= 253 Undefined (Reserved) --- ---
11111110= FE= 254 Active Sensing none none
11111111= FF= 255 System Reset none none
You do not have the required permissions to view the files attached to this post.
-
- One Eyed Hopeful
- Posts: 6
- Joined: Thu Sep 03, 2015 4:24 pm
Re: How to get midi working?
Sorry for not understanding.
Freepie downladed and installed. Then what?
I can't get my head around how or where to start.
Could someone put me infront of an understandable tutorial?
I've glanced at the forum, the homepage, youtube and even glovepies documentation but not really grasping things...
Freepie downladed and installed. Then what?
I can't get my head around how or where to start.
Could someone put me infront of an understandable tutorial?
I've glanced at the forum, the homepage, youtube and even glovepies documentation but not really grasping things...
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
-
- One Eyed Hopeful
- Posts: 6
- Joined: Thu Sep 03, 2015 4:24 pm
Re: How to get midi working?
Hi. I decided to try for a while with fergo's tool at fergonez.net since it seemed like a soft start but it died on me with runtime error 380 so I decided to learn freepie way now.
Found a glovepie-script that I thought I could use as inspiration/guidance but it won't work. Is it at all compatible?
Found a glovepie-script that I thought I could use as inspiration/guidance but it won't work. Is it at all compatible?
Code: Select all
//DUEL ACTION GAMEPAD TO MIDI
//WRITTEN FOR MIDI CHAN 1 ON JOYSTICK #1
midi.DefaultChannel=1
//BUTTONS
midi.C1=joystick1.Button1
midi.D1=joystick1.Button2
midi.E1=joystick1.Button3
midi.F1=joystick1.Button4
//TOP BUTTONS
midi.G1=joystick1.Button5
midi.A1=joystick1.Button6
midi.B1=joystick1.Button7
midi.C2=joystick1.Button8
//SELECT/START BUTTONS
midi.D2=joystick1.Button9
midi.E2=joystick1.Button10
//STICK BUTTONS
midi.F2=joystick1.Button11
midi.G2=joystick1.Button12
//POV
midi.A2=joystick1.Pov1Up
midi.B2=joystick1.Pov1Down
midi.C3=joystick1.Pov1Left
midi.D3=joystick1.Pov1Right
//midi.E3=joystick1.Pov1Center
//ANALOG STICKS
midi.Control1=(joystick1.x/261)+64
midi.Control2=(joystick1.y/261)+64
midi.Control3=(joystick1.z/261)+64
midi.Control4=(joystick1.roll/261)+64
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
Re: How to get midi working?
FreePIE is based on python and have a completely different syntax.
I can wipe something up as a test for you, and you can work it from there
I can wipe something up as a test for you, and you can work it from there
-
- One Eyed Hopeful
- Posts: 6
- Joined: Thu Sep 03, 2015 4:24 pm
Re: How to get midi working?
ah. guess it's me cheating again, hoping for the best. I remember reading that freepie was a successor to glove pie so I thought they where more compatible.
if you would give me a headstart with something I could work from and even learn something, then I'd be both happy and grateful.
if it's for gamepad or qwertykeyboard is equally good.
if you would give me a headstart with something I could work from and even learn something, then I'd be both happy and grateful.
if it's for gamepad or qwertykeyboard is equally good.
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
Re: How to get midi working?
Code: Select all
midi.C1=joystick1.Button1
Code: Select all
def sendNote(note, strength):
diagnostics.debug("note {0}", note)
midi[0].data.status = MidiStatus.NoteOn
midi[0].data.dataOne = note
midi[0].data.dataTwo = strength
if starting:
midi[0].data.channel = 0
if keyboard.getPressed(Key.A):
sendNote(64, 127)
-
- One Eyed Hopeful
- Posts: 6
- Joined: Thu Sep 03, 2015 4:24 pm
Re: How to get midi working?
Apologies for my late reply and thank you for your efforts. My wife is ill so it'll take a while before I get to look into this but when I do, I'll write back.
-
- One Eyed Hopeful
- Posts: 24
- Joined: Mon Jan 05, 2015 4:33 am
Re: How to get midi working?
If I understand this correctly: Is (basic) midi output already in the current version but untested?
Ah! Overlooked the attached file - will test in some days (have lot's of work to do right now)
Theoretically midi output shouldn't be too different to midi input and easy to implement (yeah - it's easy to say that )
Ah! Overlooked the attached file - will test in some days (have lot's of work to do right now)
Theoretically midi output shouldn't be too different to midi input and easy to implement (yeah - it's easy to say that )
-
- One Eyed Hopeful
- Posts: 24
- Joined: Mon Jan 05, 2015 4:33 am
Re: How to get midi working?
I finally found some time! Writing to MIDI would be an awesome feature - already seeing some stuff I could do with that!
So far I have no luck with your test version above. I figured out that
midi[0].data.buffer[0] and
midi[0].data.buffer[1]
now is called
midi[0].data.dataOne and
midi[0].data.dataTwo
I don't really know what to make out of "MidiStatus.NoteOn" and "MidiStatus.NoteOff". On my device midi[0].data.status is always "Control" if I watch it with diagnostics.watch()
Regardless this is the code I derived from the one posted above to test it with my device:
doesn't have any effect on my device so far
So far I have no luck with your test version above. I figured out that
midi[0].data.buffer[0] and
midi[0].data.buffer[1]
now is called
midi[0].data.dataOne and
midi[0].data.dataTwo
I don't really know what to make out of "MidiStatus.NoteOn" and "MidiStatus.NoteOff". On my device midi[0].data.status is always "Control" if I watch it with diagnostics.watch()
Regardless this is the code I derived from the one posted above to test it with my device:
Code: Select all
def sendNote(bufferzero, bufferone):
diagnostics.debug("bufferzero {0}", bufferzero)
midi[0].data.status = MidiStatus.NoteOn
midi[0].data.dataOne = bufferzero
midi[0].data.dataTwo = bufferone
diagnostics.watch(midi[0].data.dataOne)
diagnostics.watch(midi[0].data.dataTwo)
diagnostics.watch(midi[0].data.channel)
diagnostics.watch(midi[0].data.status)
if starting:
midi[0].data.channel = 0
if keyboard.getPressed(Key.A):
sendNote(20, 127)
if keyboard.getPressed(Key.D):
sendNote(20, 0)
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
Re: How to get midi working?
midi[0] means port zero and you use channel 0 is that correct for your device?
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
Re: How to get midi working?
also, please try this version, did some minor changes, might help
You do not have the required permissions to view the files attached to this post.
-
- One Eyed Hopeful
- Posts: 24
- Joined: Mon Jan 05, 2015 4:33 am
Re: How to get midi working?
Yes. I used a version of the old diagnostics.watch script to look up my stuff:CyberVillain wrote:midi[0] means port zero and you use channel 0 is that correct for your device?
Code: Select all
def update():
diagnostics.watch(midi[0].data.channel)
diagnostics.watch(midi[0].data.status)
diagnostics.watch(midi[0].data.dataOne)
diagnostics.watch(midi[0].data.dataTwo)
if starting:
midi[0].update += update
I ditched the code I tried with the last Output because I didn't understand all of it and wrote my own script (turned out to be somewhat similar but simpler. maybe too simple?).CyberVillain wrote:also, please try this version, did some minor changes, might help
Code: Select all
def WriteToMidi(bufferone):
midi[0].data.channel = 0
midi[0].data.status = MidiStatus.Control
midi[0].data.dataOne = 20
midi[0].data.dataTwo = bufferone
if keyboard.getPressed(Key.A):
WriteToMidi(126)
if keyboard.getPressed(Key.D):
WriteToMidi(1)
Code: Select all
def WriteToMidi(bufferone):
midi[0].data.dataTwo = bufferone
if keyboard.getPressed(Key.A):
WriteToMidi(126)
if keyboard.getPressed(Key.D):
WriteToMidi(1)
Maybe the values are just updated in FreePIE internally but not actually written to the device when assigning a value like midi[0].data.dataTwo = int ?
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
Re: How to get midi working?
I do not own a midi device myself so cant test, i get tones from the built in midi in windows when I use your code.
Here is the API we use, maybe you can get some answers there?
https://midinet.codeplex.com/
Here is the API we use, maybe you can get some answers there?
https://midinet.codeplex.com/
-
- One Eyed Hopeful
- Posts: 11
- Joined: Sun Apr 03, 2016 8:18 am
Re: How to get midi working?
Well, here is my script that worked for me with the custom FreePie version from this thread. The code is changed from one of the samples posted earlier.
Is there a way to receive the names of the midi devices? I'd like to avoid using a static device index in case windows decides to change the order.
Code: Select all
def sendCC(cc, strength):
midi[1].data.status = MidiStatus.Control
midi[1].data.dataOne = cc
midi[1].data.dataTwo = strength
if starting:
footswitchDown = False
if keyboard.getKeyDown(Key.F13) != footswitchDown:
footswitchDown = not footswitchDown
if footswitchDown:
sendCC(36, 127)
else:
sendCC(36, 0)
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
Re: How to get midi working?
Cool and your device receives the data?
I can see if the midi device supports names instead of indexes
edit: Btw, keyboard.getKeyDown(Key.F13) != footswitchDown can be replaced with keyboard.getPressed(Key.F13) (I think )
edit: See if you can access the device with name now (Do not forget to unblock the dll)
I can see if the midi device supports names instead of indexes
edit: Btw, keyboard.getKeyDown(Key.F13) != footswitchDown can be replaced with keyboard.getPressed(Key.F13) (I think )
edit: See if you can access the device with name now (Do not forget to unblock the dll)
Code: Select all
midi["my name"]
You do not have the required permissions to view the files attached to this post.
-
- One Eyed Hopeful
- Posts: 11
- Joined: Sun Apr 03, 2016 8:18 am
Re: How to get midi working?
Great, thank you.
I tried with getPressed, however it only seems to fire when the key is pressed down, but not on release. Therefore i manually implemented it to fire one time on key press and on release.
Yes. I used that code for several hours in 'production' and it worked just fine. All messages i tried to send were correctly received by the midi device.
I am not sure about the midi[0].data.channel = 0 line. It seems to generate a 'zero' note or control message (do not remember which) as well. I am not sure if it is supposed to do that. It wasn't necessary to use that command anyway. With or without that line all messages seems to be received on channel 1 of the midi device.
I will try your updated version with the name feature later today.
I tried with getPressed, however it only seems to fire when the key is pressed down, but not on release. Therefore i manually implemented it to fire one time on key press and on release.
Yes. I used that code for several hours in 'production' and it worked just fine. All messages i tried to send were correctly received by the midi device.
I am not sure about the midi[0].data.channel = 0 line. It seems to generate a 'zero' note or control message (do not remember which) as well. I am not sure if it is supposed to do that. It wasn't necessary to use that command anyway. With or without that line all messages seems to be received on channel 1 of the midi device.
I will try your updated version with the name feature later today.
-
- One Eyed Hopeful
- Posts: 11
- Joined: Sun Apr 03, 2016 8:18 am
Re: How to get midi working?
I have tested your updated DLL. I have no luck yet using the named assignment.
When i run the script with named assignment, in the Console the midi device name appears (some debug output?). If i enter a non existing device name in the brackets, i get an error (translated: sequence has no matching element). So obviously FreePie finds the correct midi device, but assignment isn't working for some reason.
When i run the script with named assignment, in the Console the midi device name appears (some debug output?). If i enter a non existing device name in the brackets, i get an error (translated: sequence has no matching element). So obviously FreePie finds the correct midi device, but assignment isn't working for some reason.
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
Re: How to get midi working?
ok so it finds the correct device but (debug output) but it does not work? hmm will have to check the code and report back
-
- One Eyed Hopeful
- Posts: 11
- Joined: Sun Apr 03, 2016 8:18 am
Re: How to get midi working?
yes. It still works with midi[1] for me. However using the device name, no midi message is received by the device.
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
-
- One Eyed Hopeful
- Posts: 11
- Joined: Sun Apr 03, 2016 8:18 am
Re: How to get midi working?
Yes. It matches and is the same name as in the log.
If i even try to enter a non-existing device name, the script won't run with error "sequence has no matching element" (translated)
If i even try to enter a non-existing device name, the script won't run with error "sequence has no matching element" (translated)
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
Re: How to get midi working?
Couldn't find any obvious errors with the code, added some more debugging. I do not lnow if I should use productid or index integer. Please check the debug output in conosle
You do not have the required permissions to view the files attached to this post.
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
Re: How to get midi working?
Think I found the problem, try this version
You do not have the required permissions to view the files attached to this post.
-
- One Eyed Hopeful
- Posts: 11
- Joined: Sun Apr 03, 2016 8:18 am
Re: How to get midi working?
Tried your newest one and it worked right away. Nice
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
-
- One Eyed Hopeful
- Posts: 11
- Joined: Sun Apr 03, 2016 8:18 am
Re: How to get midi working?
I tried both with index and name. Both worked with no issues. All messages were correctly received by my MIDI device.
Also a deliberately wrong device name was correctly detected in the error log.
Also a deliberately wrong device name was correctly detected in the error log.
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
-
- One Eyed Hopeful
- Posts: 6
- Joined: Thu Sep 03, 2015 4:24 pm
Re: How to get midi working?
Oh. You start a thread and turn your back to it for half a year and suddenly it works?
May I ask, can I use freepie to send midimessages to software? During my absence I've realized that I'd be happy enough if I could generate keypresses with my gamepad and send them through "vmpk -virtual midi piano keyboard". Servicing midi directly would of course be awesome since it would give possibilities for velocity too!
May I ask, can I use freepie to send midimessages to software? During my absence I've realized that I'd be happy enough if I could generate keypresses with my gamepad and send them through "vmpk -virtual midi piano keyboard". Servicing midi directly would of course be awesome since it would give possibilities for velocity too!
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
Re: How to get midi working?
We just send output on a midi channel, I think it should work?
We use this library
https://midinet.codeplex.com/
We use this library
https://midinet.codeplex.com/
-
- One Eyed Hopeful
- Posts: 11
- Joined: Sun Apr 03, 2016 8:18 am
Re: How to get midi working?
I have successfully used midi indexing by name for about 1 1/2 years now However it seems that this feature didn't make it in the newest FreePie release.
-
- One Eyed Hopeful
- Posts: 11
- Joined: Sun Apr 03, 2016 8:18 am
Re: How to get midi working?
It's been another two years. Still running the old version. Is there an update to this feature making it into the main branch?