AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MIDI input library
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
stutter



Joined: 13 Feb 2008
Posts: 11

PostPosted: Thu Aug 07, 2008 10:01 pm    Post subject: Reply with quote

ribbet - correct - does that. Can also be made specific to a note velocity if you wish.
Back to top
View user's profile Send private message
ribbet.1



Joined: 20 Feb 2007
Posts: 36
Location: D.C.

PostPosted: Fri Aug 08, 2008 3:10 pm    Post subject: Reply with quote

stutter wrote:
ribbet - correct - does that. Can also be made specific to a note velocity if you wish.


This brings a whole new usefulness to those cheap MIDI piano keyboards maybe. Cheers! (I can't get around to this little project right now, but soon)
Back to top
View user's profile Send private message
robcheese



Joined: 07 Jul 2008
Posts: 8

PostPosted: Tue Aug 12, 2008 4:30 am    Post subject: Combining MIDI output Reply with quote

Hi

Has anyone tried combining this script with some sort of MIDI output. I've tried useing this with the library from http://www.autohotkey.com/forum/viewtopic.php?t=18711&postdays=0&postorder=asc&start=0
but when ever I use MIDI input to trigger MIDI output I get an error.

Any suggestions?

Thanks
Back to top
View user's profile Send private message
stutter



Joined: 13 Feb 2008
Posts: 11

PostPosted: Tue Aug 12, 2008 10:58 am    Post subject: Reply with quote

Midiox or Bomes Midi Translator - seems like you're trying to recreate applications which already exist (not that there'sanything wrong with that ... just wanted to make sure you are aware of them since they have been developed for some time, and Bomes continues to improve)
Back to top
View user's profile Send private message
ribbet.1



Joined: 20 Feb 2007
Posts: 36
Location: D.C.

PostPosted: Tue Aug 12, 2008 1:51 pm    Post subject: Reply with quote

stutter wrote:
Midiox or Bomes Midi Translator - seems like you're trying to recreate applications which already exist (not that there'sanything wrong with that ... just wanted to make sure you are aware of them since they have been developed for some time, and Bomes continues to improve)


Sweet! I've spent a lot of time looking for something like this Bomes. Funny that I never saw it before. Thanks for those links.
Back to top
View user's profile Send private message
stutter



Joined: 13 Feb 2008
Posts: 11

PostPosted: Tue Aug 12, 2008 3:30 pm    Post subject: Reply with quote

s'ok.

MidiOx is entirely free, and the best midi monitor that I know of on a pc. Very useful tool to have. It can also translate midi messages.

Bomes has a special place in my heart. The Beta versions (at least of Pro nd Author) I believe now have multiple midi Ins and Outs, plus sending Win Messages (like Post Message), and mouse movements. It has a Mac beta too, so the only multi-platform midi translator I know of.
I know one guy that uses it to develop some very clever tools has created an editor for it in autohotkey (for his own use). It can be a little awkward sometimes, but search or ask on the forum and help is often forthcoming.
Back to top
View user's profile Send private message
robcheese



Joined: 07 Jul 2008
Posts: 8

PostPosted: Wed Aug 13, 2008 2:03 am    Post subject: Reply with quote

Thanks for the advise.

I'm already useing MIDI ox to convert key strokes to MIDI but it's kind of annoying because I have to activate the MIDI OX window every time I wand to send a keystroke and I have to load a new profile every time I want to change MIDI Mapping.

I haven't used Bomes Midi Translator though so I'll check that out and so if its better for what I'm doing.

does anyone know why the following code doesn't work.
Code:

hModule := OpenMidiAPI()
mm6 := midiOutOpen(1)

OnExit, sub_exit
if (midi_in_Open(Cool)
ExitApp

listenCC(64, "SustainIn", 2)

return

sub_exit:
midi_in_Close()
midiOutClose(mm6)
FreeMidiAPI(hModule)
ExitApp

a::
midiOutShortMsg(mm6, "CC", 2, 64, 127)
return

SustainIn(CCNum, Vel)
{
midiOutShortMsg(mm6, "CC", 2, 64, 127)
}

#Include midi_out_lib.ahk
#Include midi_in_lib.ahk


I got the MIDI out library from http://www.autohotkey.com/forum/viewtopic.php?t=18711&postdays=0&postorder=asc&start=0

When I trigger the output with "a" it works fine but when I trigger it with my sustain pedal I get message box that says "there was error sending the MIDI event".
Back to top
View user's profile Send private message
automaticman



Joined: 27 Oct 2006
Posts: 372

PostPosted: Fri Aug 15, 2008 10:44 am    Post subject: Re: MIDI input library Reply with quote

orbik wrote:
All relevant files: http://ihme.org/~orbik/midi4ahk/
Thanks for sharing your work, unfortunately offering a zip/rar package to download would simplify the download process a lot (as we all know). But we also know compared to your done work the "download work" is nothing.

Back to the topic's content: To my understanding using your MIDI input library only makes "real sense" if you use the ahk capabilities as a channel in between your midi keyboard/controller input and your midi event target/synthesizer.
    midi events from midi keyboard/controller -> ahk actions based on midi events -> results of these ahk actions (optionally you can send the midi input parallelly also to another midi target, like a synthesizer, e.g. with the help of MIDI-OX, if you want to hear what you are playing)

? What kind of ahk actions could we have. See e.g. the actions supported by nDroid, which brings up the idea of why not to connect nDroid actions also to midi event inputs?
Back to top
View user's profile Send private message
ribbet.1



Joined: 20 Feb 2007
Posts: 36
Location: D.C.

PostPosted: Fri Aug 15, 2008 11:43 am    Post subject: Reply with quote

Hey Orbik, I've finally downloaded the test files etc. and the main test file midi_in_lib_test is working as it should. It looks pretty simple to convert this to send text on different note input. I think I'll attempt this this morning. I was going to try Bome but I'd rather just use AHK if possible. Smile

One minor note, it appears that you cannot exit the script until you deselect your midi input device, or at least I cannot, and I'm using the midi input from my M-Audio 24-96 card. When I right-click on the icon however and select 'no input' then I can exit.

So are you a mountain bike enthusiast? I used to attend 24 hour races in the US, just as a spectator. Crazy stuff! Link: http://grannygear.com/index.shtml
Back to top
View user's profile Send private message
ribbet.1



Joined: 20 Feb 2007
Posts: 36
Location: D.C.

PostPosted: Fri Aug 15, 2008 12:24 pm    Post subject: Reply with quote

OK, just to inform anybody else out there as inexperienced as myself.

I set up a midi controller keyboard, connected to my computer's midi in, and loaded a VST host with a midi monitoring program; in my case Asseca's asmidimon, so I could see what the note range was and what the pitch bend and mod wheels sent. One nice thing about Asseca's vst is you can save it's output as a text file. I'm sure you can do that with lots of programs. Now I'm seeing that the file you were kind enough to provide, orbik, the worms midi key test.ahk, is working, and can be modified easily enough to use my old Evolution MIDI keyboard for something other than music. Anybody need more detail, just ask. I'll present the script shortly, not that it's anything you couldn't do. And for other novices like myself, you do have to select your midi input device, by right-clicking on the ahk icon on your systray.

As for using the pitchbend and mod wheel, I'll have to try that on another day. Be back in a little while.

Cheers, ribbet
Back to top
View user's profile Send private message
automaticman



Joined: 27 Oct 2006
Posts: 372

PostPosted: Fri Aug 15, 2008 12:57 pm    Post subject: Reply with quote

ribbet.1 wrote:
... loaded a VST host with a midi monitoring program; in my case Asseca's asmidimon ...
Did you ever use MIDI-OX for midi monitoring and more? If not, you should try it.
Back to top
View user's profile Send private message
ribbet.1



Joined: 20 Feb 2007
Posts: 36
Location: D.C.

PostPosted: Fri Aug 15, 2008 5:15 pm    Post subject: Reply with quote

OK, I may not go further today, I actually have some paying work to do. But here are a couple things. First, here is a template I've been playing with. My Evolution MK-149 has keys mapped 36-84, and so this is basically a template for a midi controller with those keys. It's incomplete but works as is for me, I might do more to it later. My hotkeys are mapped to the white keys only in this instance.

Code:

SendMode Input
SetWorkingDir %A_ScriptDir%

OnExit, sub_exit
if (midi_in_Open(0))
   ExitApp

;--------------------  Midi "hotkey" mappings  -----------------------
listenNote(55, "space")

listenNote(36, "note36")
listenNote(37, "note37")
listenNote(38, "note38")
listenNote(39, "note39")
listenNote(40, "note40")
listenNote(41, "note41")
listenNote(42, "note42")
listenNote(43, "note43")
listenNote(44, "note44")
listenNote(45, "note45")
listenNote(46, "note46")
listenNote(47, "note47")
listenNote(48, "note48")
listenNote(49, "note49")
listenNote(50, "note50")
listenNote(51, "note51")
listenNote(52, "note52")
listenNote(53, "note53")
listenNote(54, "note54")
listenNote(55, "note55")
listenNote(56, "note56")
listenNote(57, "note57")
listenNote(58, "note58")
listenNote(59, "note59")
listenNote(60, "note60")
listenNote(61, "note61")
listenNote(62, "note62")
listenNote(63, "note63")
listenNote(64, "note64")
listenNote(65, "note65")
listenNote(66, "note66")
listenNote(67, "note67")
listenNote(68, "note68")
listenNote(69, "note69")
listenNote(70, "note70")
listenNote(71, "note71")
listenNote(72, "note72")
listenNote(73, "note73")
listenNote(74, "note74")
listenNote(75, "note75")
listenNote(76, "note76")
listenNote(77, "note77")
listenNote(78, "note78")
listenNote(79, "note79")
listenNote(80, "note80")
listenNote(81, "note81")
listenNote(82, "note82")
listenNote(83, "note83")
listenNote(84, "note84")

return
;----------------------End of auto execute section--------------------

sub_exit:
   midi_in_Close()
ExitApp

;-------------------------Miscellaneous hotkeys-----------------------
Esc::ExitApp

;-------------------------Midi "hotkey" functions---------------------
space(note, vel)
{
   if (vel)
   Send {Space down}
   else
   Send {Space up}
}

note36(note, vel)
{
   if (vel)
   Send {Enter}{Tab 2}THE WITNESS:*.{Space 2}
   ;else
   ;Send {}
}

note38(note, vel)
{
if (vel)
Send {Enter}{Tab 2}THE COURT:*.{Space 2}
}


note40(note, vel)
{
   if (vel)
   Send {Enter}{Tab 2}ATTY A:*.{Space 2}
}


note41(note, vel)
{
   if (vel)
   Send {Enter}{Tab 2}ATTY B:*.{Space 2}
}


note43(note, vel)
{
   if (vel)
   Send {Enter}{Tab 2}ATTY C:*.{Space 2}
}

note45(note, vel)
{
   if (vel)
   Send {Enter}{Tab 2}ATTY D:*.{Space 2}
}

note47(note, vel)
{
   if (vel)
   Send {Enter} {Tab 2}BY ATTY A:*. 
}

note48(note, vel)
{
   if (vel)
   Send {Enter}{Tab 2}BY ATTY B:*.
}

note50(note, vel)
{
   if (vel)
   Send {Enter} {Tab 2}BY ATTY C:*.
}

note52(note, vel)
{
   if (vel)
   Send {Enter} {Tab 2}BY ATTY D:*.
}

note53(note, vel)
{
   if (vel)
   Send {Enter} {Tab 2} Q:*. 
}

note55(note, vel)
{
   if (vel)
   Send {Enter} {Tab 2} A:*.
}

note57(note, vel)
{
   if (vel)
   Send .  {Enter} {Tab 2}Q:*.
}

note59(note, vel)
{
   if (vel)
   Send ?  {Enter} {Tab 2}Q:*.
}


;-------------------------  Midi input library  ----------------------
#include midi_in_lib.ahk


And here is a little script with a couple shortcuts for editing the above script:

Code:

#^a:: ;;midi scriptlet send, creates the text send part

Send {Enter}
Sendraw note(note, vel)
Send {Enter}
Sendraw {
Send {Enter}{Tab}
Sendraw    if (vel)
Send {Enter}
Sendraw    Send
Send {Enter}{Backspace}
;Sendraw    else
;Send {Enter}
;Sendraw    Send {Space up}
;Send {Enter}{Backspace}
Sendraw }
Send {Enter}
Send {Up 6}
Send {Right 5}
Return

#^f::  ;;creates the part in the listennote, prompting for the midi note number
InputBox, Noteno, Enter Midi Note Number,, 120, 160
if ErrorLevel
    MsgBox, CANCEL was pressed.
else
   Sleep, 40
    Send listenNote(%Noteno%, `"note%Noteno%") {Enter}
Return



Many thanks to orbik and stutter and everybody else. I think those cheap roll-up midi keyboards may be especially useful for this.
Back to top
View user's profile Send private message
automaticman



Joined: 27 Oct 2006
Posts: 372

PostPosted: Tue Aug 19, 2008 12:03 pm    Post subject: Reply with quote

How easy or difficult would it be with this midi input library to accomplish something like this:

Code:
if (no midi events on a given midi port for longer than 1s)
{
    press some hotkey
}

For checking "midi events" from above for my purposes, midi-cc, note, pitchbend events would be enough already.
Back to top
View user's profile Send private message
stutter



Joined: 13 Feb 2008
Posts: 11

PostPosted: Tue Aug 19, 2008 12:55 pm    Post subject: Reply with quote

Is there any way to increase the response speed / lower latency of this?
I have a script which translates a knob turn into mouse movements, but it is a little sluggish. Any suggestions, or is this a limitation of this method?
Back to top
View user's profile Send private message
fridemar



Joined: 16 Aug 2006
Posts: 16

PostPosted: Tue Sep 02, 2008 12:00 am    Post subject: Combining it with MidiOutput helps (not only) the Blind Reply with quote

Slightly modified quote Smile

Quote:

Many thanks to orbik, stutter, ribbet.1, robcheese and everybody else. I think those cheap roll-up midi keyboards may be especially useful for this.


Apropos "listen":

Together with the standard synthesizer (Windows) and a cheap (touch-sensitive) Midi-KB, I guess, we are on the way to make a better PC-KB input device with sound-feedback (i.e. a touch- and timesensitive chord-input device)

This allows much more efficient and comfortable input than all those million standard PC-Keyboards. (Not only for the blind community).

However it is really necessary to extend the used DLL and its autohotkey wrapper to MidiOutput to make it a universally helpful device.

MayAllBeHappy

Fridemar
PS.:
Imagine how much more time and pleasure musiceans get for additional training their motoric skills, while simply doing their writing stuff on a piano-kb instead of on a PC-Keyboard. Smile
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group