Mike Edwards <mikel...@gmail.com>: Oct 24 06:54AM +0100
I would be interested to hear if alsa midi in is working on the Linux
version
Olaf Schulz <funwit...@googlemail.com>: Oct 24 05:33PM +0200
Am 24.10.2017 um 07:54 schrieb Mike Edwards:
> I would be interested to hear if alsa midi in is working on the Linux
> version
I've now tested it. First off all I should note, that the port enabler
tool of keykit
works as expected. After enabling the input port, Keykit was listed
listed as midi input decive (aconnect -l)
I've converted the code into a function, which can be called at startup:
# Input args: name - like name in Midi Port Enabler, i.e 'in 1'
function enable_input(name){
if( Machine == "linux" || Machine == "unix" ){
inports = midi("input", "list")
t = "input"
bfound = 0
for( p in inports ){
if( inports[p] == name ){
bfound = 1
if ( midi(t,"isopen",p) ){
print("MIDI "+t+" "+string(p)+" was already open.")
}else{
print("Open MIDI "+t+" "+string(p)+"")
midi(t,"open",p)
}
break;
}
}
if( bfound == 0){
print("Input name not found. Available are:")
print(inports)
}
}else{
print("Function had no effect on "+Machine)
}
}
In Keykit, I call „enable_input("in 1")“, the „enable_output()“ function
of the previous post and then
user@rpi3:~/software/keykit $aconnect 20:0 129:1
user@rpi3:~/software/keykit $aconnect 128:0 129:0
user@rpi3:~/software/keykit $ aconnect -l
client 0: 'System' [type=kernel]
0 'Timer '
1 'Announce '
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'
client 20: 'Portable Grand' [type=kernel]
0 'Portable Grand MIDI 1'
Connecting To: 129:1
client 128: 'FLUID Synth (19704)' [type=user]
0 'Synth input port (19704:0)'
Connected From: 129:0
client 129: 'keykit' [type=user]
0 'keykit '
Connecting To: 128:0 <--- Ok
1 'keykit '
Connected From: 20:0 <--- Ok
As documented on http://nosuch.com/keykit/doc/doc/tutorial.html, Keykit
redirects the input to the output
and store the notes into 'Recorded'
I should be note that print(Recorded) tells us that the recorded notes
contain the absolute time stamp. Replaying
such input needs a shift.
Finally, I want come back to the original question. I've wrote this test
script, which reacts at each keyup (not on keypress?!) of my keyboard.
Hope this helps out to find a solution for the No-NOTEOFF-problem.
(@Tim: Or exists an 'event hander' for the input which can be
replaced/overwritten? This would be a better approach.)
function test_rec()
{
RUN_TEST = 1
# Merge = 0 # Do not propagate midi input to midi output
print("Loop started")
while (RUN_TEST) {
bNewData = 0
for( note in Recorded ){
time_offset = note.time
bNewData = 1
break; # Abort after first note. I just need the earliest.
}
if( bNewData ){
ph = Recorded
Recorded = '' # Clears recording
# TODO: Made a distinction if this should be a NOTEON or NOTEOFF ...
if( 1 ){
# ph.time -= time_offset
ph.time = 0
ph.type = NOTEOFF
print(ph)
realtime(ph, Now)
realtime('do4v120', Now) # Just for debugging...
}
}
sleeptill(Now+1)
}
print("Loop quited")
}
Regards Olaf
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to keykit+unsubscribe@googlegroups.com.