Yahoo Groups archive

Emu XL-7 & MP-7 User's Group

Index last updated: 2026-04-03 22:28 UTC

Thread

hi new guy here: MIDI Clock question ATTN: Steve and Aaron :P

hi new guy here: MIDI Clock question ATTN: Steve and Aaron :P

2007-01-18 by malik

Hi
i'm writting a program that takes MIDI input with delphi, that uses
MIDICOM3.
I'm not sure if or how i can get MIDI Clock working in it. I cant seem
to figure out if it supports realtime message.
I'm thinking. that if while monitoring midi input. if i see clock
messages in the  monitor than it either supports it or detects it.

if it can detect it, i should be able to emulate a midi clock message
in order to sync my software to my external drum machine/controller.

I dont have enough money to get the book from the MMA at the moment
and was wondering if anyone is familiar with this library or the
specific part of MIDI that i'm talking about, and would be willing to
give me some info. links, tips or anything.

anything but spam :)

thanks Malik

Re: hi new guy here: MIDI Clock question ATTN: Steve and Aaron :P

2007-01-19 by steve_the_composer

(1) I am not familiar with delphi or MIDICOM3, so I can't help you 
there. Pre-Windows, I used to read midi data direct from I/O ports 
on midi cards. Windows changed all that around so that you need tons 
of overhead to program midi data directly. My hat goes off to you if 
you can master midi programming in today's computing environment.

(2) I am not sure you need to buy any MMA publications; there are a 
number of resources on-line.

(3) I searched for MIDICOM3 and one site reports it was designed for 
Windows 95. I saw your discussion at KVRAudio (Dec '06) and it looks 
like you've got a couple of people that are familiar with MIDICOM3.

(4) Your code reminds me of where I was with midi programming--I 
stuck my asm routines (reading midi I/O) in Borland Pascal. (Wasn't 
Delphi Borland's answer to Microsoft's "Visual XXX" programming?) 
Though I have't looked at the libraries in MIDICOM3, my guess is 
that there are clock structures of some type [pardon the pun]. I 
assume there are midi streaming functions as well. I am not sure 
that you have done so far, but I suggest (if you haven't done so 
already):

(a) Build a program that send out data at regular intervals--such as 
a midi metronome.

(b) Once succesful, convert the program to send out midi timing 
bytes (Is it F8?) on a regular basis.

(c) Program some keys to insert start and stop bytes into your 
midistream. Test by setting your drum machine to external clock.

(d) Once that's working, reverse the process to READ incoming clock 
data FROM the drum machine. To start I'd display status: START/STOP. 
Then I'd develop a routine to count clock bytes to display current 
tempo.

(e) I would thing that once you've done these things, you will have 
developed the basic code you need to integrate clock functions into 
your own software.

Hope this helps.

--Steve

PS: Here are a couple of basic reference links:

http://www.hinton-instruments.co.uk/reference/midi/protocol/index.htm

http://www.borg.com/~jglatt/tech/midispec.htm








> Hi
> i'm writting a program that takes MIDI input with delphi, that uses
> MIDICOM3.
> I'm not sure if or how i can get MIDI Clock working in it. I cant 
seem
> to figure out if it supports realtime message.
> I'm thinking. that if while monitoring midi input. if i see clock
> messages in the  monitor than it either supports it or detects it.
> 
> if it can detect it, i should be able to emulate a midi clock 
message
> in order to sync my software to my external drum 
machine/controller.
> 
> I dont have enough money to get the book from the MMA at the moment
> and was wondering if anyone is familiar with this library or the
> specific part of MIDI that i'm talking about, and would be willing 
to
Show quoted textHide quoted text
> give me some info. links, tips or anything.
> 
> anything but spam :)
> 
> thanks Malik
>

Re: hi new guy here: MIDI Clock question ATTN: Steve and Aaron :P

2007-01-19 by steve_the_composer

I took a quick peek at the MIDIIN.PAS file where I found the 
following note:

"Midi Time Code (MTC) and Active Sensing: The DLL is currently 
hardcoded to filter these short events out, so that we don't spend 
all our time processing them."

Without delving further, my guess is that MIDICON3 will not give you 
access to the F8, FA, FB, F9 bytes you need.

Other options include--finding other libraries, though I wonder if 
there are others in Pascal. I do recall seeing a number of libraries 
avaialble in C/C++ a few years ago; writing your own midi event 
handlers so timing bytes aren't filtered out; getting into other 
programming venues. 

Good luck.

--Steve







--- In xl7@yahoogroups.com, "malik" <malik_martin@...> wrote:
>
> Hi
> i'm writting a program that takes MIDI input with delphi, that uses
> MIDICOM3.
> I'm not sure if or how i can get MIDI Clock working in it. I cant 
seem
> to figure out if it supports realtime message.
> I'm thinking. that if while monitoring midi input. if i see clock
> messages in the  monitor than it either supports it or detects it.
> 
> if it can detect it, i should be able to emulate a midi clock 
message
> in order to sync my software to my external drum 
machine/controller.
> 
> I dont have enough money to get the book from the MMA at the moment
> and was wondering if anyone is familiar with this library or the
> specific part of MIDI that i'm talking about, and would be willing 
to
Show quoted textHide quoted text
> give me some info. links, tips or anything.
> 
> anything but spam :)
> 
> thanks Malik
>

Re: [xl7] Re: hi new guy here: MIDI Clock question ATTN: Steve and Aaron :P

2007-01-19 by Aaron Eppolito

As a side note, even if you were getting clocks, if they weren't
timestamped as to reception time, it'd be pretty much impossible to get
useful timing information from them anyway.  That's not to say it
wouldn't, but I would doubt it.

-Aaron

--- steve_the_composer <smw-mail@...> wrote:

> I took a quick peek at the MIDIIN.PAS file where I found the 
> following note:
> 
> "Midi Time Code (MTC) and Active Sensing: The DLL is currently 
> hardcoded to filter these short events out, so that we don't spend 
> all our time processing them."
> 
> Without delving further, my guess is that MIDICON3 will not give you 
> access to the F8, FA, FB, F9 bytes you need.
> 
> Other options include--finding other libraries, though I wonder if 
> there are others in Pascal. I do recall seeing a number of libraries 
> avaialble in C/C++ a few years ago; writing your own midi event 
> handlers so timing bytes aren't filtered out; getting into other 
> programming venues. 
> 
> Good luck.
> 
> --Steve
> 
> 
> 
> 
> 
> 
> 
> --- In xl7@yahoogroups.com, "malik" <malik_martin@...> wrote:
> >
> > Hi
> > i'm writting a program that takes MIDI input with delphi, that uses
> > MIDICOM3.
> > I'm not sure if or how i can get MIDI Clock working in it. I cant 
> seem
> > to figure out if it supports realtime message.
> > I'm thinking. that if while monitoring midi input. if i see clock
> > messages in the  monitor than it either supports it or detects it.
> > 
> > if it can detect it, i should be able to emulate a midi clock 
> message
> > in order to sync my software to my external drum 
> machine/controller.
> > 
> > I dont have enough money to get the book from the MMA at the moment
> > and was wondering if anyone is familiar with this library or the
> > specific part of MIDI that i'm talking about, and would be willing 
> to
> > give me some info. links, tips or anything.
> > 
> > anything but spam :)
> > 
> > thanks Malik
> >
> 
> 
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
> 



 
____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/

Re: hi new guy here: MIDI Clock question ATTN: Steve and Aaron :P

2007-01-19 by malik

> --- steve_the_composer <smw-mail@...> wrote:> 
> > I took a quick peek at the MIDIIN.PAS file where I found the 
> > following note:
> > 
> > "Midi Time Code (MTC) and Active Sensing: The DLL is currently 
> > hardcoded to filter these short events out, so that we don't 
spend 
> > all our time processing them."
> > 
> > Without delving further, my guess is that MIDICON3 will not give 
you 
> > access to the F8, FA, FB, F9 bytes you need.

yeah that's been filtered but i dont think it has anying to do with 
F8 byte does it? arent MTC and MIDI Clock 2 different things?

> > Other options include--finding other libraries, though I wonder 
if 
> > there are others in Pascal. I do recall seeing a number of 
libraries 
> > avaialble in C/C++ a few years ago; writing your own midi event 
> > handlers so timing bytes aren't filtered out; getting into other 
> > programming venues. 


yeah might end up writing my own.

> As a side note, even if you were getting clocks, if they weren't
> timestamped as to reception time, it'd be pretty much impossible to 
get
> useful timing information from them anyway.  That's not to say it
> wouldn't, but I would doubt it.
> 
> -Aaron

i could be wrong but as far as i know, there are no timestamp 
messages in Realtime messages. only status bytes. but there is a time 
signature message in MTC.
this is from the midi spec docs at:
http://www.borg.com/~jglatt/tech/midispec.htm

I'm gnna go digging through midicom3 and see what i can find


thanks,
malik

P.S.
sorry about the new guy title :P. this message was meant for a MIDI 
tech group in google but when i was posting it wouldnt go through so 
i just copied and posted everything. come to find out later, google 
groups have spam protection :)
i wish yahoo would do that.

Re: hi new guy here: MIDI Clock question ATTN: Steve and Aaron :P

2007-01-20 by malik

In the MIDICOM3 library, i've managed to find a const called
MIDI_TIMINGCLOCK in the midicons.pas file and it = F8!!!!


Now i gotta remember how i used MIDICons for MIDI input!!
oh here is the .pas file.

{ $Header: /MidiComp/MIDICONS.PAS 2     10/06/97 7:33 Davec $ }

{ Written by David Churcher <dchurcher@...>,
  released to the public domain. }


{ MIDI Constants }
unit Midicons;

interface

uses Messages;

const
	MIDI_ALLNOTESOFF = $7B;
	MIDI_NOTEON          = $90;
	MIDI_NOTEOFF         = $80;
	MIDI_KEYAFTERTOUCH   = $a0;
	MIDI_CONTROLCHANGE   = $b0;
	MIDI_PROGRAMCHANGE   = $c0;
	MIDI_CHANAFTERTOUCH  = $d0;
	MIDI_PITCHBEND       = $e0;
	MIDI_SYSTEMMESSAGE   = $f0;
	MIDI_BEGINSYSEX      = $f0;
	MIDI_MTCQUARTERFRAME = $f1;
	MIDI_SONGPOSPTR      = $f2;
	MIDI_SONGSELECT      = $f3;
	MIDI_ENDSYSEX        = $F7;
>>>>>>>>MIDI_TIMINGCLOCK     = $F8;<<<<<<<<<<<<
	MIDI_START           = $FA;
	MIDI_CONTINUE        = $FB;
	MIDI_STOP            = $FC;
	MIDI_ACTIVESENSING   = $FE;
	MIDI_SYSTEMRESET     = $FF;

	MIM_OVERFLOW         = WM_USER;	{ Input buffer overflow }
	MOM_PLAYBACK_DONE    = WM_USER+1; { Timed playback complete }


implementation

end.




--- In xl7@yahoogroups.com, "malik" <malik_martin@...> wrote:
Show quoted textHide quoted text
>
> > --- steve_the_composer <smw-mail@> wrote:> 
> > > I took a quick peek at the MIDIIN.PAS file where I found the 
> > > following note:
> > > 
> > > "Midi Time Code (MTC) and Active Sensing: The DLL is currently 
> > > hardcoded to filter these short events out, so that we don't 
> spend 
> > > all our time processing them."
> > > 
> > > Without delving further, my guess is that MIDICON3 will not give 
> you 
> > > access to the F8, FA, FB, F9 bytes you need.
> 
> yeah that's been filtered but i dont think it has anying to do with 
> F8 byte does it? arent MTC and MIDI Clock 2 different things?
> 
> > > Other options include--finding other libraries, though I wonder 
> if 
> > > there are others in Pascal. I do recall seeing a number of 
> libraries 
> > > avaialble in C/C++ a few years ago; writing your own midi event 
> > > handlers so timing bytes aren't filtered out; getting into other 
> > > programming venues. 
> 
> 
> yeah might end up writing my own.
> 
> > As a side note, even if you were getting clocks, if they weren't
> > timestamped as to reception time, it'd be pretty much impossible to 
> get
> > useful timing information from them anyway.  That's not to say it
> > wouldn't, but I would doubt it.
> > 
> > -Aaron
> 
> i could be wrong but as far as i know, there are no timestamp 
> messages in Realtime messages. only status bytes. but there is a time 
> signature message in MTC.
> this is from the midi spec docs at:
> http://www.borg.com/~jglatt/tech/midispec.htm
> 
> I'm gnna go digging through midicom3 and see what i can find
> 
> 
> thanks,
> malik
> 
> P.S.
> sorry about the new guy title :P. this message was meant for a MIDI 
> tech group in google but when i was posting it wouldnt go through so 
> i just copied and posted everything. come to find out later, google 
> groups have spam protection :)
> i wish yahoo would do that.
>

Re: hi new guy here: MIDI Clock question ATTN: Steve and Aaron :P

2007-01-20 by steve_the_composer

I. Timestaming Issue:

I only took a quick look at the library source code and I believe it 
does support timestamping.
 
--- In xl7@yahoogroups.com, Aaron Eppolito <synthesis77@...> wrote:
>
> As a side note, even if you were getting clocks, if they weren't
> timestamped as to reception time, it'd be pretty much impossible to
> get useful timing information from them anyway.  That's not to say
> it wouldn't, but I would doubt it.
> 
> -Aaron

II. MTC and MIDI clocks Issue:

Yes, they are different. That's why I only >>guessed<< that midi 
clocks might be filtered, too. I would be happy to learn they are not.

> --- steve_the_composer <smw-mail@.. .> wrote:> 
> > I took a quick peek at the MIDIIN.PAS file where I found the 
> > following note:
> > 
> > "Midi Time Code (MTC) and Active Sensing: The DLL is currently 
> > hardcoded to filter these short events out, so that we don't 
> > spend all our time processing them."
> > 
> > Without delving further, my guess is that MIDICON3 will not give
> > you access to the F8, FA, FB, F9 bytes you need.

> yeah that's been filtered but i dont think it has anying to do with
> F8 byte does it? arent MTC and MIDI Clock 2 different things?

III: How is MIDI_TIMINGCLOCK handled?

Is there source code for the DLL that handles (and hence filters) 
incoming midi data? If so, that should tell if clocks can be returned 
to your code or if they are filtered out.

Write some simple code that takes midi in and tells you if you are 
getting each of the following:

MIDI_ TIMINGCLOCK = $F8;
MIDI_START = $FA;
MIDI_CONTINUE = $FB;
MIDI_STOP = $FC;

Malik wrote:

> In the MIDICOM3 library, i've managed to find a const called
> MIDI_TIMINGCLOCK in the midicons.pas file and it = F8!!!!

--Steve

Re: hi new guy here: MIDI Clock question ATTN: Steve and Aaron :P

2007-01-20 by steve_the_composer

1. Here's the MIDICOM3 type definition for midi I/O events which 
includes timestamp.

{ A MIDI input/output event }
TMyMidiEvent = class(TPersistent)
public
MidiMessage: Byte;      { MIDI message status byte }
Data1: Byte;            { MIDI message data 1 byte }
Data2: Byte;            { MIDI message data 2 byte }
Time: DWORD;          { Time in ms since midiInOpen }
SysexLength: Word;  { Length of sysex data (0 if none) }
Sysex: PChar;           { Pointer to sysex data buffer }
destructor Destroy; override;   { Frees sysex data buffer if nec. }
end;
PMyMidiEvent = ^TMyMidiEvent;

2. Take a look at MONPROCS for handling of ThisEvent

3. If you haven't seen this, take a look at:

http://www.torry.ru/authorsmore.php?id=3421

for some code that uses MIDICOM3. 

--Steve

Re: hi new guy here: MIDI Clock question ATTN: Steve and Aaron :P

2007-01-20 by steve_the_composer

I delved a little further into MIDICOM3 and here are two references 
you should check out:

(1) From the README file:

 Q: How do I receive MIDI timing data?

 A: This is filtered out by default in the callback function in 
DELPHMCB.PAS. Enable it by removing the check for MIDI_TIMINGCLOCK in 
the midiHandler function.

(2) From DELPHMCB.PAS (with dashes to simulate whitespace):

Begin
---case wMsg of
-----mim_Open: {nothing};
-----mim_Error: {TODO: handle (message to trigger exception?) };
-----mim_Data, mim_Longdata, mim_Longerror:
--------begin
{ TODO: Make filtered messages customisable, I'm sure someone wants to
do something with MTC! }
----------if (dwParam1 <> MIDI_ACTIVESENSING)and (dwParam1 <> 
MIDI_TIMINGCLOCK) then
--------------begin
etc.

You might want to try deleting "and (dwParam1 <> MIDI_TIMINGCLOCK)" 
and recompiling the Delphmcb unit.

(BTW: David Churcher's TODO comment about MTC leads me to believe he 
equated MTC with MIDI_TIMINGCLOCK.)

Hope this helps.

--Steve

--- In xl7@yahoogroups.com, "malik" <malik_martin@...> wrote:
Show quoted textHide quoted text
>
> > --- steve_the_composer <smw-mail@> wrote:> 
> > > I took a quick peek at the MIDIIN.PAS file where I found the 
> > > following note:
> > > 
> > > "Midi Time Code (MTC) and Active Sensing: The DLL is currently 
> > > hardcoded to filter these short events out, so that we don't 
> > > spend all our time processing them."
> > > 
> > > Without delving further, my guess is that MIDICON3 will not
> > > give you access to the F8, FA, FB, F9 bytes you need.
> 
> yeah that's been filtered but i dont think it has anying to do with 
> F8 byte does it? arent MTC and MIDI Clock 2 different things?

Re: hi new guy here: MIDI Clock question ATTN: Steve and Aaron :P

2007-01-20 by malik

I dunno if there is but i'm gonna try to see if i can detect F*


> Is there source code for the DLL that handles (and hence filters) 
> incoming midi data? If so, that should tell if clocks can be 
returned 
Show quoted textHide quoted text
> to your code or if they are filtered out.
> 
> Write some simple code that takes midi in and tells you if you are 
> getting each of the following:
> 
> MIDI_ TIMINGCLOCK = $F8;
> MIDI_START = $FA;
> MIDI_CONTINUE = $FB;
> MIDI_STOP = $FC;
> 
> Malik wrote:
> 
> > In the MIDICOM3 library, i've managed to find a const called
> > MIDI_TIMINGCLOCK in the midicons.pas file and it = F8!!!!
> 
> --Steve
>

Re: hi new guy here: MIDI Clock question ATTN: Steve and Aaron :P

2007-01-20 by malik

crap that did it!!
i was looking at that page for like 2 days and didnt understand it. i 
must have skipped over that in the FAQ!! omg thanks SO much steve!!

--- In xl7@yahoogroups.com, "steve_the_composer" <smw-mail@...> wrote:
>
> I delved a little further into MIDICOM3 and here are two references 
> you should check out:
> 
> (1) From the README file:
> 
>  Q: How do I receive MIDI timing data?
> 
>  A: This is filtered out by default in the callback function in 
> DELPHMCB.PAS. Enable it by removing the check for MIDI_TIMINGCLOCK 
in 
> the midiHandler function.
> 
> (2) From DELPHMCB.PAS (with dashes to simulate whitespace):
> 
> Begin
> ---case wMsg of
> -----mim_Open: {nothing};
> -----mim_Error: {TODO: handle (message to trigger exception?) };
> -----mim_Data, mim_Longdata, mim_Longerror:
> --------begin
> { TODO: Make filtered messages customisable, I'm sure someone wants 
to
> do something with MTC! }
> ----------if (dwParam1 <> MIDI_ACTIVESENSING)and (dwParam1 <> 
> MIDI_TIMINGCLOCK) then
> --------------begin
> etc.
> 
> You might want to try deleting "and (dwParam1 <> MIDI_TIMINGCLOCK)" 
> and recompiling the Delphmcb unit.
> 
> (BTW: David Churcher's TODO comment about MTC leads me to believe 
he 
> equated MTC with MIDI_TIMINGCLOCK.)
> 
> Hope this helps.
> 
> --Steve
> 
> --- In xl7@yahoogroups.com, "malik" <malik_martin@> wrote:
> >
> > > --- steve_the_composer <smw-mail@> wrote:> 
> > > > I took a quick peek at the MIDIIN.PAS file where I found the 
> > > > following note:
> > > > 
> > > > "Midi Time Code (MTC) and Active Sensing: The DLL is 
currently 
> > > > hardcoded to filter these short events out, so that we don't 
> > > > spend all our time processing them."
> > > > 
> > > > Without delving further, my guess is that MIDICON3 will not
> > > > give you access to the F8, FA, FB, F9 bytes you need.
> > 
> > yeah that's been filtered but i dont think it has anying to do 
with 
> > F8 byte does it? arent MTC and MIDI Clock 2 different things?
>