Hi Mark,
The MIDI Time Code is typically handled via a System Exclusive (SysEx)
message that has the following forumat:
F0 7F cc 01 01 hr mn sc fr F7
That can be interpreted as:
F0 7F <- Universal Sysex Header
cc <- MIDI Channel
01 <- Sub ID#1 MTC
01 <- Sub ID#1 Full Time Code Message
hr <- Hours and Type 0yyzzzzz
yy = the type (00=24fps, 01=25fps, 10=30fps
dropframe, 11=30fps non dropframe)
zzzzz = hours (0-23)
mn <- Minutes (0-59)
sc <- Seconds (0-59)
fr <- Frames (0-29)
F7 <- End of Sysex Message.
As you can see, all the information to create an SMPTE time code is present.
All you need to do is when you read this series of bytes, isolate the hr
field (the 6th byte read) and you'll have your hours.
SMPTE or Logitudinal timecode data format is formatted like so:
Longitudinal timecode data format
The basic format is an 80-bit code that gives the time of day to the second,
and the frame number within the second.
The bits of the longitudinal SMPTE code:
0..3: Frame units
4..7: user-bits field 1
8..9: Frame tens
10: 1=drop frame format (frame 0 and 1 omitted from first second of each
minute, but included when minutes divides by ten; approximates 29.97
frame/s)
11: 1="color frame", i.e. the time code is intentionally synchronised with
a color TV field sequence.
12..15: user-bits field 2
16..19: seconds units
20..23: user bits field 3
24..26: second tens
27: Bi-phase mark-correction bit; set or cleared so every 80-bit word has
an even number of zeros. In a linear timecode system, this ensures that
there is no net current flow, and also allows a technician to read the
bi-phase coding timing with an oscilloscope, without the signal inverting
itself continually. Modern equipment regenerates the time code to a fixed
timing in the video vertical interval, so this is far less needed than
before.
28..31: user bits field 4
32..35: minutes unit digit
36..39: user bits field 5
40..42: minutes tens digit
43: binary group flag bit (with bit 59, 43,59 = 00 = no format for user
bits, 10 = eight bit format, 01, 11 are unassigned and reserved).
44..47: user bits field 6
48..51: hours units
52..55: user bits field 7
56..57: hours tens
58: unused, reserved, should transmit zero and ignore on receive for
compatibility
59: binary group flag bit (see bit 43 for encoding)
60..63: user bits field 8
64..79: sync word, should be 0011 1111 1111 1101
As you can see, bit 38 to 51 represent the hour units and bits 56 and 57 the
10s of hours. . you just need to convert your hexadecimal hour value to a
binary equivalent and and or them together...
for example:
So for the sake of discussion say you have 14 hours
01 for the 10s of hours
0100 for the units
you just simply invert that to
0100 01
insert 40 0 bits before this value, giving you:
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0100 01
and you OR that value with your current SMPTE bit stream. So if you have
this:
0101 0101 0101 1010 1010 1010 0000 0000 0000 0000 0000 0000 0000 0000 0000
0000 0011 1111 1111 1101
OR
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0100 01
will give you
unit 10s
0101 0101 0101 1010 1010 1010 0000 0000 0000 0000 0000 0000 0100 0100 0000
0000 0011 1111 1111 1101
and your time should now be at the right place in the SMPTE message and in
the right order.
If you want more details, let me know.
HOpe this helps
Stephane Richard
----- Original Message -----
From: "Mark" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, May 30, 2006 8:19 PM
Subject: Converting Midi Timecode Hours to SMPTE Timecode hours
I've seen a few post regarding Midi here so I was hoping someone might
be able to lend a hand with the following...
I've managed to read everything in a midi file that I need but are
stumped with the Midi TC Hours byte. I've found this article at:
http://www.borg.com/~jglatt/tech/mtc.htm which says:
In the data byte for the Hours High Nibble and SMPTE Type, the bits
are interpreted as follows:
0nnn x yy d
where nnn is 7. x is unused and set to 0. d is bit 4 of the Hours
Time. yy tells the SMPTE Type as follows:
0 = 24 fps
1 = 25 fps
2 = 30 fps (Drop-Frame)
3 = 30 fps
Does anyone have some sample code or able to explain how to turn a
Midi TC hex hour field into a SMPTE hour field and SMPTE type value.
Best regards,
Mark
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.7.4/351 - Release Date: 5/29/2006
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>