This document details the structure of MIDI Files. The purpose of MIDI Files is to provide a way of interchanging time-stamped MIDI data between different programs on the same or different computers. One of the primary design goals is compact representation, which makes it very appropriate for disk-based file format, but which might make it inappropriate for storing in memory for quick access by a sequencer program.
MIDI Files contain one or more MIDI streams, with time information for each event. Song, sequence, and track structures, tempo and time signature information, are all supported. Track names and other descriptive information may be stored with the MIDI data. This format supports multiple tracks and multiple sequences so that if the user of a program which supports multiple tracks intends to move a file to another one, this format can allow that to happen.
The specification defines the 8-bit binary data stream used in the file. The data can be stored in a binary file, nibbilized, 7-bit-ized for efficient MIDI transmission, converted to Hex ASCII, or translated symbolically to a printable text file. This spec addresses what's in the 8-bit stream. It does not address how a MIDI File will be transmitted over MIDI.
In this document, bit 0 means the least significant bit of a byte, and bit 7 is the most significant.
Some numbers in MIDI Files are represented in a form called VARIABLE-LENGTH QUANTITY. These numbers are represented 7 bits per byte, most significant bits first. All bytes except the last have bit 7 set, and the last byte has bit 7 clear. If the number is between 0 and 127, it is thus represented exactly as one byte.
Some examples of numbers represented as variable-length quantities:
| 00000000 | 00 |
| 00000040 | 40 |
| 0000007F | 7F |
| 00000080 | 81 00 |
| 00002000 | C0 00 |
| 00003FFF | FF 7F |
| 00004000 | 81 80 00 |
| 00100000 | C0 80 00 |
| 001FFFFF | FF FF 7F |
| 00200000 | 81 80 80 00 |
| 08000000 | C0 80 80 00 |
| 0FFFFFFF | FF FF FF 7F |
The largest number which is allowed is 0FFFFFFF so that the variable-length representations must fit in 32 bits in a routine to write variable-length numbers. Theoretically, larger numbers are possible, but 2 x 108 96ths of a beat at a fast tempo of 500 beats per minute is four days, long enough for any delta-time!
Each chunk begins with a 4-character ASCII type. It is followed by a 32-bit length, most significant byte first (a length of 6 is stored as 00 00 00 06). This length refers to the number of bytes of data which follow: the eight bytes of type and length are not included. Therefore, a chunk with a length of 6 would actually occupy 14 bytes in the disk file.
This chunk architecture is similar to that used by Electronic Arts' IFF format, and the chunks described herein could easily be placed in an IFF file. The MIDI File itself is not an IFF file: it contains no nested chunks, and chunks are not constrained to be an even number of bytes long. Converting it to an IFF file is as easy as padding odd length chunks, and sticking the whole thing inside a FORM chunk.
MIDI Files contain two types of chunks: header chunks and track chunks. A -header- chunk provides a minimal amount of information pertaining to the entire MIDI file. A -track- chunk contains a sequential stream of MIDI data which may contain information for up to 16 MIDI channels. The concepts of multiple tracks, multiple MIDI outputs, patterns, sequences, and songs may all be implemented using several track chunks.
A MIDI File always starts with a header chunk, and is followed by one or more track chunks.
MThd <length of header data>
<header data>
MTrk <length of track data>
<track data>
MTrk <length of track data>
<track data>
. . .
<Header Chunk> = <chunk type><length><format><ntrks><division>
As described above, <chunk type> is the four ASCII characters 'MThd'; <length> is a 32-bit representation of the number 6 (high byte first).
The data section contains three 16-bit words, stored most-significant byte first.
The first word, <format>, specifies the overall organisation of the file. Only three values of <format> are specified:
0-the file contains a single multi-channel track
1-the file contains one or more simultaneous tracks (or MIDI outputs) of a sequence
2-the file contains one or more sequentially independent single-track patterns
More information about these formats is provided below.
The next word, <ntrks>, is the number of track chunks in the file. It will always be 1 for a format 0 file.
The third word, <division>, specifies the meaning of the delta-times. It has two formats, one for metrical time, and one for time-code-based time:
| bit 15 | bits 14 thru 8 | bits 7 thru 0 |
|---|---|---|
| 0 | ticks per quarter-note | |
| 1 | negative SMPTE format | ticks per frame |
If bit 15 of <division> is zero, the bits 14 thru 0 represent the number of delta time "ticks" which make up a quarter-note. For instance, if division is 96, then a time interval of an eighth-note between two events in the file would be 48.
If bit 15 of <division> is a one, delta times in a file correspond to subdivisions of a second, in a way consistent with SMPTE and MIDI Time Code. Bits 14 thru 8 contain one of the four values -24, -25, -29, or -30, corresponding to the four standard SMPTE and MIDI Time Code formats (-29 corresponds to 30 drop frame), and represents the number of frames per second. These negative numbers are stored in two's compliment form. The second byte (stored positive) is the resolution within a frame: typical values may be 4 (MIDI Time Code resolution), 8, 10, 80 (bit resolution), or 100. This stream allows exact specifications of time-code-based tracks, but also allows millisecond-based tracks by specifying 25 frames/sec and a resolution of 40 units per frame. If the events in a file are stored with a bit resolution of thirty-frame time code, the division word would be E250 hex.
A Format 1 or 2 file has a header chunk followed by one or more track chunks. programs which support several simultaneous tracks should be able to save and read data in format 1, a vertically one dimensional form, that is, as a collection of tracks. Programs which support several independent patterns should be able to save and read data in format 2, a horizontally one dimensional form. Providing these minimum capabilities will ensure maximum interchangeability.
In a MIDI system with a computer and a SMPTE synchroniser which uses Song Pointer and Timing Clock, tempo maps (which describe the tempo throughout the track, and may also include time signature information, so that the bar number may be derived) are generally created on the computer. To use them with the synchroniser, it is necessary to transfer them from the computer. To make it easy for the synchroniser to extract this data from a MIDI File, tempo information should always be stored in the first MTrk chunk. For a format 0 file, the tempo will be scattered through the track and the tempo map reader should ignore the intervening events; for a format 1 file, the tempo map must be stored as the first track. It is polite to a tempo map reader to offer your user the ability to make a format 0 file with just the tempo, unless you can use format 1.
All MIDI Files should specify tempo and time signature. If they don't, the time signature is assumed to be 4/4, and the tempo 120 beats per minute. In format 0, these meta-events should occur at least at the beginning of the single multi-channel track. In format 1, these meta-events should be contained in the first track. In format 2, each of the temporally independent patterns should contain at least initial time signature and tempo information.
Format IDs to support other structures may be defined in the future. A program encountering an unknown format ID may still read other MTrk chunks it finds from the file, as format 1 or 2, if its user can make sense of them and arrange them into some other structure if appropriate. Also, more parameters may be added to the MThd chunk in the future: it is important to read and honour the length, even if it is longer than 6.
Here is the syntax of an MTrk chunk (the + means "one or more": at least one MTrk event must be present):
<Track Chunk> = <chunk type><length><MTrk event>+
The syntax of an MTrk event is very simple:
<MTrk event> = <delta-time><event>
<delta-time> is stored as a variable-length quantity. It represents the amount of time before the following event. If the first event in a track occurs at the very beginning of a track, or if two events occur simultaneously, a delta-time of zero is used. Delta-times are always present. (Not storing delta-times of 0 requires at least two bytes for any other value, and most delta-times aren't zero.) Delta-time is in some fraction of a beat (or a second, for recording a track with SMPTE times), as specified in the header chunk.
<event> = <MIDI event> | <sysex event> | <meta-event>
<MIDI event> is any MIDI channel message See Appendix 1 - MIDI Messages. Running status is used: status bytes of MIDI channel messages may be omitted if the preceding event is a MIDI channel message with the same status. The first event in each MTrk chunk must specify status. Delta-time is not considered an event itself: it is an integral part of the syntax for an MTrk event. Notice that running status occurs across delta-times.
<sysex event> is used to specify a MIDI system exclusive message, either as one unit or in packets, or as an "escape" to specify any arbitrary bytes to be transmitted. See Appendix 1 - MIDI Messages. A normal complete system exclusive message is stored in a MIDI File in this way:
F0 <length> <bytes to be transmitted after F0>
The length is stored as a variable-length quantity. It specifies the number of bytes which follow it, not including the F0 or the length itself. For instance, the transmitted message F0 43 12 00 07 F7 would be stored in a MIDI File as F0 05 43 12 00 07 F7. It is required to include the F7 at the end so that the reader of the MIDI File knows that it has read the entire message.
Another form of sysex event is provided which does not imply that an F0 should be transmitted. This may be used as an "escape" to provide for the transmission of things which would not otherwise be legal, including system realtime messages, song pointer or select, MIDI Time Code, etc. This uses the F7 code:
F7 <length> <all bytes to be transmitted>
Unfortunately, some synthesiser manufacturers specify that their system exclusive messages are to be transmitted as little packets. Each packet is only part of an entire syntactical system exclusive message, but the times they are transmitted are important. Examples of this are the bytes sent in a CZ patch dump, or the FB-01's "system exclusive mode" in which microtonal data can be transmitted. The F0 and F7 sysex events may be used together to break up syntactically complete system exclusive messages into timed packets.
An F0 sysex event is used for the first packet in a series -- it is a message in which the F0 should be transmitted. An F7 sysex event is used for the remainder of the packets, which do not begin with F0. (Of course, the F7 is not considered part of the system exclusive message).
A syntactic system exclusive message must always end with an F7, even if the real-life device didn't send one, so that you know when you've reached the end of an entire sysex message without looking ahead to the next event in the MIDI File. If it's stored in one complete F0 sysex event, the last byte must be an F7. There also must not be any transmittable MIDI events in between the packets of a multi-packet system exclusive message. This principle is illustrated in the paragraph below.
Here is a MIDI File of a multi-packet system exclusive message: suppose the bytes F0 43 12 00 were to be sent, followed by a 200-tick delay, followed by the bytes 43 12 00 43 12 00, followed by a 100-tick delay, followed by the bytes 43 12 00 F7, this would be in the MIDI File:
| F0 03 43 12 00 | |
| 81 48 | 200-tick delta time |
| F7 06 43 12 00 43 12 00 | |
| 64 | 100-tick delta time |
| F7 04 43 12 00 F7 |
When reading a MIDI File, and an F7 sysex event is encountered without a preceding F0 sysex event to start a multi-packet system exclusive message sequence, it should be presumed that the F7 event is being used as an "escape". In this case, it is not necessary that it end with an F7, unless it is desired that the F7 be transmitted.
<meta-event> specifies non-MIDI information useful to this format or to sequencers, with this syntax:
FF <type> <length> <bytes>
All meta-events begin with FF, then have an event type byte (which is always less than 128), and then have the length of the data stored as a variable-length quantity, and then the data itself. If there is no data, the length is 0. As with chunks, future meta-events may be designed which may not be known to existing programs, so programs must properly ignore meta-events which they do not recognise, and indeed should expect to see them. Programs must never ignore the length of a meta-event which they do not recognise, and they shouldn't be surprised if it's bigger than expected. If so, they must ignore everything past what they know about. However, they must not add anything of their own to the end of the meta- event. Sysex events and meta events cancel any running status which was in effect. Running status does not apply to and may not be used for these messages.
A few meta-events are defined herein. It is not required for every program to support every meta-event.
In the syntax descriptions for each of the meta-events a set of conventions is used to describe parameters of the events. The FF which begins each event, the type of each event, and the lengths of events which do not have a variable amount of data are given directly in hexadecimal. A notation such as dd or se, which consists of two lower-case letters, mnemonically represents an 8-bit value. Four identical lower-case letters such as wwww mnemonically refer to a 16-bit value, stored most-significant-byte first. Six identical lower-case letters such as tttttt refer to a 24-bit value, stored most-significant-byte first. The notation len refers to the length portion of the meta-event syntax, that is, a number, stored as a variable- length quantity, which specifies how many bytes (possibly text) data were just specified by the length.
In general, meta-events in a track which occur at the same time may occur in any order. If a copyright event is used, it should be placed as early as possible in the file, so it will be noticed easily. Sequence Number and Sequence/Track Name events, if present, must appear at time 0. An end-of- track event must occur as the last event in the track.
FF 00 02 Sequence Number
This optional event, which must occur
at the beginning of a track, before any nonzero delta-times, and
before any transmittable MIDI events, specifies the number of a
sequence. In a format 2 MIDI File, it is used to identify each
"pattern" so that a "song" sequence using the
Cue message can refer to the patterns. If the ID numbers are
omitted, the sequences' locations in order in the file are used
as defaults. In a format 0 or 1 MIDI File, which only contain one
sequence, this number should be contained in the first (or only)
track. If transfer of several multitrack sequences is required,
this must be done as a group of format 1 files, each with a
different sequence number.
FF 01 len text Text Event
Any amount of text describing
anything. It is a good idea to put a text event right at the
beginning of a track, with the name of the track, a description
of its intended orchestration, and any other information which
the user wants to put there. Text events may also occur at other
times in a track, to be used as lyrics, or descriptions of cue
points. The text in this event should be printable ASCII
characters for maximum interchange. However, other character
codes using the high-order bit may be used for interchange of
files between different programs on the same computer which
supports an extended character set. Programs on a computer which
does not support non-ASCII characters should ignore those
characters.
Meta-event types 01 through 0F are reserved for various types of text events, each of which meets the specification of text events (above) but is used for a different purpose:
FF 02 len text Copyright Notice
Contains a copyright notice as
printable ASCII text. The notice should contain the characters
(C), the year of the copyright, and the owner of the copyright.
If several pieces of music are in the same MIDI File, all of the
copyright notices should be placed together in this event so that
it will be at the beginning of the file. This event should be the
first event in the track chunk, at time 0.
FF 03 len text Sequence/Track Name
If in a format 0 track, or
the first track in a format 1 file, the name of the sequence.
Otherwise, the name of the track.
FF 04 len text Instrument Name
A description of the type of
instrumentation to be used in that track. May be used with the
MIDI Prefix meta-event to specify which MIDI channel the
description applies to, or the channel may be specified as text
in the event itself.
FF 05 len text Lyric
A lyric to be sung. Generally, each
syllable will be a separate lyric event which begins at the
event's time.
FF 06 len text Marker
Normally in a format 0 track, or the
first track in a format 1 file. The name of that point in the
sequence, such as a rehearsal letter or section name ("First
Verse", etc.)
FF 07 len text Cue Point
A description of something happening
on a film or video screen or stage at that point in the musical
score ("Car crashes into house", "curtain
opens", "she slaps his face", etc.)
FF 20 01 cc MIDI Channel Prefix
The MIDI channel (0-15)
contained in this event may be used to associate a MIDI channel
with all events which follow, including System exclusive and
meta-events. This channel is "effective" until the next
normal MIDI event (which contains a channel) or the next MIDI
Channel Prefix meta-event. If MIDI channels refer to
"tracks", this message may be put into a format 0 file,
keeping their non-MIDI data associated with a track. This
capability is also present in Yamaha's ESEQ file format.
FF 2F 00 End of Track
This event is not optional. It is
included so that an exact ending point may be specified for the
track, so that an exact length is defined, which is necessary for tracks
which are looped or concatenated.
FF 51 03 tttttt Set Tempo (in microseconds per MIDI quarter-note)
This event indicates a tempo change. Another way of
putting "microseconds per quarter-note" is "24ths
of a microsecond per MIDI clock". Representing tempos as
time per beat instead of beat per time allows absolutely exact
long-term synchronisation with a time-based sync protocol such as
SMPTE time code or MIDI time code. The amount of accuracy
provided by this tempo resolution allows a four-minute piece at
120 beats per minute to be accurate within 500 usec at the end of
the piece. Ideally, these events should only occur where MIDI
clocks would be located -- this convention is intended to
guarantee, or at least increase the likelihood, of compatibility
with other synchronisation devices so that a time signature/tempo
map stored in this format may easily be transferred to another
device.
FF 54 05 hr mn se fr ff SMPTE Offset
This event, if present,
designates the SMPTE time at which the track chunk is supposed to
start. It should be present at the beginning of the track, that
is, before any nonzero delta-times, and before any transmittable
MIDI events. the hour must be encoded with the SMPTE format, just
as it is in MIDI Time Code. In a format 1 file, the SMPTE Offset
must be stored with the tempo map, and has no meaning in any of
the other tracks. The ff field contains fractional frames, in
100ths of a frame, even in SMPTE-based tracks which specify a
different frame subdivision for delta-times.
FF 58 04 nn dd cc bb Time Signature
The time signature is
expressed as four numbers. nn and dd represent the numerator and
denominator of the time signature as it would be notated. The
denominator is a negative power of two: 2 represents a
quarter-note, 3 represents an eighth-note, etc. The cc parameter
expresses the number of MIDI clocks in a metronome click. The bb
parameter expresses the number of notated 32nd-notes in a MIDI
quarter-note (24 MIDI clocks). This was added because there are
already multiple programs which allow a user to specify that what
MIDI thinks of as a quarter-note (24 clocks) is to be notated as,
or related to in terms of, something else.
Therefore, the complete event for 6/8 time, where the metronome clicks every three eighth-notes, but there are 24 clocks per quarter-note, 72 to the bar, would be (in hex):
FF 58 04 06 03 24 08
That is, 6/8 time (8 is 2 to the 3rd power, so this is 06 03), 36 MIDI clocks per dotted-quarter (24 hex!), and eight notated 32nd-notes per quarter-note.
FF 59 02 sf mi Key Signature
sf = -7: 7 flats
sf = -1: 1 flat
sf = 0: key of C
sf = 1: 1 sharp
sf = 7: 7 sharps
mi = 0: major key
mi = 1: minor key
FF 7F len data Sequencer Specific Meta-Event
Special requirements for particular sequencers may use this event type:
the first byte or bytes of data is a manufacturer ID (these are
one byte, or if the first byte is 00, three bytes). As with MIDI
System Exclusive, manufacturers who define something using this
meta-event should publish it so that others may be used by a
sequencer which elects to use this as its only file format;
sequencers with their established feature-specific formats should
probably stick to the standard features when using this format.
See Appendix 2 - Program Fragments and Example MIDI Files for an example midi file.
A MIDI message is made up of an eight-bit status byte which is generally followed by one or two data bytes. There are a number of different types of MIDI messages. At the highest level, MIDI messages are classified as being either Channel Messages or System Messages. Channel messages are those which apply to a specific Channel, and the Channel number is included in the status byte for these messages. System messages are not Channel specific, and no Channel number is indicated in their status bytes.
Channel Messages may be further classified as being either Channel Voice Messages, or Mode Messages. Channel Voice Messages carry musical performance data, and these messages comprise most of the traffic in a typical MIDI data stream. Channel Mode messages affect the way a receiving instrument will respond to the Channel Voice messages.
MIDI System Messages are classified as being System Common Messages, System Real Time Messages, or System Exclusive Messages. System Common messages are intended for all receivers in the system. System Real Time messages are used for synchronisation between clock-based MIDI components. System Exclusive messages include a Manufacturer's Identification (ID) code, and are used to transfer any number of data bytes in a format specified by the referenced manufacturer.
| Channel Voice Messages | ||
|---|---|---|
| Status D7----D0 nnnn is the MIDI channel no. | Data Byte(s) D7----D0 | Description |
| 1000nnnn | 0kkkkkkk 0vvvvvvv | Note Off event. This message is sent when a note is released (ended). (kkkkkkk) is the key (note) number. (vvvvvvv) is the velocity. |
| 1001nnnn | 0kkkkkkk 0vvvvvvv | Note On event. This message is sent when a note is depressed (start). (kkkkkkk) is the key (note) number. (vvvvvvv) is the velocity. |
| 1010nnnn | 0kkkkkkk 0vvvvvvv | Polyphonic Key Pressure (Aftertouch). This message is most often sent by pressing down on the key after it "bottoms out". (kkkkkkk) is the key (note) number. (vvvvvvv) is the pressure value. |
| 1011nnnn | 0ccccccc 0vvvvvvv | Control Change. This message is sent when a controller value changes. Controllers include devices such as pedals and levers. Certain controller numbers are reserved for specific purposes. See Channel Mode Messages. (ccccccc) is the controller number. (vvvvvvv) is the new value. |
| 1100nnnn | 0ppppppp | Program Change. This message sent when the patch number changes. (ppppppp) is the new program number. |
| 1101nnnn | 0vvvvvvv | Channel Pressure (After-touch). This message is most often sent by pressing down on the key after it "bottoms out". This message is different from polyphonic after-touch. Use this message to send the single greatest pressure value (of all the current depressed keys). (vvvvvvv) is the pressure value. |
| 1110nnnn | 0lllllll 0mmmmmmm | Pitch Wheel Change. This message is sent to indicate a change in the pitch wheel. The pitch wheel is measured by a fourteen bit value. Centre (no pitch change) is 2000H. Sensitivity is a function of the transmitter. (lllllll) are the least significant 7 bits. (mmmmmmm) are the most significant 7 bits. |
| Channel Mode Messages (See also Control Change, above) | ||
| 1011nnnn | 0ccccccc 0vvvvvvv | Channel Mode Messages. This the same code as the Control Change (above), but implements Mode control by using reserved controller numbers. The numbers are: Local Control. When Local Control is Off, all devices on a given channel will respond only to data received over MIDI. Played data, etc. will be ignored. Local Control On restores the functions of the normal controllers. c = 122, v = 0: Local Control Off c = 122, v = 127: Local Control On All Notes Off. |
| System Common Messages | ||
| 11110000 | 0iiiiiii 0ddddddd .. .. 0ddddddd 11110111 | System Exclusive. This message makes up for all that MIDI doesn't support. (iiiiiii) is usually a seven-bit Manufacturer's I.D. code. If the synthesiser recognises the I.D. code as its own, it will listen to the rest of the message (ddddddd). Otherwise, the message will be ignored. System Exclusive is used to send bulk dumps such as patch parameters and other non-spec data. (Note: Real-Time messages ONLY may be interleaved with a System Exclusive.) This message also is used for extensions called Universal Exclusive Messages. |
| 11110001 | Undefined. | |
| 11110010 | 0lllllll 0mmmmmmm | Song Position Pointer. This is an internal 14 bit register that holds the number of MIDI beats (1 beat= six MIDI clocks) since the start of the song. l is the LSB, m the MSB. |
| 11110011 | 0sssssss | Song Select. The Song Select specifies which sequence or song is to be played. |
| 11110100 | Undefined. | |
| 11110101 | Undefined. | |
| 11110110 | Tune Request. Upon receiving a Tune Request, all analog synthesisers should tune their oscillators. | |
| 11110111 | End of Exclusive. Used to terminate a System Exclusive dump (see above). | |
| System Real-Time Messages | ||
| 11111000 | Timing Clock. Sent 24 times per quarter note when synchronisation is required. | |
| 11111001 | Undefined. | |
| 11111010 | Start. Start the current sequence playing. (This message will be followed with Timing Clocks). | |
| 11111011 | Continue. Continue at the point the sequence was Stopped. | |
| 11111100 | Stop. Stop the current sequence. | |
| 11111101 | Undefined. | |
| 11111110 | Active Sensing. Use of this message is optional. When initially sent, the receiver will expect to receive another Active Sensing message each 300ms (max), or it will be assume that the connection has been terminated. At termination, the receiver will turn off all voices and return to normal (non-active sensing) operation. | |
| 11111111 | Reset. Reset all receivers in the system to power-up status. This should be used sparingly, preferably under manual control. In particular, it should not be sent on power-up. In a MIDI file this is used as an escape to introduce <meta events>. |
The following table lists the MIDI Controller messages in numerical (binary) order.
| 2nd Byte Value | Function | 3rd Byte | |||
|---|---|---|---|---|---|
| Binary | Hex | Dec | Value | Use | |
| 00000000 | 00 | 0 | Bank Select | 0-127 | MSB |
| 00000001 | 01 | 1 | * Modulation wheel | 0-127 | MSB |
| 00000010 | 02 | 2 | Breath control | 0-127 | MSB |
| 00000011 | 03 | 3 | Undefined | 0-127 | MSB |
| 00000100 | 04 | 4 | Foot controller | 0-127 | MSB |
| 00000101 | 05 | 5 | Portamento time | 0-127 | MSB |
| 00000110 | 06 | 6 | Data Entry | 0-127 | MSB |
| 00000111 | 07 | 7 | * Channel Volume (formerly Main Volume) | 0-127 | MSB |
| 00001000 | 08 | 8 | Balance | 0-127 | MSB |
| 00001001 | 09 | 9 | Undefined | 0-127 | MSB |
| 00001010 | 0A | 10 | * Pan | 0-127 | MSB |
| 00001011 | 0B | 11 | * Expression Controller | 0-127 | MSB |
| 00001100 | 0C | 12 | Effect control 1 | 0-127 | MSB |
| 00001101 | 0D | 13 | Effect control 2 | 0-127 | MSB |
| 00001110 | 0E | 14 | Undefined | 0-127 | MSB |
| 00001111 | 0F | 15 | Undefined | 0-127 | MSB |
| 00010000 | 10 | 16 | General Purpose Controller #1 | 0-127 | MSB |
| 00010001 | 11 | 17 | General Purpose Controller #2 | 0-127 | MSB |
| 00010010 | 12 | 18 | General Purpose Controller #3 | 0-127 | MSB |
| 00010011 | 13 | 19 | General Purpose Controller #4 | 0-127 | MSB |
| 00010100 | 14 | 20 | Undefined | 0-127 | MSB |
| 00010101 | 15 | 21 | Undefined | 0-127 | MSB |
| 00010110 | 16 | 22 | Undefined | 0-127 | MSB |
| 00010111 | 17 | 23 | Undefined | 0-127 | MSB |
| 00011000 | 18 | 24 | Undefined | 0-127 | MSB |
| 00011001 | 19 | 25 | Undefined | 0-127 | MSB |
| 00011010 | 1A | 26 | Undefined | 0-127 | MSB |
| 00011011 | 1B | 27 | Undefined | 0-127 | MSB |
| 00011100 | 1C | 28 | Undefined | 0-127 | MSB |
| 00011101 | 1D | 29 | Undefined | 0-127 | MSB |
| 00011110 | 1E | 30 | Undefined | 0-127 | MSB |
| 00011111 | 1F | 31 | Undefined | 0-127 | MSB |
| 00100000 | 20 | 32 | Bank Select | 0-127 | LSB |
| 00100001 | 21 | 33 | Modulation wheel | 0-127 | LSB |
| 00100010 | 22 | 34 | Breath control | 0-127 | LSB |
| 00100011 | 23 | 35 | Undefined | 0-127 | LSB |
| 00100100 | 24 | 36 | Foot controller | 0-127 | LSB |
| 00100101 | 25 | 37 | Portamento time | 0-127 | LSB |
| 00100110 | 26 | 38 | Data entry | 0-127 | LSB |
| 00100111 | 27 | 39 | Channel Volume (formerly Main Volume) | 0-127 | LSB |
| 00101000 | 28 | 40 | Balance | 0-127 | LSB |
| 00101001 | 29 | 41 | Undefined | 0-127 | LSB |
| 00101010 | 2A | 42 | Pan | 0-127 | LSB |
| 00101011 | 2B | 43 | Expression Controller | 0-127 | LSB |
| 00101100 | 2C | 44 | Effect control 1 | 0-127 | LSB |
| 00101101 | 2D | 45 | Effect control 2 | 0-127 | LSB |
| 00101110 | 2E | 46 | Undefined | 0-127 | LSB |
| 00101111 | 2F | 47 | Undefined | 0-127 | LSB |
| 00110000 | 30 | 48 | General Purpose Controller #1 | 0-127 | LSB |
| 00110001 | 31 | 49 | General Purpose Controller #2 | 0-127 | LSB |
| 00110010 | 32 | 50 | General Purpose Controller #3 | 0-127 | LSB |
| 00110011 | 33 | 51 | General Purpose Controller #4 | 0-127 | LSB |
| 00110100 | 34 | 52 | Undefined | 0-127 | LSB |
| 00110101 | 35 | 53 | Undefined | 0-127 | LSB |
| 00110110 | 36 | 54 | Undefined | 0-127 | LSB |
| 00110111 | 37 | 55 | Undefined | 0-127 | LSB |
| 00111000 | 38 | 56 | Undefined | 0-127 | LSB |
| 00111001 | 39 | 57 | Undefined | 0-127 | LSB |
| 00111010 | 3A | 58 | Undefined | 0-127 | LSB |
| 00111011 | 3B | 59 | Undefined | 0-127 | LSB |
| 00111100 | 3C | 60 | Undefined | 0-127 | LSB |
| 00111101 | 3D | 61 | Undefined | 0-127 | LSB |
| 00111110 | 3E | 62 | Undefined | 0-127 | LSB |
| 00111111 | 3F | 63 | Undefined | 0-127 | LSB |
| 01000000 | 40 | 64 | * Damper pedal on/off (Sustain) | <63=off | >64=on |
| 01000001 | 41 | 65 | Portamento on/off | <63=off | >64=on |
| 01000010 | 42 | 66 | Sustenuto on/off | <63=off | >64=on |
| 01000011 | 43 | 67 | Soft pedal on/off | <63=off | >64=on |
| 01000100 | 44 | 68 | Legato Footswitch | <63=off | >64=on |
| 01000101 | 45 | 69 | Hold 2 | <63=off | >64=on |
| 01000110 | 46 | 70 | Sound Controller 1 (Sound Variation) | 0-127 | LSB |
| 01000111 | 47 | 71 | Sound Controller 2 (Timbre) | 0-127 | LSB |
| 01001000 | 48 | 72 | Sound Controller 3 (Release Time) | 0-127 | LSB |
| 01001001 | 49 | 73 | Sound Controller 4 (Attack Time) | 0-127 | LSB |
| 01001010 | 4A | 74 | Sound Controller 5 (Brightness) | 0-127 | LSB |
| 01001011 | 4B | 75 | Sound Controller 6 | 0-127 | LSB |
| 01001100 | 4C | 76 | Sound Controller 7 | 0-127 | LSB |
| 01001101 | 4D | 77 | Sound Controller 8 | 0-127 | LSB |
| 01001110 | 4E | 78 | Sound Controller 9 | 0-127 | LSB |
| 01001111 | 4F | 79 | Sound Controller 10 | 0-127 | LSB |
| 01010000 | 50 | 80 | General Purpose Controller #5 | 0-127 | LSB |
| 01010001 | 51 | 81 | General Purpose Controller #6 | 0-127 | LSB |
| 01010010 | 52 | 82 | General Purpose Controller #7 | 0-127 | LSB |
| 01010011 | 53 | 83 | General Purpose Controller #8 | 0-127 | LSB |
| 01010100 | 54 | 84 | Portamento Control | 0-127 | Source Note |
| 01010101 | 55 | 85 | Undefined | 0-127 | LSB |
| 01010110 | 56 | 86 | Undefined | 0-127 | LSB |
| 01010111 | 57 | 87 | Undefined | 0-127 | LSB |
| 01011000 | 58 | 88 | Undefined | 0-127 | LSB |
| 01011001 | 59 | 89 | Undefined | 0-127 | LSB |
| 01011010 | 5A | 90 | Undefined | 0-127 | LSB |
| 01011011 | 5B | 91 | Effects 1 Depth | 0-127 | LSB |
| 01011100 | 5C | 92 | Effects 2 Depth | 0-127 | LSB |
| 01011101 | 5D | 93 | Effects 3 Depth | 0-127 | LSB |
| 01011110 | 5E | 94 | Effects 4 Depth | 0-127 | LSB |
| 01011111 | 5F | 95 | Effects 5 Depth | 0-127 | LSB |
| 01100000 | 60 | 96 | Data entry +1 | N/A | |
| 01100001 | 61 | 97 | Data entry -1 | N/A | |
| 01100010 | 62 | 98 | Non-Registered Parameter Number LSB | 0-127 | LSB |
| 01100011 | 63 | 99 | Non-Registered Parameter Number MSB | 0-127 | MSB |
| 01100100 | 64 | 100 | * Registered Parameter Number LSB | 0-127 | LSB |
| 01100101 | 65 | 101 | * Registered Parameter Number MSB | 0-127 | MSB |
| 01100110 | 66 | 102 | Undefined | ? | |
| 01100111 | 67 | 103 | Undefined | ? | |
| 01101000 | 68 | 104 | Undefined | ? | |
| 01101001 | 69 | 105 | Undefined | ? | |
| 01101010 | 6A | 106 | Undefined | ? | |
| 01101011 | 6B | 107 | Undefined | ? | |
| 01101100 | 6C | 108 | Undefined | ? | |
| 01101101 | 6D | 109 | Undefined | ? | |
| 01101110 | 6E | 110 | Undefined | ? | |
| 01101111 | 6F | 111 | Undefined | ? | |
| 01110000 | 70 | 112 | Undefined | ? | |
| 01110001 | 71 | 113 | Undefined | ? | |
| 01110010 | 72 | 114 | Undefined | ? | |
| 01110011 | 73 | 115 | Undefined | ? | |
| 01110100 | 74 | 116 | Undefined | ? | |
| 01110101 | 75 | 117 | Undefined | ? | |
| 01110110 | 76 | 118 | Undefined | ? | |
| 01110111 | 77 | 119 | Undefined | ? | |
| 01111000 | 78 | 120 | All Sound Off | 0 | |
| 01111001 | 79 | 121 | * Reset All Controllers | 0 | |
| 01111010 | 7A | 122 | Local control on/off | 0=off | 127=on |
| 01111011 | 7B | 123 | * All notes off | 0 | |
| 01111100 | 7C | 124 | Omni mode off (+ all notes off) | 0 | |
| 01111101 | 7D | 125 | Omni mode on (+ all notes off) | 0 | |
| 01111110 | 7E | 126 | Poly mode on/off (+ all notes off) | ** | |
| 01111111 | 7F | 127 | Poly mode on (incl mono=off +all notes off) | 0 |
This table lists all MIDI Note Numbers by octave.
The absolute octave number designations are based on Middle C = C4, which is an arbitrary but widely used assignment.
| Octave # | Note Numbers | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| C | C# | D | D# | E | F | F# | G | G# | A | A# | B | |
| -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 0 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 1 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
| 2 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |
| 3 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |
| 4 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |
| 5 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 |
| 6 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 |
| 7 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 |
| 8 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 |
| 9 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 |
The General MIDI instrument sounds are grouped by families. In each family are 8 specific instruments.
| PC# | Family | PC# | Family |
|---|---|---|---|
| 1-8 | Piano | 65-72 | Reed |
| 9-16 | Chromatic Percussion | 73-80 | Pipe |
| 17-24 | Organ | 81-88 | Synth Lead |
| 25-32 | Guitar | 89-96 | Synth Pad |
| 33-40 | Bass | 97-104 | Synth Effects |
| 41-48 | Strings | 105-112 | Ethnic |
| 49-56 | Ensemble | 113-120 | Percussive |
| 57-64 | Brass | 121-128 | Sound Effects |
Note: While GM does not define the actual characteristics of any sounds, the names in parentheses after each of the synth leads, pads, and sound effects are, in particular, intended only as guides.
| PC# | Instrument | PC# | Instrument |
|---|---|---|---|
| 1. | Acoustic Grand Piano | 65. | Soprano Sax |
| 2. | Bright Acoustic Piano | 66. | Alto Sax |
| 3. | Electric Grand Piano | 67. | Tenor Sax |
| 4. | Honky-tonk Piano | 68. | Baritone Sax |
| 5. | Electric Piano 1 (Rhodes Piano) | 69. | Oboe |
| 6. | Electric Piano 2 (Chorused Piano) | 70. | English Horn |
| 7. | Harpsichord | 71. | Bassoon |
| 8. | Clavinet | 72. | Clarinet |
| 9. | Celesta | 73. | Piccolo |
| 10. | Glockenspiel | 74. | Flute |
| 11. | Music Box | 75. | Recorder |
| 12. | Vibraphone | 76. | Pan Flute |
| 13. | Marimba | 77. | Blown Bottle |
| 14. | Xylophone | 78. | Shakuhachi |
| 15. | Tubular Bells | 79. | Whistle |
| 16. | Dulcimer (Santur) | 80. | Ocarina |
| 17. | Drawbar Organ (Hammond) | 81. | Lead 1 (square wave) |
| 18. | Percussive Organ | 82. | Lead 2 (sawtooth wave) |
| 19. | Rock Organ | 83. | Lead 3 (calliope) |
| 20. | Church Organ | 84. | Lead 4 (chiffer) |
| 21. | Reed Organ | 85. | Lead 5 (charang) |
| 22. | Accordion (French) | 86. | Lead 6 (voice solo) |
| 23. | Harmonica | 87. | Lead 7 (fifths) |
| 24. | Tango Accordion (Band neon) | 88. | Lead 8 (bass + lead) |
| 25. | Acoustic Guitar (nylon) | 89. | Pad 1 (new age Fantasia) |
| 26. | Acoustic Guitar (steel) | 90. | Pad 2 (warm) |
| 27. | Electric Guitar (jazz) | 91. | Pad 3 (polysynth) |
| 28. | Electric Guitar (clean) | 92. | Pad 4 (choir space voice) |
| 29. | Electric Guitar (muted) | 93. | Pad 5 (bowed glass) |
| 30. | Overdriven Guitar | 94. | Pad 6 (metallic pro) |
| 31. | Distortion Guitar | 95. | Pad 7 (halo) |
| 32. | Guitar harmonics | 96. | Pad 8 (sweep) |
| 33. | Acoustic Bass | 97. | FX 1 (rain) |
| 34. | Electric Bass (fingered) | 98. | FX 2 (soundtrack) |
| 35. | Electric Bass (picked) | 99. | FX 3 (crystal) |
| 36. | Fretless Bass | 100. | FX 4 (atmosphere) |
| 37. | Slap Bass 1 | 101. | FX 5 (brightness) |
| 38. | Slap Bass 2 | 102. | FX 6 (goblins) |
| 39. | Synth Bass 1 | 103. | FX 7 (echoes, drops) |
| 40. | Synth Bass 2 | 104. | FX 8 (sci-fi, star theme) |
| 41. | Violin | 105. | Sitar |
| 42. | Viola | 106. | Banjo |
| 43. | Cello | 107. | Shamisen |
| 44. | Contrabass | 108. | Koto |
| 45. | Tremolo Strings | 109. | Kalimba |
| 46. | Pizzicato Strings | 110. | Bag pipe |
| 47. | Orchestral Harp | 111. | Fiddle |
| 48. | Timpani | 112. | Shanai |
| 49. | String Ensemble 1 (strings) | 113. | Tinkle Bell |
| 50. | String Ensemble 2 (slow strings) | 114. | Agogo |
| 51. | SynthStrings 1 | 115. | Steel Drums |
| 52. | SynthStrings 2 | 116. | Woodblock |
| 53. | Choir Aahs | 117. | Taiko Drum |
| 54. | Voice Oohs | 118. | Melodic Tom |
| 55. | Synth Voice | 119. | Synth Drum |
| 56. | Orchestra Hit | 120. | Reverse Cymbal |
| 57. | Trumpet | 121. | Guitar Fret Noise |
| 58. | Trombone | 122. | Breath Noise |
| 59. | Tuba | 123. | Seashore |
| 60. | Muted Trumpet | 124. | Bird Tweet |
| 61. | French Horn | 125. | Telephone Ring |
| 62. | Brass Section | 126. | Helicopter |
| 63. | SynthBrass 1 | 127. | Applause |
| 64. | SynthBrass 2 | 128. | Gunshot |
On MIDI Channel 10, each MIDI Note number ("Key#") corresponds to a different drum sound, as shown below. GM-compatible instruments must have the sounds on the keys shown here. While many current instruments also have additional sounds above or below the range show here, and may even have additional "kits" with variations of these sounds, only these sounds are supported by General MIDI.
| Key# | Note | Drum Sound | Key# | Note | Drum Sound |
|---|---|---|---|---|---|
| 35 | B1 | Acoustic Bass Drum | 59 | B3 | Ride Cymbal 2 |
| 36 | C2 | Bass Drum 1 | 60 | C4 | Hi Bongo |
| 37 | C#2 | Side Stick | 61 | C#4 | Low Bongo |
| 38 | D2 | Acoustic Snare | 62 | D4 | Mute Hi Conga |
| 39 | D#2 | Hand Clap | 63 | D#4 | Open Hi Conga |
| 40 | E2 | Electric Snare | 64 | E4 | Low Conga |
| 41 | F2 | Low Floor Tom | 65 | F4 | High Timbale |
| 42 | F#2 | Closed Hi Hat | 66 | F#4 | Low Timbale |
| 43 | G2 | High Floor Tom | 67 | G4 | High Agogo |
| 44 | G#2 | Pedal Hi-Hat | 68 | G#4 | Low Agogo |
| 45 | A2 | Low Tom | 69 | A4 | Cabasa |
| 46 | A#2 | Open Hi-Hat | 70 | A#4 | Maracas |
| 47 | B2 | Low-Mid Tom | 71 | B4 | Short Whistle |
| 48 | C3 | Hi Mid Tom | 72 | C5 | Long Whistle |
| 49 | C#3 | Crash Cymbal 1 | 73 | C#5 | Short Guiro |
| 50 | D3 | High Tom | 74 | D5 | Long Guiro |
| 51 | D#3 | Ride Cymbal 1 | 75 | D#5 | Claves |
| 52 | E3 | Chinese Cymbal | 76 | E5 | Hi Wood Block |
| 53 | F3 | Ride Bell | 77 | F5 | Low Wood Block |
| 54 | F#3 | Tambourine | 78 | F#5 | Mute Cuica |
| 55 | G3 | Splash Cymbal | 79 | G5 | Open Cuica |
| 56 | G#3 | Cowbell | 80 | G#5 | Mute Triangle |
| 57 | A3 | Crash Cymbal 2 | 81 | A5 | Open Triangle |
| 58 | A#3 | Vibraslap |
Here are some of the routines to read and write variable-length numbers in MIDI Files. These routines are in C, and use getc and putc, which read and write single 8-bit characters from/to the files infile and outfile.
WriteVarLen(value)
register long value;
{
register long buffer;
buffer = value & 0x7f;
while((value >>= 7) > 0)
{
buffer <<= 8;
buffer |= 0x80;
buffer += (value &0x7f);
}
while (TRUE)
{
putc(buffer,outfile);
if(buffer & 0x80) buffer >>= 8;
else
break;
}
}
doubleword ReadVarLen()
{
register doubleword value;
register byte c;
if((value = getc(infile)) & 0x80)
{
value &= 0x7f;
do
{
value = (value << 7) + ((c = getc(infile))) & 0x7f);
} while (c & 0x80);
}
return(value);
}
As an example, MIDI Files for the following excerpt are shown
below. First, a format 0 file is shown, with all information
intermingled; then, a format 1 file is shown with all data
separated into four tracks: one for tempo and time signature, and
three for the notes. A resolution of 96 "ticks" per
quarter note is used. A time signature of 4/4 and a tempo of 120,
though implied, are explicitly stated.
The contents of the MIDI stream represented by this example
are broken down here:
| Delta-Time (decimal) | Event-Code (hex) | Other Bytes (decimal) | Comment |
|---|---|---|---|
| 0 | FF 58 | 04 04 02 24 08 | 4 bytes; 4/4 time; 24 MIDI clocks/click, 8 32nd notes/ 24 MIDI clocks (24 MIDI clocks = 1 crotchet = 1 beat) |
| 0 | FF 51 | 03 500000 | 3 bytes: 500,000 usec/ quarter note = 120 beats/minute |
| 0 | C0 | 5 | Ch.1 Program Change 5 = GM Patch 6 = Electric Piano 2 |
| 0 | C1 | 46 | Ch.2 Program Change 46 = GM Patch 47 = Harp |
| 0 | C2 | 70 | Ch.3 Program Change 70 = GM Patch 71 = Bassoon |
| 0 | 92 | 48 96 | Ch.3 Note On C3, forte |
| 0 | 92 | 60 96 | Ch.3 Note On C4, forte |
| 96 | 91 | 67 64 | Ch.2 Note On G4, mezzo-forte |
| 96 | 90 | 76 32 | Ch.1 Note On E5, piano |
| 192 | 82 | 48 64 | Ch.3 Note Off C3, standard |
| 0 | 82 | 60 64 | Ch.3 Note Off C4, standard |
| 0 | 81 | 67 64 | Ch.2 Note Off G4, standard |
| 0 | 80 | 76 64 | Ch.1 Note Off E5, standard |
| 0 | FF 2F | 00 | Track End |
| 4D 54 68 64 | MThd |
| 00 00 00 06 | chunk length |
| 00 00 | format 0 |
| 00 01 | one track |
| 00 60 | 96 per quarter-note |
| 4D 54 72 6B | MTrk |
| 00 00 00 3B | chunk length (59) |
| Delta-Time | Event | Comments |
|---|---|---|
| 00 | FF 58 04 04 02 18 08 | time signature |
| 00 | FF 51 03 07 A1 20 | tempo |
| 00 | C0 05 | |
| 00 | C1 2E | |
| 00 | C2 46 | |
| 00 | 92 30 60 | |
| 00 | 3C 60 | running status |
| 60 | 91 43 40 | |
| 60 | 90 4C 20 | |
| 81 40 | 82 30 40 | two-byte delta-time |
| 00 | 3C 40 | running status |
| 00 | 81 43 40 | |
| 00 | 80 4C 40 | |
| 00 | FF 2F 00 | end of track |
| 4D 54 68 64 | MThd |
| 00 00 00 06 | chunk length |
| 00 01 | format 1 |
| 00 04 | four tracks |
| 00 60 | 96 per quarter note |
| 4D 54 72 6B | MTrk |
| 00 00 00 14 | chunk length (20) |
| Delta-Time | Event | Comments |
|---|---|---|
| 00 | FF 58 04 04 02 18 08 | time signature |
| 00 | FF 51 03 07 A1 20 | tempo |
| 83 00 | FF 2F 00 | end of track |
| 4D 54 72 6B | MTrk |
| 00 00 00 10 | chunk length (16) |
| Delta-Time | Event | Comments |
|---|---|---|
| 00 | C0 05 | |
| 81 40 | 90 4C 20 | |
| 81 40 | 4C 00 | Running status: note on, vel=0 |
| 00 FF 2F 00 |
| 4D 54 72 6B | MTrk |
| 00 00 00 0F | chunk length (15) |
| Delta-Time | Event | Comments |
|---|---|---|
| 00 | C1 2E | |
| 60 | 91 43 40 | |
| 82 20 | 43 00 | running status |
| 00 | FF 2F 00 | end of track |
| 4D 54 72 6B | MTrk |
| 00 00 00 15 | chunk length (21) |
| Delta-Time | Event | Comments |
|---|---|---|
| 00 | C2 46 | |
| 00 | 92 30 60 | |
| 00 | 3C 60 | running status |
| 83 00 | 30 00 | two-byte delta-time, running status |
| 00 | 3C 00 | running status |
| 00 | FF 2F 00 | end of track |


Sharing functions between users
It is easy to share your code with other VPL users, and just as easy
to have them share code with you.
The user JPM has defined a variable X and a function FIRST-GENES-OF.
The variable X, set at 14, is on the blue VARIABLES menu in the palette.
The function FIRST-GENES-OF takes two arguments, a NUMBER and an ORGANISM,
and returns the first NUMBER of genes in ORGANISM. It can be found in the
blue FUNCTIONS menu in the palette.
The user JPM tells his buddy MDS that these new things he has defined
have been very helpful to him, and decides to share the variable
X and the function FIRST-GENES-OF. He brings down
OTHER-COMMANDS --> SHARE from the palette.
A set of functions and variables that one makes available for sharing
is called a package, and each package needs a name.
JPM calls his package "jp-stuff" by entering the name into the 'name' box.
To indicate which functions and variables to share, JPM mouses over
the green 'Options' arrow, bringing up a menu with 4 options:
FUNCTIONS, VARIABLES, DOCSTRING, and REMOVE.
Clicking on the FUNCTIONS and VARIABLES options adds 2 blue subboxes to the
SHARE box.
Since JPM has only one function and one variable, he can just type
their names into the boxes. If he wanted to share more than one,
he would have to type in a list of functions. To illustrate,
JPM will type X into the VARIABLES box, and a list containing
FIRST-GENES-OF into the FUNCTIONS box. He will also add some
documentation using the DOCSTRING option from the green 'Options' arrow.
After JPM executes the share box, he tells his friend MDS.
MDS logs onto his own VPL and selects from the palette
FILE --> User Contributed Stuff
This brings up a popup window with all the
user contributed packages, along with what functions, variables, and
documentation they contain.
After MDS clicks on the 'Use this package' link, the variable
X is added to his VARIABLES palette menu, and the function FIRST-GENES-OF
is added to his FUNCTIONS palette menu. Now MDS can use JPM's variable
and function!
Once MDS is done using JPM's code, he can stop sharing it by bringing down
OTHER-COMMANDS --> UNSHARE from the palette and typing the package name
into the 'name' box.
On the other hand, if JPM decides he doesn't want to share his code anymore,
he can bring down OTHER-COMMANDS --> SHARE, type in the name of the package
he wishes to forbid others from using, and select 'REMOVE' from the
green 'Options' arrow.
Collaboration between users is a good thing, and the VPL's SHARE command
is a great way to do it.


--- layout: admin ---
Parsley is a javascript form validation library. It helps you provide your users with feedback on their form submission before sending it to your server.
Parsley is a javascript form validation library. It helps you provide your users with feedback on their form submission before sending it to your server.
Parsley is a javascript form validation library. It helps you provide your users with feedback on their form submission before sending it to your server.
Parsley is a javascript form validation library. It helps you provide your users with feedback on their form submission before sending it to your server.


Fundamental HTML elements styled and enhanced with extensible classes.
| 我的梦想 | 习惯一 | 要事一 | |||
| 短期目标 | 习惯二 | 要事二 | |||
| 梦想实践 | 习惯三 | 要事三 | |||
| 沟通 | 特别日子 | 家人 | |||
| 输出 | 天气心情 | 小孩 | |||
| 时间管理 | 起床 | 朋友 | |||
| 开心事 | 睡觉 | 同事 | |||
| 阅读 | 总结提升 | 身体状态 | |||
| 每周书 | 思考感悟 | 锻炼 | |||
| 读书感想 | 帮助别人 | 生活充实 |
For basic styling—light padding and only horizontal dividers—add the base class .table
to any

.
| # | First Name | Last Name | Username |
|---|---|---|---|
| 1 | Mark | Otto | @mdo |
| 2 | Jacob | Thornton | @fat |
| 3 | Larry | the Bird |

 …

Add any of the following classes to the .table
base class.
.table-striped
Adds zebra-striping to any table row within the

via the :nth-child
CSS selector (not available in IE7-8).
| # | First Name | Last Name | Username |
|---|---|---|---|
| 1 | Mark | Otto | @mdo |
| 2 | Jacob | Thornton | @fat |
| 3 | Larry | the Bird |

 …

.table-bordered
Add borders and rounded corners to the table.
| # | First Name | Last Name | Username |
|---|---|---|---|
| 1 | Mark | Otto | @mdo |
| Mark | Otto | @TwBootstrap | |
| 2 | Jacob | Thornton | @fat |
| 3 | Larry the Bird |

 …

.table-hover
Enable a hover state on table rows within a

.
| # | First Name | Last Name | Username |
|---|---|---|---|
| 1 | Mark | Otto | @mdo |
| 2 | Jacob | Thornton | @fat |
| 3 | Larry the Bird |

 …

.table-condensed
Makes tables more compact by cutting cell padding in half.
| # | First Name | Last Name | Username |
|---|---|---|---|
| 1 | Mark | Otto | @mdo |
| 2 | Jacob | Thornton | @fat |
| 3 | Larry the Bird |

 …

Use contextual classes to color table rows.
| Class | Description |
|---|---|
.success
|
Indicates a successful or positive action. |
.error
|
Indicates a dangerous or potentially negative action. |
.warning
|
Indicates a warning that might need attention. |
.info
|
Used as an alternative to the default styles. |
| # | Product | Payment Taken | Status |
|---|---|---|---|
| 1 | TB - Monthly | 01/04/2012 | Approved |
| 2 | TB - Monthly | 02/04/2012 | Declined |
| 3 | TB - Monthly | 03/04/2012 | Pending |
| 4 | TB - Monthly | 04/04/2012 | Call in to confirm |
...
 1	 TB - Monthly	 01/04/2012	 Approved
 ...
List of supported table HTML elements and how they should be used.
| Tag | Description |
|---|---|

|
Wrapping element for displaying data in a tabular format |

|
Container element for table header rows (
 ) to label table columns
|

|
Container element for table rows (
 ) in the body of the table
|

|
Container element for a set of table cells ( or  ) that appears on a single row
|

|
Default table cell |

|
Special table cell for column (or row, depending on scope and placement) labels |

|
Description or summary of what the table holds, especially useful for screen readers |

...

 ...	 ...

 ...	 ...


blowout.Blowout.update_water_data¶
-
Blowout.
update_water_data
(self, water)[source]¶ Change the ambient temperature and salinity profile data
- Parameters
- watervarious
Data describing the ambient water temperature and salinity profile. See Notes below for details.
Notes
The ambient water column data can be provided through several different options. The water variable contains temperature and salinity data. The user may define the water in the following ways:
- waterNone
Indicates that we have no information about the ambient temperature or salinity. In this case, the model will import data for the world-ocean average.
- waterdict
If we only know the water temperature and salinity at the surface, this may be passed through a dictionary with keywords temperature and salinity. In this case, the model will import data for the world-ocean average and adjust the data to have the given temperature and salinity at the surface.
- water‘netCDF4.Dataset’
If a ‘netCDF4.Dataset’ object already contains the ambient CTD data in a format appropriate for the ambient.Profile object, then this can be passed. In this case, it is assumed that the dataset includes the currents; hence, the currents variable will be ignored.
- waterambient.Profile object
If we already created our own ambient Profile object, then this object can be used directly.
- water = str
If we stored the water column profile in a file, we may provide the file path to this file via the string stored in water. If this string ends in ‘.nc’, it is assumed that this file contains a netCDF4 dataset. Otherwise, this file should contain columns in the following order: depth (m), temperature (deg C), salinity (psu), velocity in the x-direction (m/s), velocity in the y-direction (m/s). Since this option includes the currents, the current variable will be ignored in this case. A comment string of # may be used in the text file.


{# This is a Jinja2 comment #} {# These assets must be included in the final output, or the page will be broken #}


{{ 'settings.keys.download_key_description' | translate }}
Please enter your account password to continue
After deleted this key, you will not be able to decrypt any message that was encrypted with this key. It may lead to data loss.
Please enter your account password to continue.
Please type CTEMPLAR to confirm.
After changed the primary key, all of messages with this alias will be encrypted with this key. Primary key will always be placed in the top of the key list. Are you sure you want to continue?
{{ 'settings.manage_autocrypt_description' | translate }}
{{ 'settings.security.attach_public_key_tooltip' | translate }}
{{ 'settings.security.sign_message_tooltip' | translate }}


CdpSdk
public final class CdpSdk : NSObject, CoreModule, AuthenticatorChangeObserver
This class provides CDP Software Development Kit feature access and integration point.
-
Shared CdpSdk Instance
Declaration
Swift
@objc public static var shared: CdpSdk { get }
-
Core Module configuration (modules must initialize with a config that extends from CoreModuleConfig)
Declaration
Swift
public var coreModuleConfig: CoreModuleConfig
-
Core Components
Declaration
Swift
public var _coreComponents: CoreComponents?
-
CdpSdk configuration
Declaration
Swift
public let config: CdpConfig
-
Current state of the CdpSdk instance
Declaration
Swift
@objc public var state: String { get }
-
Consent status
Declaration
Swift
@objc public var consent: Consent { get set }
-
Sets Location tracking for given coordinates with expiration time.
Declaration
Swift
@objc public func setLocation(coordinates: Coordinates?, expiresIn: Int)
Parameters
coordinates
instance of (Coordinates)
expiresIn
expiration time in seconds
-
Sets Log Level.
Declaration
Swift
@objc public class func setLogLevel(_ logLevel: MCLogLevel, logOutputter: LogOutputter)
Parameters
logLevel
defines depth of detail in log output using MCLogLevel
logOutputter
defines log output using LogOutputter


question: customer technical support was quick and responsive.
strongly
disagree
neutral
strongly
agree


--- layout: default title: Past Workshops permalink: /previous/ feature-img: "assets/img/linked-list.png" tags: [Workshops] hide: false ---
{{ post.date | date: "%B %-d, %Y" }}


TODO
Todo
Calendar
Previous month
Tasks for
July 2016
Next month
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
11


SPG cover removal part of politics, keeps happening: Priyanka Gandhi
Speaking with India Today TV, Priyanka Gandhi said, "SPG parr rajneeti hoti rehti hai. Bahot arthik mandi hai isliye hum rally kar rahe hai [Politics keeps happening on the SPG, we are protesting against economic slowdown]"
by Mausami SinghCongress General Secretary Priyanka Gandhi Vadra said on Thursday that the removal of the elite Special Protection Group (SPG) cover was a part of the politics which, she said, "keeps happening".
On November 8, the SPG cover given to Congress president Sonia Gandhi and her children Rahul and Priyanka was withdrawn and the family was instead provided Z-plus security by the CRPF.
Speaking with India Today TV, Priyanka Gandhi said, "SPG parr rajneeti hoti rehti hai. Bahot arthik mandi hai isliye hum rally kar rahe hai [Politics keeps happening on the SPG, we are protesting against economic slowdown]"
The decision to withdraw SPG cover given to the family of former Prime Minister Rajiv Gandhi, who was assassinated by LTTE terrorists on May 21, 1991, was taken after a detailed security assessment.
With this decision, the nearly 3,000 strong force would now only be guarding Prime Minister Narendra Modi.
An official said security cover for all VIP is reviewed periodically and recommendations are made based on threat perceptions by various security agencies in the country.
"The Gandhi family continues to have Z-plus security cover," a home ministry official said.
Giving reasons for the decision, another home ministry official said the threat perception has reduced and the Gandhi family "no longer faces serious security threats".
Reacting to the development, Rajasthan Chief Minister Ashok Gehlot hit out at the Bharatiya Janata Party (BJP) government at the Centre and termed it "a planned conspiracy".
Seeking to know the "logic and reason" behind the move, Gehlot said sometime back the SPG had warned of threats to Rahul Gandhi from the Naxals, extremists and terror groups like Al-Qaeda.
Hundreds of Congress youth-wing members on Wednesday descended on the streets in central Delhi and burnt an effigy of Home Minister Amit Shah to protest the withdrawal of SPG security cover of the Gandhi family.
(With PTI inputs)


Technology / Software / Analysis
(Currently in Microsoft Systems and Software Academy - Cloud Application Developer)
I am a disciplined creative who enjoys solving complex situations to inform and support others. I am transitioning from my role as an intelligence analyst in the military to capitalize on my management experience and interest in software design in the technological sector.


Hello everyone! As you know I am Anmol, I was born in Amritsar, India. As a kid, and still till this day, I am enthralled by the technology and its exploration. I am Jack of all trades, studying Computer Engineering at Indian Institute Of Information Technology, Allahabad.
I am intrigued by the way humans interact with each other and how technology directly affects our interactions. What is most important to me is that I want to positively impact the lives of millions of people through the use of technology that I might help build. So, I am a typical engineer, studying all the "great" courses in university as well as essential technical skills!
I am an avid reader. Computers are my first love and I've formed a strong bond with them. Code, Coffee, and Books perfectly delineate my lifestyle.
Shoot for the moon. Even if you miss, you'll land among the stars


Recipe title: {{recipe.title}}
Current Step: {{currentStep}}
Total Duration: {{totalTime}}
Started on {{ recipePlay.startedOn | date: 'medium' }}
Recipe title: {{recipe.title}}
Current Step: Finished
Total Duration: {{totalTime}}
Started on {{ recipePlay.startedOn | date: 'medium' }}


Together we can deliver innovative solutions for your own organization or across the 48 thousand companies who use SAP Concur for travel booking, expense reporting, and accounts payable processes. What can we help you build today?


1.1.4 (November 28, 2008)
Factory.build now uses Factory.create for associations of the built object Factory definitions are now detected in subdirectories, such as factories/person_factory.rb (thanks to Josh Nichols) Factory definitions are now loaded after the environment in a Rails project (fixes some issues with dependencies being loaded too early) (thanks to Josh Nichols) Factory names ending in 's' no longer cause problems (thanks to Alex Sharp and Josh Owens)
1.1.3 (September 12, 2008)
Automatically pull in definitions from factories.rb, test/factories.rb, or spec/factories.rb
1.1.2 (July 30, 2008)
Improved error handling for invalid and undefined factories/attributes Improved handling of strings vs symbols vs classes Added a prettier syntax for handling associations Updated documentation and fixed compatibility with Rails 2.1
1.1.1 (June 23, 2008)
The attribute "name" no longer requires using #add_attribute
1.1.0 (June 3, 2008)
Added support for dependent attributes Fixed the attributes_for build strategy to not build associations Added support for sequences
1.0.0 (May 31, 208)
First version


The census is taken every ten years, the growth of Vermont since the first census in 1791 is pronounced and the changes first in the south, then across the state and finally a rapid rise of Chittenden county is clear.
When viewed as a line the trends become much more obcious. In 1940 Chittenden County starts to grow in leaps and bounds over the rest of the state.


{% if request.user in team.participants.all and not showcase and team.hackathon.status == 'hack_in_progress' %}
{% endif %}
{% if showcase.showcase_image %}
{% elif team.project.project_image %}
{% else %}
{% endif %}
{% if request.user in team.participants.all and not showcase %}
{% if team.hackathon.status == 'hack_in_progress' %}
Edit Project
{% elif team.project and team.hackathon.status == 'finished' %}
Edit Project
{% elif team.hackathon.status == 'judging' %}
Judging in progress, you cannot edit your project anymore.


:: com :: sun :: star :: configuration :: backend ::
|
| service UpdatableLayer |
- Description
- provides read/write access to a configuration data layer.
A layer contains the configuration setting changes to be performed
on a default layer (or schema) to obtain the values of those settings
for a given entity and component.
An updatable layer can be read or replaced with another layer.
- Since
- OOo 1.1.2
|
| Included Services - Summary |
| Layer |
handles read access to the contents of the layer.
(details)
|
| Included Services - Details |
Layer
- Description
- handles read access to the contents of the layer.
If the implementation supports
::com::sun::star::util::XTimeStamped,
then after executing XUpdatableLayer::replaceWith()
the timestamp will be the one for the replaced contents and
if reading after updates is supported the next read will reproduce the
replaced data.
|
|
| Exported Interfaces - Details |
XUpdatableLayer
- Description
- provides write access to the contents of the layer.
Depending of the actual type (simple, i.e pure XLayer or
composite, i.e XCompositeLayer) of the current layer and
the provided replacement layer, the operation performed
by XUpdatableLayer::replaceWith(), will vary.
For the different current/replacement layer combinations, we have:
- Simple/Simple
-
- the provided layer's contents replace the current one's.
- Composite/Composite
-
- all layers (main and sub) present in the
provided layer are used to replace the corresponding current
layer contents. Sublayers present in the current layer but
not in the provided one are left untouched. Sublayers present
in the provided layer but not in the current one are added to
the current layer.
- Simple/Composite
-
- the main layer and sublayers of the provided layer
are merged into one whose contents replace the current layer.
- Composite/Simple
-
- the provided layer is split into a composite one whose contents
are then used to replace the current layer as described above.
Not all implementations of XUpdatableLayer
support conversions of the replacement layer.
In such a case the sublayers of the provided layer may be ignored
or all simple data be merged into the main layer.
|
|
Top of Page
Copyright © 2013, The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the Apache feather logo, Apache OpenOffice and OpenOffice.org are trademarks of The Apache Software Foundation. Other names may be trademarks of their respective owners.


Learning to do & doing to learn!
I want to talk a bit about my background (you can also read my blog posts where I will dive into details about my interests in technology and software). My name is Amar Bessedik, I graduated from West Chester University of Pennsylvania (WCUPA) in May 2018. Before saying more about my experience as a graduate student in the USA, I first immigrated to Belgium in late 2008 from Algeria after graduation with a Computer Science Engineering Degree. By that I was hoping to continue my graduate studies at the Free University of Brussels (ULB) to enhance my skills in the Computer Science field. Unfortunately, things did not go as I planned with regards to funding! Then I immigrated to the USA in the summer of 2010 where I first got into a Graduate Certificate in Web Technology Program at WCUPA (Fall 2014). I aimed to get exposure to the current web technologies and programming practices. All the courses I took were graduate level courses which are transferable to the Master's program, but the more I studied for my Certificate Degree the more I felt I was not prepared to enter the professional world just yet. Upon successful completion of my Certificate Degree (Fall 2016), I applied and got into to the Master's Program. I graduated and I am finally satisfied with my education.
My objective is to proffessionally master my own craft, I want to deliver the best of me in the software industry and I am aiming to be very successful. I want especially to master Database systems design, learn and apply the best software Engineering practices, learn and apply my skills using web technologies. I am also intrested in mobile development as most business is done online and people are reacheable through their handheld devices. Everyone has a story, I told mine and I would like it to be as my compass in the way to the next level of my journey.
public class Objective
{
public static void main(String[] args){
Me myself = new Me();
transform(myself);
}//end main
public class Me{
private background;
public Me(next)
{
this.background = next;
}
//magic function
public Me transform(Me x)
{
return (guru)x;
}
}//end class


Parser package
The Parser package extends the Core View class to be able to use any type of template parser you want.
Introduction
The Parser package changes nothing about the way you work with Views, but it will allow you to use any template parser you want instead of PHP. The package comes with many drivers for parsers like Dwoo, Haml, Jade, Lex, Markdown, Mustache, PHPTal, Smarty and Twig.
Which parser is used is determined by the file extension of your view file. Normal views, parsed by PHP use the file extension .php. This is also the default, if no extension is specified, it is assumed to have the .php extension.
All others have their own specific extension, for example foo.mustache will use the Mustache driver, foo.tpl will use the Dwoo driver, foo.lex will use the Lex driver, and so on. The default extension can be changed in config).
Installation
The Parser package is included in the Fuel download. To use it you must first enable it by adding it to your config:
'always_load' => array(
'packages' => array(
'parser',
),
),
To be able to use one of the supported parsers, you need to install them via composer. Simply add the libraries to your project's composer.json then run php composer.phar install:
{
"require": {
"dwoo/dwoo" : "*",
"mustache/mustache" : "*",
"smarty/smarty" : "*",
"twig/twig" : "*",
"mthaml/mthaml": "*",
"pyrocms/lex": "*"
}
}
Note that the Markdown parser is installed by default, as it is also used by the FuelPHP core class Markdown.
Libraries that can not be installed through composer are expected to be installed in APPPATH/vendor/lib_name (capitalize lib_name), and you'll have to download them yourself. Don't change the casing or anything, keep it as much original as possible within the vendor/lib_name dir to keep updating easy (also because some come with their own autoloader).
Configuration
Parser can be configured in a config/parser.php file and takes the following keys:
| Param | Type | Default | Description |
|---|---|---|---|
| extensions | array | (array with extensions and View class which parses them) |
Defines which extensions are valid and what their View driver is. ex: 'md' => 'View_Markdown' |
For every View driver supported, the configuration file contains a array entry with the same name as the driver, which lists the driver specific configuration (limited to the configuration items supported by the driver. This may be a subset of all configuration the parser supports).
Runtime Configuration
All drivers have a parser() method that will allow you to access the current Parser object. This is a convention and not a requirement and might be different on 3rd party drivers.
// Clear the cache for a specific Smarty template
$view = View::forge('example.smarty');
$view->parser()->clearCache('example.smarty');
// Example static usage
View_Smarty::parser()->clearCache('example.smarty');
This can also be used when you need to pass custom configuration to the driver.


| Top |
| const char * | p11_kit_strerror () |
| const char * | p11_kit_message () |
| char * | p11_kit_space_strdup () |
| size_t | p11_kit_space_strlen () |
| void | p11_kit_be_quiet () |
| void | p11_kit_be_loud () |
const char *
p11_kit_strerror (CK_RV rv
);
Get a message for a PKCS#11 return value or error code. Do not pass CKR_OK or other such non errors to this function.
const char *
p11_kit_message (void
);
Gets the failure message for a recently called p11-kit function, which returned a failure code on this thread. Not all functions set this message. Each function that does so, will note it in its documentation.
If the most recent p11-kit function did not fail, then this will return NULL. The string is owned by the p11-kit library and is only valid on the same thread that the failed function executed on.
char * p11_kit_space_strdup (const unsigned char *string
,size_t max_length
);
In PKCS#11 structures many strings are encoded in a strange way. The string is placed in a fixed length buffer and then padded with spaces.
This function copies the space padded string into a normal null-terminated string. The result is owned by the caller.
1 2 3 4 |
CK_INFO info; char *description; ... description = p11_kit_space_strdup (info->libraryDescription, sizeof (info->libraryDescription)); |
size_t p11_kit_space_strlen (const unsigned char *string
,size_t max_length
);
In PKCS#11 structures many strings are encoded in a strange way. The string is placed in a fixed length buffer and then padded with spaces.
This function determines the actual length of the string. Since the string is not null-terminated you need to pass in the size of buffer as max_length. The string will never be longer than this buffer.
1 2 3 4 |
CK_INFO info; size_t length; ... length = p11_kit_space_strlen (info->libraryDescription, sizeof (info->libraryDescription)); |
void
p11_kit_be_quiet (void
);
Once this function is called, the p11-kit library will no longer print failure or warning messages to stderr.
void
p11_kit_be_loud (void
);
Tell the p11-kit library will print failure or warning messages to stderr.
This is the default behavior, but can be changed using p11_kit_be_quiet()
.


SQLite3 is a popular serverless SQL engine, implemented as a library to be used within other applications. It keeps its databases as regular disk files.
Every database file is segmented into pages. First page (starting at the very beginning) is special: it contains a file-global header which specifies some data relevant to proper parsing (i.e. format versions, size of page, etc). After the header, normal contents of the first page follow.
Each page would be of some type, and generally, they would be
reached via the links starting from the first page. First page type
(root_page
) is always "btree_page".
This page hosts a formal specification of SQLite3 database file using Kaitai Struct. This specification can be automatically translated into a variety of programming languages to get a parsing library.
meta:
id: sqlite3
title: SQLite3 database file
file-extension:
- sqlite
- db
- db3
- sqlite3
xref:
forensicswiki: SQLite_database_format
justsolve: SQLite
loc: fdd000461
pronom: fmt/729
wikidata: Q28600453
license: CC0-1.0
imports:
- /common/vlq_base128_be
endian: be
doc: |
SQLite3 is a popular serverless SQL engine, implemented as a library
to be used within other applications. It keeps its databases as
regular disk files.
Every database file is segmented into pages. First page (starting at
the very beginning) is special: it contains a file-global header
which specifies some data relevant to proper parsing (i.e. format
versions, size of page, etc). After the header, normal contents of
the first page follow.
Each page would be of some type, and generally, they would be
reached via the links starting from the first page. First page type
(`root_page`) is always "btree_page".
doc-ref: https://www.sqlite.org/fileformat.html
seq:
- id: magic
contents: ["SQLite format 3", 0]
- id: len_page_mod
type: u2
doc: |
The database page size in bytes. Must be a power of two between
512 and 32768 inclusive, or the value 1 representing a page size
of 65536.
- id: write_version
type: u1
enum: versions
- id: read_version
type: u1
enum: versions
- id: reserved_space
type: u1
doc: Bytes of unused "reserved" space at the end of each page. Usually 0.
- id: max_payload_frac
type: u1
doc: Maximum embedded payload fraction. Must be 64.
- id: min_payload_frac
type: u1
doc: Minimum embedded payload fraction. Must be 32.
- id: leaf_payload_frac
type: u1
doc: Leaf payload fraction. Must be 32.
- id: file_change_counter
type: u4
- id: num_pages
type: u4
doc: Size of the database file in pages. The "in-header database size".
- id: first_freelist_trunk_page
type: u4
doc: Page number of the first freelist trunk page.
- id: num_freelist_pages
type: u4
doc: Total number of freelist pages.
- id: schema_cookie
type: u4
- id: schema_format
type: u4
doc: The schema format number. Supported schema formats are 1, 2, 3, and 4.
- id: def_page_cache_size
type: u4
doc: Default page cache size.
- id: largest_root_page
type: u4
doc: The page number of the largest root b-tree page when in auto-vacuum or incremental-vacuum modes, or zero otherwise.
- id: text_encoding
type: u4
enum: encodings
doc: The database text encoding. A value of 1 means UTF-8. A value of 2 means UTF-16le. A value of 3 means UTF-16be.
- id: user_version
type: u4
doc: The "user version" as read and set by the user_version pragma.
- id: is_incremental_vacuum
type: u4
doc: True (non-zero) for incremental-vacuum mode. False (zero) otherwise.
- id: application_id
type: u4
doc: The "Application ID" set by PRAGMA application_id.
- id: reserved
size: 20
- id: version_valid_for
type: u4
- id: sqlite_version_number
type: u4
- id: root_page
type: btree_page
instances:
len_page:
value: 'len_page_mod == 1 ? 0x10000 : len_page_mod'
types:
btree_page:
seq:
- id: page_type
type: u1
- id: first_freeblock
type: u2
- id: num_cells
type: u2
- id: ofs_cells
type: u2
- id: num_frag_free_bytes
type: u1
- id: right_ptr
type: u4
if: page_type == 2 or page_type == 5
- id: cells
type: ref_cell
repeat: expr
repeat-expr: num_cells
ref_cell:
seq:
- id: ofs_body
type: u2
instances:
body:
pos: ofs_body
type:
switch-on: _parent.page_type
cases:
0x0d: cell_table_leaf
0x05: cell_table_interior
0x0a: cell_index_leaf
0x02: cell_index_interior
cell_table_leaf:
doc-ref: 'https://www.sqlite.org/fileformat.html#b_tree_pages'
seq:
- id: len_payload
type: vlq_base128_be
- id: row_id
type: vlq_base128_be
- id: payload
size: len_payload.value
type: cell_payload
# TODO: overflow
cell_table_interior:
doc-ref: 'https://www.sqlite.org/fileformat.html#b_tree_pages'
seq:
- id: left_child_page
type: u4
- id: row_id
type: vlq_base128_be
cell_index_leaf:
doc-ref: 'https://www.sqlite.org/fileformat.html#b_tree_pages'
seq:
- id: len_payload
type: vlq_base128_be
- id: payload
size: len_payload.value
type: cell_payload
# TODO: overflow
cell_index_interior:
doc-ref: 'https://www.sqlite.org/fileformat.html#b_tree_pages'
seq:
- id: left_child_page
type: u4
- id: len_payload
type: vlq_base128_be
- id: payload
size: len_payload.value
type: cell_payload
cell_payload:
doc-ref: 'https://sqlite.org/fileformat2.html#record_format'
seq:
- id: len_header_and_len
type: vlq_base128_be
- id: column_serials
size: len_header_and_len.value - 1
type: serials
- id: column_contents
repeat: expr
repeat-expr: column_serials.entries.size
type: column_content(column_serials.entries[_index])
serials:
seq:
- id: entries
type: vlq_base128_be
repeat: eos
serial:
seq:
- id: code
type: vlq_base128_be
instances:
is_blob:
value: 'code.value >= 12 and (code.value % 2 == 0)'
is_string:
value: 'code.value >= 13 and (code.value % 2 == 1)'
len_content:
value: (code.value - 12) / 2
if: code.value >= 12
column_content:
params:
- id: ser
type: struct
seq:
- id: as_int
type:
switch-on: serial_type.code.value
cases:
1: u1
2: u2
3: b24
4: u4
5: b48
6: u8
if: serial_type.code.value >= 1 and serial_type.code.value <= 6
- id: as_float
type: f8
if: serial_type.code.value == 7
- id: as_blob
size: serial_type.len_content
if: serial_type.is_blob
- id: as_str
type: str
size: serial_type.len_content
encoding: UTF-8
# if: _root.text_encoding == encodings::utf_8 and serial_type.is_string
instances:
serial_type:
value: ser.as<serial>
enums:
versions:
1: legacy
2: wal
encodings:
1: utf_8
2: utf_16le
3: utf_16be


Examples¶
All of these examples will use the following data and imports.
import numpy as np
import matplotlib.pyplot as plt
import pwlf
# your data
y = np.array([0.00000000e+00, 9.69801700e-03, 2.94350340e-02,
4.39052750e-02, 5.45343950e-02, 6.74104940e-02,
8.34831790e-02, 1.02580042e-01, 1.22767939e-01,
1.42172312e-01, 0.00000000e+00, 8.58600000e-06,
8.31543400e-03, 2.34184100e-02, 3.39709150e-02,
4.03581990e-02, 4.53545600e-02, 5.02345260e-02,
5.55253360e-02, 6.14750770e-02, 6.82125120e-02,
7.55892510e-02, 8.38356810e-02, 9.26413070e-02,
1.02039790e-01, 1.11688258e-01, 1.21390666e-01,
1.31196948e-01, 0.00000000e+00, 1.56706510e-02,
3.54628780e-02, 4.63739040e-02, 5.61442590e-02,
6.78542550e-02, 8.16388310e-02, 9.77756110e-02,
1.16531753e-01, 1.37038283e-01, 0.00000000e+00,
1.16951050e-02, 3.12089850e-02, 4.41776550e-02,
5.42877590e-02, 6.63321350e-02, 8.07655920e-02,
9.70363280e-02, 1.15706975e-01, 1.36687642e-01,
0.00000000e+00, 1.50144640e-02, 3.44519970e-02,
4.55907760e-02, 5.59556700e-02, 6.88450940e-02,
8.41374060e-02, 1.01254006e-01, 1.20605073e-01,
1.41881288e-01, 1.62618058e-01])
x = np.array([0.00000000e+00, 8.82678000e-03, 3.25615100e-02,
5.66106800e-02, 7.95549800e-02, 1.00936330e-01,
1.20351520e-01, 1.37442010e-01, 1.51858250e-01,
1.64433570e-01, 0.00000000e+00, -2.12600000e-05,
7.03872000e-03, 1.85494500e-02, 3.00926700e-02,
4.17617000e-02, 5.37279600e-02, 6.54941000e-02,
7.68092100e-02, 8.76596300e-02, 9.80525800e-02,
1.07961810e-01, 1.17305210e-01, 1.26063930e-01,
1.34180360e-01, 1.41725010e-01, 1.48629710e-01,
1.55374770e-01, 0.00000000e+00, 1.65610200e-02,
3.91016100e-02, 6.18679400e-02, 8.30997400e-02,
1.02132890e-01, 1.19011260e-01, 1.34620080e-01,
1.49429370e-01, 1.63539960e-01, -0.00000000e+00,
1.01980300e-02, 3.28642800e-02, 5.59461900e-02,
7.81388400e-02, 9.84458400e-02, 1.16270210e-01,
1.31279040e-01, 1.45437090e-01, 1.59627540e-01,
0.00000000e+00, 1.63404300e-02, 4.00086000e-02,
6.34390200e-02, 8.51085900e-02, 1.04787860e-01,
1.22120350e-01, 1.36931660e-01, 1.50958760e-01,
1.65299640e-01, 1.79942720e-01])
- fit with known breakpoint locations
- fit for specified number of line segments
- fitfast for specified number of line segments
- force a fit through data points
- use custom optimization routine
- pass differential evolution keywords
- find the best number of line segments
- model persistence
- bad fits when you have more unknowns than data
fit with known breakpoint locations¶
You can perform a least squares fit if you know the breakpoint locations.
# your desired line segment end locations
x0 = np.array([min(x), 0.039, 0.10, max(x)])
# initialize piecewise linear fit with your x and y data
my_pwlf = pwlf.PiecewiseLinFit(x, y)
# fit the data with the specified break points
# (ie the x locations of where the line segments
# will terminate)
my_pwlf.fit_with_breaks(x0)
# predict for the determined points
xHat = np.linspace(min(x), max(x), num=10000)
yHat = my_pwlf.predict(xHat)
# plot the results
plt.figure()
plt.plot(x, y, 'o')
plt.plot(xHat, yHat, '-')
plt.show()
fit for specified number of line segments¶
Use a global optimization to find the breakpoint locations that minimize the sum of squares error. This uses Differential Evolution from scipy.
# initialize piecewise linear fit with your x and y data
my_pwlf = pwlf.PiecewiseLinFit(x, y)
# fit the data for four line segments
res = my_pwlf.fit(4)
# predict for the determined points
xHat = np.linspace(min(x), max(x), num=10000)
yHat = my_pwlf.predict(xHat)
# plot the results
plt.figure()
plt.plot(x, y, 'o')
plt.plot(xHat, yHat, '-')
plt.show()
fitfast for specified number of line segments¶
This performs a fit for a specified number of line segments with a multi-start gradient based optimization. This should be faster than Differential Evolution for a small number of starting points.
# initialize piecewise linear fit with your x and y data
my_pwlf = pwlf.PiecewiseLinFit(x, y)
# fit the data for four line segments
# this performs 3 multi-start optimizations
res = my_pwlf.fitfast(4, pop=3)
# predict for the determined points
xHat = np.linspace(min(x), max(x), num=10000)
yHat = my_pwlf.predict(xHat)
# plot the results
plt.figure()
plt.plot(x, y, 'o')
plt.plot(xHat, yHat, '-')
plt.show()
force a fit through data points¶
Sometimes it’s necessary to force the piecewise continuous model through a particular data point, or a set of data points. The following example finds the best 4 line segments that go through two data points.
# initialize piecewise linear fit with your x and y data
myPWLF = pwlf.PiecewiseLinFit(x, y)
# fit the function with four line segments
# force the function to go through the data points
# (0.0, 0.0) and (0.19, 0.16)
# where the data points are of the form (x, y)
x_c = [0.0, 0.19]
y_c = [0.0, 0.2]
res = myPWLF.fit(4, x_c, y_c)
# predict for the determined points
xHat = np.linspace(min(x), 0.19, num=10000)
yHat = myPWLF.predict(xHat)
# plot the results
plt.figure()
plt.plot(x, y, 'o')
plt.plot(xHat, yHat, '-')
plt.show()
use custom optimization routine¶
You can use your favorite optimization routine to find the breakpoint locations. The following example uses scipy’s minimize function.
from scipy.optimize import minimize
# initialize piecewise linear fit with your x and y data
my_pwlf = pwlf.PiecewiseLinFit(x, y)
# initialize custom optimization
number_of_line_segments = 3
my_pwlf.use_custom_opt(number_of_line_segments)
# i have number_of_line_segments - 1 number of variables
# let's guess the correct location of the two unknown variables
# (the program defaults to have end segments at x0= min(x)
# and xn=max(x)
xGuess = np.zeros(number_of_line_segments - 1)
xGuess[0] = 0.02
xGuess[1] = 0.10
res = minimize(my_pwlf.fit_with_breaks_opt, xGuess)
# set up the break point locations
x0 = np.zeros(number_of_line_segments + 1)
x0[0] = np.min(x)
x0[-1] = np.max(x)
x0[1:-1] = res.x
# calculate the parameters based on the optimal break point locations
my_pwlf.fit_with_breaks(x0)
# predict for the determined points
xHat = np.linspace(min(x), max(x), num=10000)
yHat = my_pwlf.predict(xHat)
plt.figure()
plt.plot(x, y, 'o')
plt.plot(xHat, yHat, '-')
plt.show()
pass differential evolution keywords¶
You can pass keyword arguments from the fit
function into scipy’s
Differential
Evolution.
# initialize piecewise linear fit with your x and y data
my_pwlf = pwlf.PiecewiseLinFit(x, y)
# fit the data for four line segments
# this sets DE to have an absolute tolerance of 0.1
res = my_pwlf.fit(4, atol=0.1)
# predict for the determined points
xHat = np.linspace(min(x), max(x), num=10000)
yHat = my_pwlf.predict(xHat)
# plot the results
plt.figure()
plt.plot(x, y, 'o')
plt.plot(xHat, yHat, '-')
plt.show()
find the best number of line segments¶
This example uses EGO (bayesian optimization) and a penalty function to
find the best number of line segments. This will require careful use of
the penalty parameter l
. Use this template to automatically find the
best number of line segments.
from GPyOpt.methods import BayesianOptimization
# initialize piecewise linear fit with your x and y data
my_pwlf = pwlf.PiecewiseLinFit(x, y)
# define your objective function
def my_obj(x):
# define some penalty parameter l
# you'll have to arbitrarily pick this
# it depends upon the noise in your data,
# and the value of your sum of square of residuals
l = y.mean()*0.001
f = np.zeros(x.shape[0])
for i, j in enumerate(x):
my_pwlf.fit(j[0])
f[i] = my_pwlf.ssr + (l*j[0])
return f
# define the lower and upper bound for the number of line segments
bounds = [{'name': 'var_1', 'type': 'discrete',
'domain': np.arange(2, 40)}]
np.random.seed(12121)
myBopt = BayesianOptimization(my_obj, domain=bounds, model_type='GP',
initial_design_numdata=10,
initial_design_type='latin',
exact_feval=True, verbosity=True,
verbosity_model=False)
max_iter = 30
# perform the bayesian optimization to find the optimum number
# of line segments
myBopt.run_optimization(max_iter=max_iter, verbosity=True)
print('\n \n Opt found \n')
print('Optimum number of line segments:', myBopt.x_opt)
print('Function value:', myBopt.fx_opt)
myBopt.plot_acquisition()
myBopt.plot_convergence()
# perform the fit for the optimum
my_pwlf.fit(myBopt.x_opt)
# predict for the determined points
xHat = np.linspace(min(x), max(x), num=10000)
yHat = my_pwlf.predict(xHat)
# plot the results
plt.figure()
plt.plot(x, y, 'o')
plt.plot(xHat, yHat, '-')
plt.show()
model persistence¶
You can save fitted models with pickle. Alternatively see joblib.
# if you use Python 2.x you should import cPickle
# import cPickle as pickle
# if you use Python 3.x you can just use pickle
import pickle
# your desired line segment end locations
x0 = np.array([min(x), 0.039, 0.10, max(x)])
# initialize piecewise linear fit with your x and y data
my_pwlf = pwlf.PiecewiseLinFit(x, y)
# fit the data with the specified break points
my_pwlf.fit_with_breaks(x0)
# save the fitted model
with open('my_fit.pkl', 'wb') as f:
pickle.dump(my_pwlf, f, pickle.HIGHEST_PROTOCOL)
# load the fitted model
with open('my_fit.pkl', 'rb') as f:
my_pwlf = pickle.load(f)
bad fits when you have more unknowns than data¶
You can get very bad fits with pwlf when you have more unknowns than data points. The following example will fit 99 line segments to the 59 data points. While this will result in an error of zero, the model will have very weird predictions within the data. You should not fit more unknowns than you have data with pwlf!
break_locations = np.linspace(min(x), max(x), num=100)
# initialize piecewise linear fit with your x and y data
my_pwlf = pwlf.PiecewiseLinFit(x, y)
my_pwlf.fit_with_breaks(break_locations)
# predict for the determined points
xHat = np.linspace(min(x), max(x), num=10000)
yHat = my_pwlf.predict(xHat)
# plot the results
plt.figure()
plt.plot(x, y, 'o')
plt.plot(xHat, yHat, '-')
plt.show()


I have formerly had experiences with Diphenhydramine, none of which were very noteworthy. I have had experiences with most common drugs: cocaine, ecstasy, marijuana, alcohol, methamphetamine, and psilocybin to name a few, as well as 2c-I (easily favorite). Back on topic, I have had several experiences with Diphenhydramine, but none that I can remember except for feeling extremely light-headed and then falling asleep.
In hopes of combatting the sleep, this time I took two No-Doze (each containing 200mg caffiene) prior to the experience. Approximately fifteen minutes ago I swallowed nine generic benadryl gel capsules with the only active ingredient being Diphenhydramine. Each pill contained 25mg Diphenhydramine. As of now, no noticeable effects have taken place. It should also be noted that I took these capsules on a full stomach. I am in a relatively calm state of mind, having just finished meditation forty-five minutes or so prior.
I began to play 'wish you were here' on my guitar and started to notice a slight tingly sensation in my shoulders, an extremely mild opiate-type feeling of relaxation. It has now been twenty-five minutes since dosage. Starting to have mild head buzz similar to marijuana in that it's easier to zone out and concentrate on one thing. Just stood up from kneeling position at my computer while typing and felt unusually tall and mildly nauseated.
Opiate-like mild buzz has subsided and given way to a more mental buzz mostly characterized by an ambien-like spacey feeling while walking and slight dizziness. It has been thirty-five minutes since dosage.
Spacey feeling has increased. Starty the 'drifty eyes' stage that I usually experience with the onset of a trip. I feel noticeably more lethargic, but not overwhelmed, and the nausea has subsided. It has been forty-two minutes since dosage.
Walls are starting to have a slight inward-bulge effect to them, and in my peripheral vision everything seems a bit closer and pulsating ever-so-slightly. Although these feelings are still somewhat on a subconcious level, they are becoming more prominent but still a bit away from obvious. Light-headedness increasing along with spacey feeling, foreshadowing possible confusion and disorientation later. Heartbeat has increased slightly Fifty-two minutes since dosage.
Light-headedness has increased dramatically almost to the point of being overwhelming in the past eight minutes, and subsequently the nausea has returned. Feeling is similar to the feeling right before your vision fades when the bloodflow to one's brain is restricted, but I feel far from passing out. Hard to concentrate on any one thing in particular. Strange pressure feeling behind my eyes. Like a sinus headache without the headache and not painfull or intense at all. One hour since dosage.
Starting to feel weak from the lightheadedness. Walking any distance is almost out of the question. Feeling similar to the weak feeling that comes with slight malnutrition after several days of sickness.  Just turned my head and was slapped with a wave of lightheadedness that was slightly dissociative. Having trouble focusing my eyes on anything for longer than about three seconds. Strong urge to stop typing. Slight pupil constriction and strong dizziness when attempting to walk. Head slightly swaying and bobbing. One hour twenty minutes since dosage.
Nausea has increased, still not overwhelming, just becoming annoying. Still ambien-like but much more lightheaded. Experience is beginning to feel like an uneventful dream. Lightheadedness still increasing along with the difficulty involved in walking. Other than a substantial amount of difficulty with doing any kind of math and a slightly more dissociative feeling attributed to the lightheadedness, no other changes noteworthy. One hour forty minutes since dosage, beginning to assume this is the extent of a Diphenhydramine high.
I am now convinced that this is the extent of a Diphenhydramine high. Intense lightheadedness, slight dissociation resulting in substantial confusion, and crippled depth perception and balance. Interesting, but not great. Not bad either (considering that it's roughly $3.99 for approximately 30 capsules.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


I lived in Sicily for only about 6 months. I've been to a few places in Italy - like Rome, Naples, Sorrento. But I happened to actually live in a small coastal town in Sicily - Oliveri. It's located on the North shore near Messina. Me and my husband got married there and started our life together. My father-in-law was born and spent his young years in Sicily. For this reason my husband was visiting Sicily a lot. Italy is such a famous travel destination these days that I can hardly be original here.


I take Vyvanse regularly on a daily basis. 40 Mg of the stimulant in the morning has me going alert and efficient till about 5 in the afternoon. I also take Klonopin to counter my anxiety and sleep problems. I usually take a .5 mg tablet in the evening everyday.
Today I woke up like any normal day. Took my vyvanse at about 7, and around 8:30 I was up and about doing homework and other things. Around noon time I suddenly felt pain in the back of my neck, and over a period of ten minutes the pain turned into extreme stiffness and my head and shoulders were left in an awkward cocked position. I took some ibuprofen (600 mg) mainly for the pain and the anti-inflammatory effects, I prefer Tylenol but acetaminophen doesn't have anti-inflammatory.
The pain didn't go away nor did the dis figuration. Around 4:30 I came home and had a bottle of tramadol 50 mg each from a surgery earlier this year. The bottle said 'take two pills every 6 hours as needed for pain.' I took three, simply because I was in a lot of pain and I felt that 150 mg of tramadol isn't really dangerous. It felt good, I experienced reduced pain and I was feeling more relaxed and a little light headed. The pain killing effect lasted till about 10 o'clock.
My neck began hurting pretty unbarebly again around 10, so I took two more tramadol. This time the 100 mg dose was very obvious. I felt very good. The pain killing effect was excellent, and I even felt a little more buzzed almost like a high euphoric feeling. I normally take .5 mg of klonopin around 9, but I didn't because I didn't want it to interact with the tramadol. I am aware, however, that klonopin has a very long half life, and I have taken it for several months every night and surely I have a good amount still in my bloodstream.
I got in bed around 11. After looking at the ceiling for a few minutes due to being light headed and worry free I noticed my breathing was a little slower than normal. In fact, I was breathing very shallow and needed to manually take big breaths to feel like I was actually taking in air. After a few more minutes I kind of dozed off and was abruptly awakened by myself to gasp for a breath. It scared me and I tried keeping my eyes open to focus on my breathing and not let it happen again. About 20 minutes later my phone went off and I again woke up when I heard it and gasped for a breath, I have no idea when I fell asleep.
It is now 1:45 in the morning my time. I keep getting into bed and finding breathing difficult and am scared I could stop breathing altogether in my sleep since sleep lowers your respiration rate as well. I have to keep getting up to breathe properly, which isn't fun because my neck still hurts if I move around too much. To keep myself awake I decided to get on here and write this experience. I feel like I could get back into bed in the next 10 or 15 minutes and breath normally, but I don't know how I will be when I am asleep. Frankly I'm a little scared to fall asleep. I know tramadol is meant to be a mild mimic of opiates, but I have never taken it other than this time and after the surgery.
Overall I enjoyed the buzzed feeling, but never again will I take the tramadol this late at night. I am writing this while awake, avoiding sleep. I don't want to fall into coma, or worse death. Maybe I'm overreacting, but better safe than sorry especially when dealing with pharmaceuticals.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


1. Margin
A margin is the area surrounding a whole image.
It is the space where no other element can overlap.
2. Border
A border is the outline around an image.
3. Padding
Padding is the blank space immediately surrounding the image or content.
It is the space between the actual image and the border.
See the image below:
Borders, margins and padding can be adjusted or readjusted by creating a style class.
A style class is set up at the top of the page.
It's almost like a mini-recipe for something that is needed in a bigger recipe, for example a recipe for custard set out at the beginning of a recipe for custard-filled donuts.
It is much simpler to understand when set out in that way so that the reader can follow the instructions in advance and add the custard in as necessary. Overcomplicated analogies aside, style classes mean that stylings can be added easily to the body of the code.


{% extends "base.html" %}
{% block head_title %}About || {{ block.super }} {% endblock head_title %}
{% block content %}
This application is still in testing/beta , but it is now freely available for use. This aims to provide solutions to our everyday problems such as expense monitoring and budgeting.
More modules will be added soon, as the developer plans to add more apps.
This website was developed using Python Django, Bootstrap, Chart.js and JQuery. More improvement in functionality and technology will soon be implemented to enhance user experience. But ofcourse Python Django would still be the heart of the application.
Emaill me @ : Cbicamina@gmail.com


Business Finance
Facts
DailySales
Date
Product ID
Units
Price
DailyCost
Date
Resource ID
Units
Price
Views
Entities
Customer
ID
Attributes...
Product
ID
Attributes...
Invoice
ID
Attributes...
Resource
ID
Attributes...
CostStructure
Product ID
Resource ID
Amount