본문으로 바로가기

midilib for Tcl/Tk

category 확장 패키지 (Extension Package) 2024. 8. 13. 15:30

홈페이지 : http://home.t-online.de/home/Steffen.Traeger/midi/index.htm

 

Midilib is a loadable module for Tcl/Tk 8.x on the MS Windows platform. With this addition, Tcl/Tk is capable of receiving and sending MIDI sysex messages from and to external MIDI devices. There is already an existing MIDI library for Tcl/Tk, called tclmidi , but it doesn't support low level access to MIDI devices. Midilib mainly based on the RPMidi.dll by Bruce James <bjames@voyager.co.nz> written to support midi devices for his RPEdit, a nice Patch Editor for Guitar Multi-effects Processors. Thanks for doing this great job. I only less modified the code to make it suitable for other applications. The package consists of C++ code included in a Visual C++ 6.0 project. This means that at present the library only supports Win32 platforms, line Windows 95/98/ME/NT/2000. But I'm looking forward to extend it for Linux. BTW, MIDI sysex implemenation in Linux is very simple. Write all sysex messages as binary data to /dev/midiXX! The source code should also be useful to someone wishing to extend Tcl with C language routines.

# Here are small examples to show the easily use of the commands.

# get a list of MIDI Output devices 
set mididevs(out) {}
foreach device [midi::getoutdevs] {
    lappend mididevs(out) $device
    puts $device
}
 
# get a list of MIDI Input devices 
set mididevs(in) {}
foreach device [midi::getindevs] {
    lappend mididevs(in) $device
    puts $device
}
 
# get the number of MIDI Output devices 
set num [llength [midi::getoutdevs]]
 
# handle MIDI Output device 
set rc [catch {set id [midi::getoutid]} msg]
if {$rc} {
    set f [midi::openout $id]
} else {
    puts "Fatal error: $msg."
}
fconfigure $f -translation binary
puts -nonewline $f "xf0x41x10x00x02x12xf7"
flush $f
close $f

 
# playing a note number (middle C - 60) for just a second on the default MIDI device 
set f [midi::openout 0]
midi::sendshort 144 60 112
after 1000
midi::sendshort 144 60 0
close $f

midisrc.zip

Visual C++ 6.0 source project files and examples

midisrc.zip
0.08MB

midilib.zip

compiled midilib package for Win32

midilib.zip
0.06MB

'확장 패키지 (Extension Package)' 카테고리의 다른 글

trycatch 2.0  (0) 2024.08.13
tclpython 3.1  (0) 2024.08.13
ODIE 1.3  (0) 2024.08.13
mysqltcl 2.40  (0) 2024.08.13
tkpiechart 6.5  (0) 2024.08.13