Let me admit that I don't know diddly about MIDI ... but it looks like POE might work for what you're trying to do ... because it supports both Tk and, from what I can tell, MIDI.
See the following "POE Cookbook" for integrating POE & Tk.
http://poe.perl.org/?POE_Cookbook/Tk_Interfaces
Then perform a CPAN search on "Poe MIDI" -- and it will return a lot of differnet Poe modules that seem to deal with MIDI. http://search.cpan.org
In theory, you should be able to put these together to play MIDI from a Tk Perl script. But as stated below, getting the right Poe modules built as PPMs that you can install under ActiveState may be a challenge. Note that on Randy Kobes' PPM repository, there's a form to request new CPAN distributions be added as PPMs.
Regards,
... Dewey
Spencer_Lists <[EMAIL PROTECTED]>
03/29/2006 02:02 PM
|
|
Greetings D,
Actually, the 1 ms. resolution is not the problem. It is the variability of much greater amounts in the loop timing due to windows processes. I use the program without any other apps running but there is obviously a lot of windows stuff going on. If I move the mouse I can easily tell that the timing is changed. It is pretty clear that I need the multimedia timer but have no ability to write in C and was hoping that a module already existed that I could use. I am using hires time for its sleep function.
Wednesday, March 29, 2006, 6:23:24 AM, you wrote:
> |
Your statements and sample code indicate that you need to execute code based on "real time" / timer events that need to be accurate to 1ms. Executing a loop that uses the sleep function call is an imperfect way to mimic timer events. There is no guarantee that a request to sleep for 1ms will always return in 1ms. If your anti-virus kicks off a full scan or you're re-calculating a 25K row spreadsheet or ..., sleep will likely return sometime beyond the 1ms amount of time you requested. There's information on microsoft.com / MSDN that addresses setting and using multimedia timer events ... in C of course. See the following. http://msdn.microsoft.com/library/default.asp?url=""> Maybe someone on this list knows how to interface AS Perl to the multimedia timer events available in the Windows multimedia SDK. $Bill Leubkert, Chris Wagner, Jan Dubois? One other idea would be to consider using POE -- which has the ability to run timed events and interface to Tk. See: poe.perl.org. The ActiveState PPM repository has old versions of Poe and the associated modules. Current versions of POE for Win32 can be found on Randy Kobes' uwinnipeg PPM repository. But there seems to be issues with building Poe on Win32 so... beware. If you're not already using Randy Kobes' PPM repository, see: http://theoryx5.uwinnipeg.ca/ppms/ Regards, ... Dewey
Greetings perl-win32-users, I have a TK application that sends MIDI messages to various devices. I need to accurately time the occurrence of these events in spite of what windows is doing. It have tried the hires time module as well as the until function and the results are not accurate enough. It has been suggested that the only way to have accurate event timing in windows is to use the multimedia timer. Is there a perl module that accesses this timer or any other way to do so? I just need to repeat the same sequence of events in a loop so I need something that functions like until or sleep. Will a loop running in perl still be subject to timing variations caused by other windows processes even using the multimedia timer? If so, is there any way around this? The actual loop has a lot more going on to update graphics etc. but this is basically what I need to do: sub repeat_note{ my $note = shift; while(1){ $midi_obj->play_note($note,0.0,60,(1),0) || print $midi_obj->error() . "\n" and $midi_obj->reset_error(); sleep ($notedur/1000); $midi_obj->note_off($note,0.0,60,(1),1) || print $midi_obj->error() . "\n" and $midi_obj->reset_error(); $notearray[$note] = 0; sleep($offdur/1000); } } -- Best regards, Spencer_Lists Chase mailto:[EMAIL PROTECTED] 67550 Bell Springs Rd. Garberville, CA 95542 Postal service only. Laytonville, CA 95454 UPS only. [EMAIL PROTECTED] http://www.spencerserolls.com http://www.spencerserolls.com/MidiValve.htm (707) 984-8356 _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs |
--
Best regards,
Spencer_Lists Chase mailto:[EMAIL PROTECTED]
67550 Bell Springs Rd.
Garberville, CA 95542 Postal service only.
Laytonville, CA 95454 UPS only.
[EMAIL PROTECTED]
http://www.spencerserolls.com
http://www.spencerserolls.com/MidiValve.htm
(707) 984-8356
_______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs