{"id":13419195,"url":"https://github.com/craigsapp/midifile","last_synced_at":"2025-09-13T19:50:22.645Z","repository":{"id":27088658,"uuid":"30555698","full_name":"craigsapp/midifile","owner":"craigsapp","description":"C++ classes for reading/writing Standard MIDI Files","archived":false,"fork":false,"pushed_at":"2024-07-07T00:42:28.000Z","size":1499,"stargazers_count":740,"open_issues_count":28,"forks_count":132,"subscribers_count":38,"default_branch":"master","last_synced_at":"2024-07-31T22:46:13.320Z","etag":null,"topics":["c-plus-plus","cpp","midi","standard-midi-file"],"latest_commit_sha":null,"homepage":"http://midifile.sapp.org","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/craigsapp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-09T20:05:31.000Z","updated_at":"2024-07-25T03:32:40.000Z","dependencies_parsed_at":"2024-01-14T00:49:01.238Z","dependency_job_id":"1a68abc4-2af5-467a-8e2d-61f27ee68803","html_url":"https://github.com/craigsapp/midifile","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigsapp%2Fmidifile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigsapp%2Fmidifile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigsapp%2Fmidifile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigsapp%2Fmidifile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/craigsapp","download_url":"https://codeload.github.com/craigsapp/midifile/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243690121,"owners_count":20331725,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-plus-plus","cpp","midi","standard-midi-file"],"created_at":"2024-07-30T22:01:12.603Z","updated_at":"2025-03-15T05:30:25.897Z","avatar_url":"https://github.com/craigsapp.png","language":"C++","readme":"Midifile: C++ MIDI file parsing library\n=======================================\n\n\n[![Travis Build Status](https://travis-ci.org/craigsapp/midifile.svg?branch=master)](https://travis-ci.org/craigsapp/midifile) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/oo393u60ut1rtbf3?svg=true)](https://ci.appveyor.com/project/craigsapp/midifile)\n\nMidifile is a library of C++ classes for reading/writing Standard\nMIDI files.  The library consists of 6 classes:\n\n\n\u003ctable\u003e\n\n\u003ctr valign=\"top\"\u003e\u003ctd\u003e\n\t\u003ca href=\"http://midifile.sapp.org/class/MidiFile\"\u003eMidiFile\u003c/a\u003e\n\u003c/td\u003e\u003ctd\u003e\n\tThe main interface for dealing with MIDI files.  The MidiFile class\n\tappears as a two dimensional array of MidiEvents: the first dimension\n\tis a list of tracks, and the second dimension is a list of MidiEvents.\n\u003c/td\u003e\u003c/tr\u003e\n\n\u003ctr valign=\"top\"\u003e\u003ctd\u003e\n\t\u003ca href=\"http://midifile.sapp.org/class/MidiEventList\"\u003eMidiEventList\u003c/a\u003e\n\u003c/td\u003e\u003ctd\u003e\n\tA data structure that manages the list of MidiEvents for a MIDI file track.\n\u003c/td\u003e\u003c/tr\u003e\n\n\u003ctr valign=\"top\"\u003e\u003ctd\u003e\n\t\u003ca href=\"http://midifile.sapp.org/class/MidiEvent\"\u003eMidiEvent\u003c/a\u003e\n\u003c/td\u003e\u003ctd\u003e\n\tThe primary storage unit for MidiMessages in a MidiFile.  The class\n\tconsists of a tick timestamp (delta or absolute) and a vector of\n        MIDI message bytes (or Standard MIDI File meta messages).\n\u003c/td\u003e\u003c/tr\u003e\n\n\n\u003ctr valign=\"top\"\u003e\u003ctd\u003e\n\t\u003ca href=\"http://midifile.sapp.org/class/MidiMessage\"\u003eMidiMessage\u003c/a\u003e\n\u003c/td\u003e\u003ctd\u003e\n\tThe base class for MidiEvents.  This is a STL vector of\n\tunsigned bytes representing a MIDI (or meta) message.\n\u003c/td\u003e\u003c/tr\u003e\n\n\u003ctr valign=\"top\"\u003e\u003ctd\u003e\n\t\u003ca href=\"http://midifile.sapp.org/class/Binasc\"\u003eBinasc\u003c/a\u003e\n\u003c/td\u003e\u003ctd\u003e\n\tA helper class for MidiFile that allows reading/writing of MIDI\n\tfiles in an ASCII format describing the bytes of the binary Standard\n\tMIDI Files.\n\u003c/td\u003e\u003c/tr\u003e\n\n\u003ctr valign=\"top\"\u003e\u003ctd\u003e\n\t\u003ca href=\"http://midifile.sapp.org/class/Options\"\u003eOptions\u003c/a\u003e\n\u003c/td\u003e\u003ctd\u003e\n\tA optional convenience class used for parsing command-line options\n\tin the example programs.  This class can be removed from the library\n        since it is not needed for using the MidiFile class.\n\u003c/td\u003e\u003c/tr\u003e\n\n\u003c/table\u003e\n\nHere is a schematic of how the classes are used together:\n\n![Class organization](https://user-images.githubusercontent.com/3487289/39109564-493bca94-4682-11e8-87c4-991a931ca41b.png)\n\nThe `MidiFile` class contains a vector of tracks stored in `MidiEventList`\nobjects.  The `MidiEventList` is itself a vector of `MidiEvent`s, which stores\neach MIDI event in the track.  `MidiEvent`s contain a timestamp and a `MidiMessage`\nwhich is a vector of unsigned char values, storing the raw bytes of a MIDI message\n(or meta-message).\n\n\nDocumentation is under construction at\n[http://midifile.sapp.org](http://midifile.sapp.org).\nEssential examples for reading and writing MIDI files\nare given below.\n\n\nDownloading\n-----------\n\nYou can download as a ZIP file from the Github page for the midifile library,\nor if you use git, then download with this command:\n\n``` bash\ngit clone https://github.com/craigsapp/midifile\n```\n\nThis will create the `midifile` directory with the source code for the library.\n\n\n\nCompiling with GCC\n------------------\n\nThe library can be compiled with the command:\n``` bash\nmake library\n```\n\nThis will create the file `lib/libmidifile.a` which can be used to link\nto programs that use the library.  Example programs can be compiled with\nthe command:\n``` bash\nmake programs\n```\nThis will compile all example programs in the tools directory.  Compiled\nexample programs will be stored in the `bin` directory.  To compile both the\nlibrary and the example programs all in one step, type:\n``` bash\nmake\n```\n\nTo compile only a single program, such as `createmidifile`, type:\n``` bash\nmake createmidifile\n```\nYou can also place your own programs in `tools`, such as `myprogram.cpp`\nand to compile type:\n``` bash\nmake myprogram\n```\nThe compiled program will be `bin/myprogram`.\n\n\nUsing in your own project\n-------------------------\n\nThe easiest way to use the midifile library in your own project is to\ncopy the header files in the `include` directory and the source-code\nfiles in the `src` directory into your own project.  You do not\nneed to copy `Options.h` or `Options.cpp` since the `MidiFile` class is\nnot dependent on them.  The [verovio](https://github.com/rism-ch/verovio)\nand [midiroll](https://github.com/craigsapp/midiroll) projects on Github\nboth use this method to use the midifile library.  Alternatively, you\ncan fork the midifile repository and build a compiled library file of\nthe source code that can be copied with the `include` directory contents\ninto your project.\n\n\nMIDI file reading examples\n--------------------------\n\nThe following program lists all MidiEvents in a MIDI file. The program\niterates over each track, printing a list of all MIDI events in the track.\nFor each event, the absolute tick timestamp for the performance time of\nthe MIDI message is given, followed by the message itself as a list of\nhex bytes.\n\nYou can run the `MidiFile::doTimeAnalysis()` function to convert\nthe absolute tick timestamps into seconds, according to any tempo\nmeta-messages in the file (using a default tempo of 120 quarter notes\nper minute if there are no tempo meta-messages).  The absolute starting\ntime of the event is shown in the second column of the program's output.\n\nThe `MidiFile::linkNotePairs()` function can be used to match note-ons\nand note-offs.  When this is done, you can access the duration of the\nnote with `MidiEvent::getDurationInSeconds()` for note-on messages. The\nnote durations are shown in the third column of the program's output.\n\nNote that the midifile library classes are in the `smf` namespace,\nso `using namespace smf;` or `smf::` prefixes are needed to access\nthe classes.\n\n``` cpp\n#include \"MidiFile.h\"\n#include \"Options.h\"\n#include \u003ciostream\u003e\n#include \u003ciomanip\u003e\n\nusing namespace std;\nusing namespace smf;\n\nint main(int argc, char** argv) {\n   Options options;\n   options.process(argc, argv);\n   MidiFile midifile;\n   if (options.getArgCount() == 0) midifile.read(cin);\n   else midifile.read(options.getArg(1));\n   midifile.doTimeAnalysis();\n   midifile.linkNotePairs();\n\n   int tracks = midifile.getTrackCount();\n   cout \u003c\u003c \"TPQ: \" \u003c\u003c midifile.getTicksPerQuarterNote() \u003c\u003c endl;\n   if (tracks \u003e 1) cout \u003c\u003c \"TRACKS: \" \u003c\u003c tracks \u003c\u003c endl;\n   for (int track=0; track\u003ctracks; track++) {\n      if (tracks \u003e 1) cout \u003c\u003c \"\\nTrack \" \u003c\u003c track \u003c\u003c endl;\n      cout \u003c\u003c \"Tick\\tSeconds\\tDur\\tMessage\" \u003c\u003c endl;\n      for (int event=0; event\u003cmidifile[track].size(); event++) {\n         cout \u003c\u003c dec \u003c\u003c midifile[track][event].tick;\n         cout \u003c\u003c '\\t' \u003c\u003c dec \u003c\u003c midifile[track][event].seconds;\n         cout \u003c\u003c '\\t';\n         if (midifile[track][event].isNoteOn())\n            cout \u003c\u003c midifile[track][event].getDurationInSeconds();\n         cout \u003c\u003c '\\t' \u003c\u003c hex;\n         for (int i=0; i\u003cmidifile[track][event].size(); i++)\n            cout \u003c\u003c (int)midifile[track][event][i] \u003c\u003c ' ';\n         cout \u003c\u003c endl;\n      }\n   }\n\n   return 0;\n}\n```\n\nThe above example program will read the first filename it finds on\nthe command-line, or it will read from standard input if no arguments\nare found.  Both binary standard MIDI files and ASCII representations\nof MIDI Files can be input into the program.  For example, save the\nfollowing text into a file called `twinkle.txt` to use as input data.\nThis content represents the hex bytes for a standard MIDI file, which\nwill automatically be parsed by the `MidiFile` class.\n\n```\n4d 54 68 64 00 00 00 06 00 01 00 03 00 78 4d 54 72 6b 00 00 00 04 00 ff 2f\n00 4d 54 72 6b 00 00 00 76 00 90 48 40 78 80 48 40 00 90 48 40 78 80 48 40\n00 90 4f 40 78 80 4f 40 00 90 4f 40 78 80 4f 40 00 90 51 40 78 80 51 40 00\n90 51 40 78 80 51 40 00 90 4f 40 81 70 80 4f 40 00 90 4d 40 78 80 4d 40 00\n90 4d 40 78 80 4d 40 00 90 4c 40 78 80 4c 40 00 90 4c 40 78 80 4c 40 00 90\n4a 40 78 80 4a 40 00 90 4a 40 78 80 4a 40 00 90 48 40 81 70 80 48 40 00 ff\n2f 00 4d 54 72 6b 00 00 00 7d 00 90 30 40 78 80 30 40 00 90 3c 40 78 80 3c\n40 00 90 40 40 78 80 40 40 00 90 3c 40 78 80 3c 40 00 90 41 40 78 80 41 40\n00 90 3c 40 78 80 3c 40 00 90 40 40 78 80 40 40 00 90 3c 40 78 80 3c 40 00\n90 3e 40 78 80 3e 40 00 90 3b 40 78 80 3b 40 00 90 3c 40 78 80 3c 40 00 90\n39 40 78 80 39 40 00 90 35 40 78 80 35 40 00 90 37 40 78 80 37 40 00 90 30\n40 81 70 80 30 40 00 ff 2f 00\n```\n\nBelow is the output from the example program given the above input data.  The\nTPQ value is the ticks-per-quarter-note value from the MIDI header.  In\nthis example, each quarter note has a duration of 120 MIDI file ticks.  The\nabove MIDI file contains three tracks, with the first track (the expression\ntrack, having no content other than the end-of-track meta message, `ff 2f 00`\nin hex bytes.  The second track starts with a MIDI note-on message `90 48 40`\n(in hex) which will start playing MIDI note 72 (C pitch one octave above\nmiddle C) with a medium loudness (40 hex = 64 in decimal notation).\n\n\u003cpre\u003e\nTPQ: 120\nTRACKS: 3\n\nTrack 0\nTick\tSeconds\tDur\tMessage\n0\t0\t\tff 2f 0\n\nTrack 1\nTick\tSeconds\tDur\tMessage\n0\t0\t0.5\t90 48 40\n120\t0.5\t\t80 48 40\n120\t0.5\t0.5\t90 48 40\n240\t1\t\t80 48 40\n240\t1\t0.5\t90 4f 40\n360\t1.5\t\t80 4f 40\n360\t1.5\t0.5\t90 4f 40\n480\t2\t\t80 4f 40\n480\t2\t0.5\t90 51 40\n600\t2.5\t\t80 51 40\n600\t2.5\t0.5\t90 51 40\n720\t3\t\t80 51 40\n720\t3\t1\t90 4f 40\n960\t4\t\t80 4f 40\n960\t4\t0.5\t90 4d 40\n1080\t4.5\t\t80 4d 40\n1080\t4.5\t0.5\t90 4d 40\n1200\t5\t\t80 4d 40\n1200\t5\t0.5\t90 4c 40\n1320\t5.5\t\t80 4c 40\n1320\t5.5\t0.5\t90 4c 40\n1440\t6\t\t80 4c 40\n1440\t6\t0.5\t90 4a 40\n1560\t6.5\t\t80 4a 40\n1560\t6.5\t0.5\t90 4a 40\n1680\t7\t\t80 4a 40\n1680\t7\t1\t90 48 40\n1920\t8\t\t80 48 40\n1920\t8\t\tff 2f 0\n\nTrack 2\nTick\tSeconds\tDur\tMessage\n0\t0\t0.5\t90 30 40\n120\t0.5\t\t80 30 40\n120\t0.5\t0.5\t90 3c 40\n240\t1\t\t80 3c 40\n240\t1\t0.5\t90 40 40\n360\t1.5\t\t80 40 40\n360\t1.5\t0.5\t90 3c 40\n480\t2\t\t80 3c 40\n480\t2\t0.5\t90 41 40\n600\t2.5\t\t80 41 40\n600\t2.5\t0.5\t90 3c 40\n720\t3\t\t80 3c 40\n720\t3\t0.5\t90 40 40\n840\t3.5\t\t80 40 40\n840\t3.5\t0.5\t90 3c 40\n960\t4\t\t80 3c 40\n960\t4\t0.5\t90 3e 40\n1080\t4.5\t\t80 3e 40\n1080\t4.5\t0.5\t90 3b 40\n1200\t5\t\t80 3b 40\n1200\t5\t0.5\t90 3c 40\n1320\t5.5\t\t80 3c 40\n1320\t5.5\t0.5\t90 39 40\n1440\t6\t\t80 39 40\n1440\t6\t0.5\t90 35 40\n1560\t6.5\t\t80 35 40\n1560\t6.5\t0.5\t90 37 40\n1680\t7\t\t80 37 40\n1680\t7\t1\t90 30 40\n1920\t8\t\t80 30 40\n1920\t8\t\tff 2f 0\n\u003c/pre\u003e\n\nThe default behavior of the `MidiFile` class is to store the absolute\ntick times of MIDI events, available in `MidiEvent::tick`, which is the\ntick time from the start of the file to the current event.  In standard\nMIDI files, tick are stored as delta values, where the tick indicates the\nduration to wait since the previous message in a track.  To access the\ndelta tick values, you can either (1) subtrack the current tick time from\nthe previous tick time in the list, or call `MidiFile::makeDeltaTime()`\nto convert the absolute tick values into delta tick values.\n\nThe `MidiFile::joinTracks()` function can be used to convert multi-track\ndata into a single time sequence.  The `joinTrack()` operation can be\nreversed by calling the `MidiFile::splitTracks()` function.  Here is a sample\nof program that joins the `MidiEvents` into a single track so that the\ndata can be processed in a single loop:\n\n``` cpp\n#include \"MidiFile.h\"\n#include \"Options.h\"\n#include \u003ciostream\u003e\n#include \u003ciomanip\u003e\n\nusing namespace std;\nusing namespace smf;\n\nint main(int argc, char** argv) {\n   Options options;\n   options.process(argc, argv);\n   MidiFile midifile;\n   if (options.getArgCount() \u003e 0) midifile.read(options.getArg(1));\n   else midifile.read(cin);\n   cout \u003c\u003c \"TPQ: \" \u003c\u003c midifile.getTicksPerQuarterNote() \u003c\u003c endl;\n   cout \u003c\u003c \"TRACKS: \" \u003c\u003c midifile.getTrackCount() \u003c\u003c endl;\n   midifile.joinTracks();\n   // midifile.getTrackCount() will now return \"1\", but original\n   // track assignments can be seen in .track field of MidiEvent.\n   cout \u003c\u003c \"TICK    DELTA   TRACK   MIDI MESSAGE\\n\";\n   cout \u003c\u003c \"____________________________________\\n\";\n   MidiEvent* mev;\n   int deltatick;\n   for (int event=0; event \u003c midifile[0].size(); event++) {\n      mev = \u0026midifile[0][event];\n      if (event == 0) deltatick = mev-\u003etick;\n      else deltatick = mev-\u003etick - midifile[0][event-1].tick;\n      cout \u003c\u003c dec \u003c\u003c mev-\u003etick;\n      cout \u003c\u003c '\\t' \u003c\u003c deltatick;\n      cout \u003c\u003c '\\t' \u003c\u003c mev-\u003etrack;\n      cout \u003c\u003c '\\t' \u003c\u003c hex;\n      for (int i=0; i \u003c mev-\u003esize(); i++)\n         cout \u003c\u003c (int)(*mev)[i] \u003c\u003c ' ';\n      cout \u003c\u003c endl;\n   }\n   return 0;\n}\n```\n\nBelow is the new single-track output.  The first column is the absolute\ntick timestamp of the message; the second column is the delta tick value;\nthe third column is the original track value; and the last column\ncontains the MIDI message (in hex bytes).\n\n\u003cpre style=\"font-family:Courier,Lucidatypewriter,monospace; -moz-tab-size: 8; -o-tab-size: 8; -webkit-tab-size: 8; tab-size:8;\"\u003e\nTPQ: 120\nTRACKS: 3\nTICK    DELTA   TRACK   MIDI MESSAGE\n____________________________________\n0\t0\t1\t90 48 40\n0\t0\t2\t90 30 40\n0\t0\t0\tff 2f 0\n120\t120\t1\t80 48 40\n120\t0\t2\t80 30 40\n120\t0\t2\t90 3c 40\n120\t0\t1\t90 48 40\n240\t120\t2\t80 3c 40\n240\t0\t1\t80 48 40\n240\t0\t2\t90 40 40\n240\t0\t1\t90 4f 40\n360\t120\t2\t80 40 40\n360\t0\t1\t80 4f 40\n360\t0\t1\t90 4f 40\n360\t0\t2\t90 3c 40\n480\t120\t2\t80 3c 40\n480\t0\t1\t80 4f 40\n480\t0\t2\t90 41 40\n480\t0\t1\t90 51 40\n600\t120\t2\t80 41 40\n600\t0\t1\t80 51 40\n600\t0\t1\t90 51 40\n600\t0\t2\t90 3c 40\n720\t120\t1\t80 51 40\n720\t0\t2\t80 3c 40\n720\t0\t2\t90 40 40\n720\t0\t1\t90 4f 40\n840\t120\t2\t80 40 40\n840\t0\t2\t90 3c 40\n960\t120\t2\t80 3c 40\n960\t0\t1\t80 4f 40\n960\t0\t2\t90 3e 40\n960\t0\t1\t90 4d 40\n1080\t120\t1\t80 4d 40\n1080\t0\t2\t80 3e 40\n1080\t0\t2\t90 3b 40\n1080\t0\t1\t90 4d 40\n1200\t120\t1\t80 4d 40\n1200\t0\t2\t80 3b 40\n1200\t0\t2\t90 3c 40\n1200\t0\t1\t90 4c 40\n1320\t120\t1\t80 4c 40\n1320\t0\t2\t80 3c 40\n1320\t0\t1\t90 4c 40\n1320\t0\t2\t90 39 40\n1440\t120\t1\t80 4c 40\n1440\t0\t2\t80 39 40\n1440\t0\t1\t90 4a 40\n1440\t0\t2\t90 35 40\n1560\t120\t1\t80 4a 40\n1560\t0\t2\t80 35 40\n1560\t0\t2\t90 37 40\n1560\t0\t1\t90 4a 40\n1680\t120\t1\t80 4a 40\n1680\t0\t2\t80 37 40\n1680\t0\t2\t90 30 40\n1680\t0\t1\t90 48 40\n1920\t240\t1\t80 48 40\n1920\t0\t2\t80 30 40\n1920\t0\t1\tff 2f 0\n1920\t0\t2\tff 2f 0\n\u003c/pre\u003e\n\n\n\nMIDI file writing example\n--------------------------\n\nBelow is an example program to create a MIDI file.  This program will\ngenerate a random sequence of notes and append them to the end of\nthe track.  By default a `MidiFile` object contains a single track and\nwill be written as a type-0 MIDI file unless more tracks are added.  After\nadding notes to the track, it must be sorted into time sequence\nbefore being written to a file.\n\n\n``` cpp\n#include \"MidiFile.h\"\n#include \"Options.h\"\n#include \u003crandom\u003e\n#include \u003ciostream\u003e\n\nusing namespace std;\nusing namespace smf;\n\nint main(int argc, char** argv) {\n   Options options;\n   options.define(\"n|note-count=i:10\", \"How many notes to randomly play\");\n   options.define(\"o|output-file=s\",   \"Output filename (stdout if none)\");\n   options.define(\"i|instrument=i:0\",  \"General MIDI instrument number\");\n   options.define(\"x|hex=b\",           \"Hex byte-code output\");\n   options.process(argc, argv);\n\n   random_device rd;\n   mt19937 mt(rd());\n   uniform_int_distribution\u003cint\u003e starttime(0, 100);\n   uniform_int_distribution\u003cint\u003e duration(1, 8);\n   uniform_int_distribution\u003cint\u003e pitch(36, 84);\n   uniform_int_distribution\u003cint\u003e velocity(40, 100);\n\n   MidiFile midifile;\n   int track   = 0;\n   int channel = 0;\n   int instr   = options.getInteger(\"instrument\");\n   midifile.addTimbre(track, 0, channel, instr);\n\n   int tpq     = midifile.getTPQ();\n   int count   = options.getInteger(\"note-count\");\n   for (int i=0; i\u003ccount; i++) {\n      int starttick = int(starttime(mt) / 4.0 * tpq);\n      int key       = pitch(mt);\n      int endtick   = starttick + int(duration(mt) / 4.0 * tpq);\n      midifile.addNoteOn (track, starttick, channel, key, velocity(mt));\n      midifile.addNoteOff(track, endtick,   channel, key);\n   }\n   midifile.sortTracks();  // Need to sort tracks since added events are\n                           // appended to track in random tick order.\n   string filename = options.getString(\"output-file\");\n   if (filename.empty()) {\n      if (options.getBoolean(\"hex\")) midifile.writeHex(cout);\n      else cout \u003c\u003c midifile;\n   } else\n      midifile.write(filename);\n\n   return 0;\n}\n```\n\nIf no output file is specified, the MIDI file contents will be printed\nin the Binasc format to standard output, which can be read back into a\nMidiFile object and converted into a Standard MIDI file (see the read/write\nexample further down the page for how to do that):\n\n```\n\"MThd\"\t\t\t; MIDI header chunk marker\n4'6\t\t\t; bytes to follow in header chunk\n2'0\t\t\t; file format: Type-0 (single track)\n2'1\t\t\t; number of tracks\n2'120\t\t\t; ticks per quarter note\n\n;;; TRACK 0 ----------------------------------\n\"MTrk\"\t\t\t; MIDI track chunk marker\n4'89\t\t\t; bytes to follow in track chunk\nv30\t90 '74 '72\t; note-on D5\nv150\t90 '68 '88\t; note-on G#4\nv0\t90 '79 '83\t; note-on G5\nv60\t90 '74 '0\t; note-off D5\nv150\t90 '79 '0\t; note-off G5\nv30\t90 '68 '0\t; note-off G#4\nv990\t90 '60 '100\t; note-on C4\nv90\t90 '60 '0\t; note-off C4\nv630\t90 '83 '69\t; note-on B5\nv60\t90 '83 '0\t; note-off B5\nv30\t90 '56 '51\t; note-on G#3\nv90\t90 '56 '0\t; note-off G#3\nv390\t90 '78 '46\t; note-on F#5\nv30\t90 '60 '78\t; note-on C4\nv90\t90 '78 '0\t; note-off F#5\nv0\t90 '70 '56\t; note-on A#4\nv60\t90 '76 '100\t; note-on E5\nv90\t90 '60 '0\t; note-off C4\nv30\t90 '76 '0\t; note-off E5\nv60\t90 '70 '0\t; note-off A#4\nv0\tff 2f v0\t; end-of-track\n```\n\nHere is the MIDI data visualized with the example program\n[mid2svg](https://github.com/craigsapp/midifile/blob/master/tools/mid2svg.cpp):\n\n![10 random nots](https://user-images.githubusercontent.com/3487289/39096697-5728558e-4608-11e8-9b02-c29f39d85d0f.png)\n\nThe `-x` option can be used to output the data as hex byte-codes, the `-n` option\ncontrols the number of notes, and `-i #` specifies the instrument number\nto be used:\n\n``` bash\nmyprogram -n 100 -x -i 24\n```\n\nproduces the hex byte-code MIDI file:\n\n```\n4d 54 68 64 00 00 00 06 00 00 00 01 00 78 4d 54 72 6b 00 00 03 27 00 c0 18\n1e 90 4d 2f 1e 90 31 5e 00 90 40 42 1e 90 47 55 1e 90 47 00 00 90 31 00 00\n90 32 62 1e 90 43 2d 1e 90 43 00 00 90 3f 5f 1e 90 32 00 1e 90 4d 00 00 90\n47 38 1e 90 51 33 1e 90 40 00 00 90 31 31 00 90 35 3a 1e 90 24 41 00 90 4d\n4f 00 90 4e 32 1e 90 31 00 00 90 51 00 1e 90 4e 00 00 90 48 51 1e 90 3f 00\n00 90 24 00 1e 90 47 00 1e 90 35 00 00 90 2c 61 1e 90 4d 63 3c 90 4d 00 00\n90 48 00 00 90 33 30 1e 90 2c 00 00 90 4d 00 00 90 40 5f 00 90 45 5f 00 90\n3e 58 00 90 3f 45 00 90 24 4a 1e 90 33 00 00 90 3c 3c 1e 90 32 38 1e 90 39\n40 1e 90 53 43 1e 90 40 00 00 90 3f 00 00 90 3e 00 00 90 45 00 00 90 4d 62\n1e 90 24 00 00 90 32 00 00 90 30 42 00 90 2d 28 1e 90 3c 00 00 90 4d 00 00\n90 53 00 00 90 2a 45 3c 90 36 51 1e 90 39 00 00 90 2a 00 00 90 36 4b 3c 90\n36 00 00 90 3e 5c 1e 90 2d 00 1e 90 30 00 00 90 3e 00 3c 90 41 48 00 90 37\n3f 00 90 36 3a 00 90 41 51 00 90 46 38 3c 90 36 00 1e 90 36 00 00 90 46 00\n00 90 36 58 1e 90 41 00 00 90 32 44 00 90 47 2a 1e 90 37 00 00 90 45 2b 1e\n90 41 53 00 90 3e 2d 1e 90 3e 00 00 90 33 28 00 90 29 4b 1e 90 41 00 00 90\n41 00 1e 90 29 00 00 90 49 51 1e 90 47 00 00 90 35 49 00 90 49 43 1e 90 35\n00 00 90 45 00 00 90 36 00 00 90 27 5c 1e 90 32 00 1e 90 49 00 00 90 28 4d\n1e 90 49 00 00 90 33 00 00 90 2e 44 1e 90 29 2b 3c 90 27 00 00 90 24 3e 00\n90 28 53 00 90 52 51 1e 90 4d 4f 00 90 26 5c 1e 90 28 00 00 90 29 00 00 90\n27 32 1e 90 28 00 00 90 2e 00 00 90 4d 00 1e 90 2f 28 1e 90 4a 5a 00 90 47\n43 1e 90 4a 00 00 90 52 00 00 90 24 00 00 90 34 2f 1e 90 2f 00 00 90 3c 5e\n00 90 28 4f 00 90 32 2d 1e 90 26 00 00 90 3c 00 00 90 27 00 00 90 53 63 1e\n90 47 00 1e 90 32 00 00 90 44 5d 00 90 32 40 1e 90 28 00 00 90 46 46 1e 90\n34 00 1e 90 2a 3e 1e 90 53 00 00 90 3a 3f 00 90 53 31 1e 90 28 5f 1e 90 28\n00 00 90 46 00 00 90 53 00 00 90 2a 00 1e 90 32 00 00 90 3a 00 00 90 44 00\n3c 90 33 4d 1e 90 53 57 00 90 54 30 1e 90 38 45 1e 90 2f 46 1e 90 2f 00 00\n90 33 00 1e 90 3a 61 00 90 38 40 1e 90 54 00 00 90 27 37 1e 90 3a 00 00 90\n53 00 00 90 32 29 1e 90 38 00 00 90 40 2b 00 90 36 41 1e 90 38 00 00 90 34\n46 1e 90 27 00 5a 90 36 00 00 90 32 00 00 90 40 00 00 90 48 4a 5a 90 34 00\n00 90 48 00 1e 90 29 62 00 90 3e 4d 1e 90 39 3e 00 90 4a 2d 00 90 40 2d 3c\n90 39 00 00 90 4a 00 00 90 25 58 1e 90 29 00 00 90 41 37 00 90 45 4c 00 90\n4d 64 1e 90 41 00 00 90 3e 00 1e 90 4d 00 3c 90 40 00 00 90 25 00 00 90 39\n4a 3c 90 32 43 1e 90 45 4a 1e 90 45 00 3c 90 45 00 3c 90 32 00 00 90 39 00\n00 ff 2f 00\n```\n\nVisualization with `bin/mid2svg -s 6 -a 12 -v`:\n\n![100 random notes](https://user-images.githubusercontent.com/3487289/39097422-bd085ac2-4610-11e8-832d-f9a1239ff560.png)\n\n\nRead/Write example\n------------------\n\nHere is an example minimal program that converts the above hex byte-codes\ninto a standard MIDI file:\n\n\n```cpp\n#include \"MidiFile.h\"\n#include \u003ciostream\u003e\n\nusing namespace std;\nusing namespace smf;\n\nint main(int argc, char** argv) {\n   if (argc != 3) return 1;\n   MidiFile midifile;\n   midifile.read(argv[1]);\n   if (midifile.status()) midifile.write(argv[2]);\n   else cerr \u003c\u003c \"Problem reading MIDI file \" \u003c\u003c argv[1] \u003c\u003c endl;\n}\n```\n\nThe `MidiFile::read()` function will automatically identify if the\ninput is a binary standard MIDI file, a hex byte-code representation,\nor a generalized binasc syntax file (which includes byte-codes).\nThe `MidiFile::status()` function can be checked after reading a MIDI\nfile to determine if the file was read without problems.\n\n\nCode snippets\n-------------\n\n\n### How to process multiple input files and get duration of MIDI files ###\n\nThis example uses the `MidiFile::getFileDurationInSeconds()` to calculate the\nduration of a MIDI file.  Also, this example shows how to process multiple\ninput files when using the Options class.\n\n```cpp\n#include \"MidiFile.h\"\n#include \"Options.h\"\n#include \u003ciostream\u003e\nusing namespace std;\nusing namespace smf;\n\nint main(int argc, char** argv) {\n   Options options;\n   options.process(argc, argv);\n   MidiFile midifile;\n   if (options.getArgCount() == 0) {\n      midifile.read(cin);\n      cout \u003c\u003c midifile.getFileDurationInSeconds() \u003c\u003c \" seconds\" \u003c\u003c endl;\n   } else {\n      int count = options.getArgCount();\n      for (int i=0; i\u003ccount; i++) {\n         string filename = options.getArg(i+1);\n         if (count \u003e 1) cout \u003c\u003c filename \u003c\u003c \"\\t\";\n         midifile.read(filename);\n         cout \u003c\u003c midifile.getFileDurationInSeconds() \u003c\u003c \" seconds\" \u003c\u003c endl;\n      }\n   }\n   return 0;\n}\n```\n\n\n\n### How to extract text meta-messages from a MIDI file. ###\n\nThe `MidiMessage::isText()` function will return true if the message\nis a text meta-message.  The following program merges all tracks into\na single list and does one loop checking for text meta-messages, printing\nthem out when found.  The `MidiMessage::getMetaContent()` function extracts\nthe text string of the message from the raw MIDI file bytes.\n\n```cpp\n#include \"MidiFile.h\"\n#include \u003ciostream\u003e\n\nusing namespace std;\nusing namespace smf;\n\nint main(int argc, char** argv) {\n   MidiFile midifile;\n   if (argc == 1) midifile.read(cin);\n   else midifile.read(argv[1]);\n   if (!midifile.status()) {\n      cerr \u003c\u003c \"Problem reading MIDI file\" \u003c\u003c endl;\n      return 1;\n   }\n\n   midifile.joinTracks();\n   for (int i=0; i\u003cmidifile[0].getEventCount(); i++) {\n      if (midifile[0][i].isText()) {\n         string content = midifile[0][i].getMetaContent();\n         cout \u003c\u003c content \u003c\u003c endl;\n      }\n   }\n\n   return 0;\n}\n```\n\nExtracting lyrics would work the same by using `.isLyricText()` instead of\n`.isText()`, and a track-name meta-message is identified by `.isTrackName()`.\n\n\n\n### How to convert a Type-1 MIDI file into a Type-0 MIDI file ###\n\nHere is a demonstration of converting a multi-track MIDI file into\na single-track MIDI file:\n\n```cpp\n#include \"MidiFile.h\"\n#include \u003ciostream\u003e\nusing namespace std;\nusing namespace smf;\n\nint main(int argc, char** argv) {\n   if (argc != 3) {\n      cerr \u003c\u003c \"Usage: \" \u003c\u003c argv[0] \u003c\u003c \" input output\" \u003c\u003c endl;\n      return 1;\n   }\n   MidiFile midifile;\n   midifile.read(argv[1]);\n   if (!midifile.status()) {\n      cerr \u003c\u003c \"Problem reading MIDI file\" \u003c\u003c endl;\n      return 1;\n   }\n\n   midifile.joinTracks();\n   midifile.write(argv[2]);\n\n   return 0;\n}\n\n```\n\nThe `.joinTracks()` function merges all tracks into a single track.  And if\na `MidiFile` object has only one track when it is being written, it will be\nwritten as a type-0 (single-track) MIDI file.\n\n\n\n### How to check for a drum track in a MIDI file ###\n\nIn General MIDI files, the drum track is on the 10th channel, which is\nrepresented by the integer 9.  The following example searches through\nthe MIDI events in each track until it finds a note on channel 9:\n\n```cpp\n#include \"MidiFile.h\"\n#include \u003ciostream\u003e\nusing namespace std;\nusing namespace smf;\n\nint main(int argc, char** argv) {\n   MidiFile midifile;\n   if (argc == 1) midifile.read(cin);\n   else midifile.read(argv[1]);\n   if (!midifile.status()) {\n      cerr \u003c\u003c \"Problem reading MIDI file\" \u003c\u003c endl;\n      return 1;\n   }\n\n   bool found = false;\n   for (int i=0; i\u003cmidifile.getTrackCount(); i++) {\n      for (int j=0; j\u003cmidifile[i].getEventCount(); j++) {\n         if (midifile[i][j].isNote()) {\n            int channel = midifile[i][j].getChannelNibble();\n            if (channel == 9) {\n               found = true;\n               break;\n            }\n         }\n      }\n      if (found == true) break;\n   }\n   if (found) cout \u003c\u003c \"Has a percussion part.\" \u003c\u003c endl;\n   else cout \u003c\u003c \"Does not have a percussion part.\" \u003c\u003c endl;\n\n   return 0;\n}\n```\n\n\n\n### How to delete percussion notes in a MIDI file ###\n\nFor some music-analysis applications, it is useful to remove percussion\nnotes from a MIDI file.  Here is an example of how that can be done with\nthe midifile library.\n\n```cpp\n#include \"MidiFile.h\"\n#include \u003ciostream\u003e\nusing namespace std;\nusing namespace smf;\n\nint main(int argc, char** argv) {\n   if (argc != 3) {\n      cerr \u003c\u003c \"Usage: \" \u003c\u003c argv[0] \u003c\u003c \" input output\" \u003c\u003c endl;\n      return 1;\n   }\n   MidiFile midifile;\n   midifile.read(argv[1]);\n   if (!midifile.status()) {\n      cerr \u003c\u003c \"Problem reading MIDI file\" \u003c\u003c endl;\n      return 1;\n   }\n\n   for (int i=0; i\u003cmidifile.getTrackCount(); i++) {\n      for (int j=0; j\u003cmidifile[i].getEventCount(); j++) {\n         if (midifile[i][j].isNote()) {\n            int channel = midifile[i][j].getChannelNibble();\n            if (channel == 9) {\n               midifile[i][j].clear();\n            }\n         }\n      }\n   }\n\n   midifile.removeEmpties();  // optional\n   midifile.write(argv[2]);\n   return 0;\n}\n```\n\nTo delete a MIDI message, clear its vector base class.  This will\nleave an empty `MidiEvent` in the track, but the `MidiFile::write()`\nfunction will ignore any empty `MidiMessage`s.  The\n`MidiFile::removeEmpties()` function can be called to explicitly remove\nany empty `MidiEvents` from the track.\n\n\n\n### How to transpose pitches in a MIDI file ###\n\nThis example shows how to transpose notes in a MIDI file.  Care should be\ntaken to avoid transposing channel 10 in General MIDI, since this is\nreserved for the drum track (and most MIDI files use the General MIDI\nconvention).\n\n```cpp\n#include \"MidiFile.h\"\n#include \"Options.h\"\n#include \u003ciostream\u003e\n\nusing namespace std;\nusing namespace smf;\n\nint main(int argc, char** argv) {\n   Options options;\n   options.define(\"t|transpose=i:0\", \"Semitones to transpose by\");\n   options.process(argc, argv);\n\n   MidiFile midifile;\n   if (options.getArgCount() == 0) midifile.read(cin);\n   else midifile.read(options.getArg(1));\n   if (!midifile.status()) {\n      cerr \u003c\u003c \"Could not read MIDI file\" \u003c\u003c endl;\n      return 1;\n   }\n\n   int transpose = options.getInteger(\"transpose\");\n   for (int i=0; i\u003cmidifile.getTrackCount(); i++) {\n      for (int j=0; j\u003cmidifile[i].getEventCount(); j++) {\n         if (!midifile[i][j].isNote()) continue;\n         if (midifile[i][j].getChannel() == 9) continue;\n         int newkey = transpose + midifile[i][j].getP1();\n         midifile[i][j].setP1(newkey);\n      }\n   }\n\n   if (options.getArgCount() \u003c 2) cout \u003c\u003c midifile;\n   else midifile.write(options.getArg(2));\n   return 0;\n}\n```\n\n\n\n### How to list instrument numbers used in a MIDI file ###\n\nThe following example lists all of the instrument numbers\nused in a MIDI file.  It does not analyze the drum track.\n\n```cpp\n#include \"MidiFile.h\"\n#include \"Options.h\"\n#include \u003cset\u003e\n#include \u003cutility\u003e\n#include \u003ciostream\u003e\n\nusing namespace std;\nusing namespace smf;\n\nint main(int argc, char** argv) {\n   Options options;\n   options.process(argc, argv);\n   MidiFile midifile;\n   if (options.getArgCount() == 0) midifile.read(cin);\n   else midifile.read(options.getArg(1));\n   if (!midifile.status()) {\n      cerr \u003c\u003c \"Could not read MIDI file\" \u003c\u003c endl;\n      return 1;\n   }\n\n   pair\u003cint, int\u003e trackinst;\n   set\u003cpair\u003cint, int\u003e\u003e iset;\n   for (int i=0; i\u003cmidifile.getTrackCount(); i++) {\n      for (int j=0; j\u003cmidifile[i].getEventCount(); j++) {\n         if (midifile[i][j].isTimbre()) {\n            trackinst.first = i;\n            trackinst.second = midifile[i][j].getP1();\n            iset.insert(trackinst);\n         }\n      }\n   }\n   for (auto it : iset)\n      cout \u003c\u003c \"Track:\" \u003c\u003c it.first \u003c\u003c \"\\tInstrument:\" \u003c\u003c it.second \u003c\u003c endl;\n   return 0;\n}\n```\n\n\n\n### How to emulate temperaments in a MIDI file ###\n\nIf you want to simulate temperaments in a Standard MIDI file without\na synthesizer that specifically knows about temperaments, then this\nexample is useful.  Each pitch-class is placed into a separate track\nand MIDI channel.  A pitch-bend message is then added to the start\nof each track in each channel to control the temperament. Care is taken\nto avoid MIDI channel 10, which is reserved for percussion timbres\nin General MIDI.\n\n```cpp\n#include \"MidiFile.h\"\n#include \u003ciostream\u003e\nusing namespace std;\nusing namespace smf;\n\nint main(int argc, char** argv) {\n   if (argc != 3) {\n      cerr \u003c\u003c \"Usage: \" \u003c\u003c argv[0] \u003c\u003c \" input output\" \u003c\u003c endl;\n      return 1;\n   }\n   MidiFile midifile;\n   midifile.read(argv[1]);\n   if (!midifile.status()) {\n      cerr \u003c\u003c \"Problem reading MIDI file\" \u003c\u003c endl;\n      return 1;\n   }\n\n   midifile.joinTracks();\n   for (int i=0; i\u003cmidifile[0].getEventCount(); i++) {\n      midifile[0][i].seq = 2;\n      if (!midifile[0][i].isNote()) {\n         midifile[0][i].track = 0;\n         continue;\n      }\n      int pc = midifile[0][i].getP1() % 12;\n      int channel = midifile[0][i].getChannelNibble();\n      if (channel != 9) {\n         midifile[0][i].track = pc + 1;\n         if (pc \u003e= 9) pc++;\n         midifile[0][i].setChannelNibble(pc);\n      } else midifile[0][i].track = 13;\n   }\n   midifile.splitTracks();\n\n   double maxbend = 200.0;  // typical pitch-bend depth in cents on synthesizers\n   // pythagorean tuning deviations from equal temperament in cents.\n   vector\u003cdouble\u003e pythagorean = {-3.91, 9.78, 0.00, -9.78, 3.91, -5.87, 7.82,\n         -1.96, -11.73, 1.96, -7.82, 5.87};\n\n   for (int i=0; i\u003c12; i++) {\n      int maxtrack = midifile.getTrackCount();\n      int track = i+1;\n      if (track \u003e= maxtrack) break;\n      int channel = i;\n      if (i \u003e= 9) channel++;\n      double bend = pythagorean[i] / maxbend;\n      MidiEvent* me = midifile.addPitchBend(track, 0, channel, bend);\n      me-\u003eseq = 1;\n   }\n\n   midifile.sortTracks();\n   midifile.write(argv[2]);\n\n   return 0;\n}\n```\n\nThe `MidiFile::splitTracks()` function will generate 13 or 14 tracks.  Track 0\nwill contain all non-note MIDI messages from the original file, while tracks\n1 to 12 will contain notes of a specific pitch-class on MIDI channels 1-12,\nskipping channel 10 (the General MIDI percussion channel).  Percussion notes\nwill be placed in track 13, but remain on channel 10.\n\nThe use of `MidiEvent::seq` being set to 1 and 2 in the program is used to\nforce the first notes at tick time 0 to be placed after the pitch bend\nmessages inserted at the same timestamp when `MidiFile::sortTracks()`\nis called (events with a lower sequence number will be placed before those\nwith a higher number if they occur at the same time in a track when sorting\nthe events in the track).  The pitch-bend messages would probably be sorted\nbefore the notes anyway, but using `seq` should guarantee they are placed\nbefore the first notes.\n\nTry this program on Bach's Well-Tempered Clavier, Book I, Fugue No. 4\nin C-sharp minor:\n\n```\n4d 54 68 64 00 00 00 06 00 01 00 06 00 78 4d 54 72 6b 00 00 00 13 00 ff 51 03 08 8e 6c 00 ff 58 04 02 01 30 08 00 ff 2f\n00 4d 54 72 6b 00 00 09 bd b2 50 90 49 40 81 70 80 49 40 00 90 48 40 81 70 80 48 40 00 90 4c 40 81 70 80 4c 40 00 90 4b\n40 83 60 80 4b 40 00 90 49 40 82 68 80 49 40 00 90 4b 40 78 80 4b 40 00 90 4c 40 78 80 4c 40 00 90 4b 40 78 80 4b 40 00\n90 49 40 81 70 80 49 40 00 90 47 40 81 70 80 47 40 00 90 49 40 81 70 80 49 40 00 90 4b 40 81 70 80 4b 40 82 68 90 4c 40\n78 80 4c 40 00 90 4b 40 78 80 4b 40 00 90 49 40 78 80 49 40 00 90 47 40 78 80 47 40 00 90 4b 40 78 80 4b 40 00 90 50 40\n82 68 80 50 40 00 90 4e 40 78 80 4e 40 00 90 50 40 78 80 50 40 00 90 51 40 78 80 51 40 00 90 53 40 84 58 80 53 40 00 90\n51 40 78 80 51 40 00 90 50 40 78 80 50 40 00 90 4e 40 78 80 4e 40 00 90 50 40 3c 80 50 40 00 90 4e 40 3c 80 4e 40 00 90\n4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 49 40 83 60 80 49 40 00 90 47 40 82 68 80 47 40 00 90 49 40 78 80 49 40\n00 90 47 40 78 80 47 40 00 90 45 40 78 80 45 40 00 90 44 40 81 70 80 44 40 00 90 46 40 78 80 46 40 00 90 47 40 78 80 47\n40 00 90 49 40 81 70 80 49 40 00 90 47 40 83 60 80 47 40 00 90 46 40 81 70 80 46 40 00 90 47 40 84 58 80 47 40 00 90 49\n40 78 80 49 40 00 90 4b 40 78 80 4b 40 00 90 4c 40 78 80 4c 40 00 90 4c 40 81 70 80 4c 40 00 90 4b 40 81 70 80 4b 40 00\n90 4c 40 78 80 4c 40 00 90 4b 40 78 80 4b 40 00 90 4c 40 78 80 4c 40 00 90 4e 40 78 80 4e 40 00 90 50 40 3c 80 50 40 00\n90 4e 40 3c 80 4e 40 00 90 50 40 3c 80 50 40 00 90 51 40 3c 80 51 40 00 90 50 40 3c 80 50 40 00 90 4e 40 3c 80 4e 40 00\n90 4c 40 3c 80 4c 40 00 90 50 40 3c 80 50 40 00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4e 40 3c 80 4e 40 00\n90 50 40 3c 80 50 40 00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 4e 40 3c 80 4e 40 00\n90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 4c 40 3c 80 4c 40 00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00\n90 4b 40 3c 80 4b 40 00 90 49 40 3c 80 49 40 00 90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 49 40 3c 80 49 40 00\n90 4b 40 3c 80 4b 40 00 90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 49 40 3c 80 49 40 00 90 47 40 3c 80 47 40 00\n90 4b 40 3c 80 4b 40 00 90 49 40 3c 80 49 40 00 90 47 40 3c 80 47 40 00 90 49 40 3c 80 49 40 00 90 4b 40 3c 80 4b 40 00\n90 49 40 3c 80 49 40 00 90 47 40 3c 80 47 40 00 90 46 40 3c 80 46 40 00 90 49 40 3c 80 49 40 00 90 47 40 82 2c 80 47 40\n00 90 49 40 3c 80 49 40 00 90 4b 40 3c 80 4b 40 00 90 47 40 3c 80 47 40 00 90 49 40 82 68 80 49 40 00 90 4c 40 78 80 4c\n40 00 90 4b 40 82 68 80 4b 40 00 90 4e 40 78 80 4e 40 00 90 4c 40 84 58 80 4c 40 00 90 4b 40 81 70 80 4b 40 00 90 49 40\n81 70 80 49 40 00 90 48 40 3c 80 48 40 00 90 46 40 3c 80 46 40 00 90 48 40 78 80 48 40 00 90 4b 40 78 80 4b 40 00 90 50\n40 3c 80 50 40 00 90 4e 40 3c 80 4e 40 00 90 50 40 3c 80 50 40 00 90 51 40 3c 80 51 40 00 90 50 40 3c 80 50 40 00 90 4e\n40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 50 40 3c 80 50 40 00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4e\n40 3c 80 4e 40 00 90 50 40 3c 80 50 40 00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 4e\n40 3c 80 4e 40 00 90 4d 40 81 70 80 4d 40 00 90 51 40 81 70 80 51 40 00 90 50 40 84 58 80 50 40 00 90 4e 40 3c 80 4e 40\n00 90 4c 40 3c 80 4c 40 00 90 4a 40 81 70 80 4a 40 78 90 49 40 78 80 49 40 00 90 4e 40 78 80 4e 40 00 90 4e 40 78 80 4e\n40 00 90 4e 40 78 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4a 40 3c 80 4a 40 00 90 4c 40 82 68 80 4c 40 00 90 4a 40 3c 80\n4a 40 00 90 49 40 3c 80 49 40 00 90 4a 40 83 60 80 4a 40 00 90 49 40 81 70 80 49 40 00 90 4e 40 81 70 80 4e 40 00 90 4c\n40 81 70 80 4c 40 00 90 4c 40 81 34 80 4c 40 00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4a 40 3c 80 4a 40 00\n90 49 40 3c 80 49 40 00 90 4c 40 3c 80 4c 40 00 90 4a 40 3c 80 4a 40 00 90 49 40 3c 80 49 40 00 90 4a 40 3c 80 4a 40 00\n90 4c 40 3c 80 4c 40 00 90 4a 40 3c 80 4a 40 00 90 49 40 3c 80 49 40 00 90 47 40 3c 80 47 40 00 90 4a 40 3c 80 4a 40 00\n90 49 40 83 60 80 49 40 00 90 48 40 81 70 80 48 40 00 90 4c 40 81 70 80 4c 40 00 90 4b 40 84 58 80 4b 40 00 90 44 40 78\n80 44 40 00 90 49 40 78 80 49 40 00 90 49 40 78 80 49 40 00 90 49 40 78 80 49 40 00 90 47 40 3c 80 47 40 00 90 45 40 3c\n80 45 40 00 90 47 40 83 60 80 47 40 00 90 45 40 81 70 80 45 40 00 90 44 40 81 70 80 44 40 81 70 90 4b 40 83 60 80 4b 40\n00 90 4a 40 81 70 80 4a 40 00 90 4e 40 81 70 80 4e 40 00 90 4d 40 81 70 80 4d 40 00 90 4c 40 81 70 80 4c 40 00 90 4b 40\n3c 80 4b 40 00 90 49 40 3c 80 49 40 00 90 4b 40 3c 80 4b 40 00 90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 49 40\n3c 80 49 40 00 90 47 40 3c 80 47 40 00 90 4b 40 3c 80 4b 40 00 90 49 40 3c 80 49 40 00 90 47 40 3c 80 47 40 00 90 49 40\n3c 80 49 40 00 90 4b 40 3c 80 4b 40 00 90 49 40 3c 80 49 40 00 90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 49 40\n3c 80 49 40 00 90 48 40 81 70 80 48 40 00 90 47 40 81 70 80 47 40 00 90 46 40 81 70 80 46 40 00 90 45 40 81 70 80 45 40\n00 90 44 40 81 70 80 44 40 89 30 90 49 40 83 60 80 49 40 00 90 48 40 81 70 80 48 40 00 90 4c 40 81 70 80 4c 40 00 90 4b\n40 85 50 80 4b 40 00 90 49 40 83 60 80 49 40 00 90 48 40 81 70 80 48 40 78 90 49 40 3c 80 49 40 00 90 4b 40 3c 80 4b 40\n00 90 4c 40 78 80 4c 40 00 90 4e 40 78 80 4e 40 00 90 50 40 3c 80 50 40 00 90 4e 40 3c 80 4e 40 00 90 50 40 3c 80 50 40\n00 90 51 40 3c 80 51 40 00 90 50 40 3c 80 50 40 00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 50 40 3c 80 50 40\n00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4e 40 3c 80 4e 40 00 90 50 40 3c 80 50 40 00 90 4e 40 3c 80 4e 40\n00 90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40\n00 90 4c 40 3c 80 4c 40 00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4a 40 3c 80 4a 40 00 90 49 40 3c 80 49 40\n00 90 4c 40 3c 80 4c 40 00 90 4a 40 3c 80 4a 40 00 90 49 40 3c 80 49 40 00 90 4a 40 3c 80 4a 40 00 90 4c 40 3c 80 4c 40\n00 90 4a 40 3c 80 4a 40 00 90 49 40 3c 80 49 40 00 90 47 40 3c 80 47 40 00 90 4a 40 3c 80 4a 40 00 90 49 40 3c 80 49 40\n00 90 47 40 3c 80 47 40 00 90 49 40 3c 80 49 40 00 90 4a 40 3c 80 4a 40 00 90 49 40 3c 80 49 40 00 90 47 40 3c 80 47 40\n00 90 45 40 3c 80 45 40 00 90 49 40 3c 80 49 40 00 90 47 40 3c 80 47 40 00 90 45 40 3c 80 45 40 00 90 47 40 3c 80 47 40\n00 90 49 40 3c 80 49 40 00 90 47 40 3c 80 47 40 00 90 45 40 3c 80 45 40 00 90 44 40 3c 80 44 40 00 90 47 40 3c 80 47 40\n00 90 45 40 81 70 80 45 40 81 70 90 49 40 83 60 80 49 40 00 90 48 40 81 70 80 48 40 00 90 4c 40 81 70 80 4c 40 00 90 4b\n40 84 58 80 4b 40 00 90 49 40 78 80 49 40 00 90 50 40 78 80 50 40 00 90 50 40 78 80 50 40 00 90 50 40 78 80 50 40 00 90\n4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4e 40 81 70 80 4e 40 00 90 4c 40 83 60 80 4c 40 00 90 4b 40 81 70 80 4b\n40 00 90 4f 40 81 70 80 4f 40 00 90 4e 40 81 70 80 4e 40 00 90 42 40 81 70 80 42 40 00 90 41 40 81 70 80 41 40 00 90 45\n40 81 70 80 45 40 00 90 44 40 78 80 44 40 83 60 90 48 40 78 80 48 40 00 90 4e 40 78 80 4e 40 00 90 4e 40 78 80 4e 40 00\n90 4e 40 78 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 4c 40 78 80 4c 40 00 90 4b 40 3c 80 4b 40 00\n90 49 40 3c 80 49 40 00 90 4b 40 78 80 4b 40 00 90 48 40 78 80 48 40 00 90 49 40 85 50 80 49 40 00 90 48 40 81 70 80 48\n40 00 90 47 40 81 70 80 47 40 00 90 46 40 81 70 80 46 40 00 90 45 40 81 70 80 45 40 00 90 44 40 83 60 80 44 40 00 90 46\n40 81 70 80 46 40 00 90 48 40 81 70 80 48 40 00 90 49 40 83 60 80 49 40 00 90 48 40 81 70 80 48 40 00 90 4c 40 83 60 80\n4c 40 00 90 4b 40 78 80 4b 40 00 90 49 40 78 80 49 40 00 90 48 40 81 70 80 48 40 00 90 49 40 83 60 80 49 40 00 90 48 40\n81 70 80 48 40 00 90 49 40 8f 00 80 49 40 77 90 00 00 00 ff 2f 00 4d 54 72 6b 00 00 09 40 ab 10 91 44 40 81 70 81 44 40\n00 91 41 40 81 70 81 41 40 00 91 45 40 81 70 81 45 40 00 91 44 40 81 70 81 44 40 00 91 42 40 83 60 81 42 40 00 91 49 40\n83 60 81 49 40 00 91 47 40 83 60 81 47 40 00 91 45 40 81 70 81 45 40 00 91 44 40 81 70 81 44 40 00 91 45 40 82 68 81 45\n40 00 91 44 40 78 81 44 40 00 91 42 40 78 81 42 40 00 91 40 40 78 81 40 40 00 91 3f 40 81 70 81 3f 40 00 91 44 40 81 70\n81 44 40 00 91 44 40 81 70 81 44 40 00 91 43 40 81 70 81 43 40 00 91 44 40 81 70 81 44 40 00 91 3b 40 81 70 81 3b 40 00\n91 3d 40 82 68 81 3d 40 00 91 3d 40 78 81 3d 40 00 91 3f 40 78 81 3f 40 00 91 3d 40 78 81 3d 40 00 91 3f 40 78 81 3f 40\n00 91 41 40 78 81 41 40 00 91 42 40 81 70 81 42 40 00 91 45 40 81 70 81 45 40 00 91 44 40 81 70 81 44 40 3c 91 47 40 3c\n81 47 40 00 91 45 40 3c 81 45 40 00 91 44 40 3c 81 44 40 00 91 42 40 78 81 42 40 00 91 45 40 78 81 45 40 00 91 44 40 78\n81 44 40 00 91 42 40 78 81 42 40 00 91 41 40 81 70 81 41 40 00 91 42 40 82 68 81 42 40 00 91 40 40 84 58 81 40 40 00 91\n3f 40 81 70 81 3f 40 00 91 40 40 84 58 81 40 40 00 91 3f 40 78 81 3f 40 00 91 40 40 78 81 40 40 00 91 42 40 3c 81 42 40\n00 91 44 40 3c 81 44 40 00 91 42 40 81 70 81 42 40 00 91 47 40 82 68 81 47 40 00 91 49 40 78 81 49 40 00 91 47 40 78 81\n47 40 00 91 45 40 78 81 45 40 00 91 44 40 81 70 81 44 40 a1 60 91 49 40 81 70 81 49 40 00 91 48 40 81 70 81 48 40 00 91\n4c 40 81 70 81 4c 40 00 91 4b 40 85 50 81 4b 40 00 91 49 40 83 60 81 49 40 00 91 48 40 78 81 48 40 00 91 47 40 81 34 81\n47 40 00 91 47 40 3c 81 47 40 00 91 49 40 3c 81 49 40 00 91 4a 40 3c 81 4a 40 00 91 49 40 3c 81 49 40 00 91 47 40 3c 81\n47 40 00 91 45 40 3c 81 45 40 00 91 49 40 3c 81 49 40 00 91 47 40 3c 81 47 40 00 91 45 40 3c 81 45 40 00 91 47 40 3c 81\n47 40 00 91 49 40 3c 81 49 40 00 91 47 40 3c 81 47 40 00 91 45 40 3c 81 45 40 00 91 44 40 3c 81 44 40 00 91 47 40 3c 81\n47 40 00 91 45 40 82 2c 81 45 40 00 91 49 40 3c 81 49 40 00 91 47 40 3c 81 47 40 00 91 45 40 3c 81 45 40 00 91 44 40 81\n70 81 44 40 87 40 91 45 40 81 70 81 45 40 00 91 44 40 81 70 81 44 40 00 91 49 40 81 70 81 49 40 00 91 47 40 84 58 81 47\n40 00 91 40 40 78 81 40 40 00 91 45 40 78 81 45 40 00 91 45 40 78 81 45 40 00 91 45 40 78 81 45 40 00 91 44 40 3c 81 44\n40 00 91 42 40 3c 81 42 40 00 91 44 40 82 68 81 44 40 00 91 3d 40 3c 81 3d 40 00 91 3f 40 3c 81 3f 40 00 91 40 40 78 81\n40 40 00 91 42 40 78 81 42 40 00 91 44 40 3c 81 44 40 00 91 42 40 3c 81 42 40 00 91 44 40 3c 81 44 40 00 91 45 40 3c 81\n45 40 00 91 44 40 3c 81 44 40 00 91 42 40 3c 81 42 40 00 91 40 40 3c 81 40 40 00 91 44 40 3c 81 44 40 00 91 42 40 3c 81\n42 40 00 91 40 40 3c 81 40 40 00 91 42 40 3c 81 42 40 00 91 44 40 3c 81 44 40 00 91 42 40 3c 81 42 40 00 91 40 40 3c 81\n40 40 00 91 3f 40 3c 81 3f 40 00 91 42 40 3c 81 42 40 00 91 40 40 3c 81 40 40 00 91 3f 40 3c 81 3f 40 00 91 40 40 3c 81\n40 40 00 91 42 40 3c 81 42 40 00 91 40 40 3c 81 40 40 00 91 3f 40 3c 81 3f 40 00 91 3d 40 3c 81 3d 40 00 91 40 40 3c 81\n40 40 00 91 3f 40 3c 81 3f 40 00 91 3d 40 3c 81 3d 40 00 91 3f 40 3c 81 3f 40 00 91 40 40 3c 81 40 40 00 91 3e 40 3c 81\n3e 40 00 91 3d 40 3c 81 3d 40 00 91 3b 40 3c 81 3b 40 00 91 3e 40 3c 81 3e 40 00 91 3d 40 3c 81 3d 40 00 91 3b 40 3c 81\n3b 40 00 91 3d 40 3c 81 3d 40 00 91 3e 40 3c 81 3e 40 00 91 3d 40 3c 81 3d 40 00 91 40 40 3c 81 40 40 00 91 3f 40 3c 81\n3f 40 00 91 3d 40 3c 81 3d 40 00 91 48 40 81 70 81 48 40 00 91 3d 40 81 70 81 3d 40 00 91 3f 40 78 81 3f 40 00 91 3f 40\n78 81 3f 40 00 91 44 40 3c 81 44 40 00 91 46 40 3c 81 46 40 00 91 47 40 81 70 81 47 40 00 91 46 40 78 81 46 40 00 91 4b\n40 78 81 4b 40 00 91 4b 40 78 81 4b 40 00 91 4b 40 78 81 4b 40 00 91 49 40 3c 81 49 40 00 91 48 40 3c 81 48 40 00 91 49\n40 83 60 81 49 40 00 91 47 40 81 70 81 47 40 00 91 46 40 81 70 81 46 40 00 91 45 40 82 68 81 45 40 00 91 3f 40 78 81 3f\n40 00 91 44 40 78 81 44 40 00 91 44 40 81 70 81 44 40 00 91 42 40 3c 81 42 40 00 91 41 40 3c 81 41 40 00 91 42 40 83 60\n81 42 40 00 91 40 40 81 70 81 40 40 00 91 3f 40 81 70 81 3f 40 00 91 3d 40 81 70 81 3d 40 00 91 3f 40 83 60 81 3f 40 84\n58 91 44 40 78 81 44 40 00 91 49 40 78 81 49 40 00 91 49 40 78 81 49 40 00 91 49 40 78 81 49 40 00 91 48 40 3c 81 48 40\n00 91 46 40 3c 81 46 40 00 91 48 40 3c 81 48 40 00 91 49 40 3c 81 49 40 00 91 4b 40 3c 81 4b 40 00 91 48 40 3c 81 48 40\n00 91 44 40 3c 81 44 40 00 91 42 40 3c 81 42 40 00 91 44 40 3c 81 44 40 00 91 45 40 3c 81 45 40 00 91 44 40 3c 81 44 40\n00 91 42 40 3c 81 42 40 00 91 40 40 3c 81 40 40 00 91 44 40 3c 81 44 40 00 91 42 40 3c 81 42 40 00 91 40 40 3c 81 40 40\n00 91 42 40 3c 81 42 40 00 91 44 40 3c 81 44 40 00 91 42 40 3c 81 42 40 00 91 40 40 3c 81 40 40 00 91 3f 40 3c 81 3f 40\n00 91 42 40 3c 81 42 40 00 91 40 40 3c 81 40 40 00 91 44 40 3c 81 44 40 00 91 45 40 3c 81 45 40 00 91 47 40 3c 81 47 40\n00 91 49 40 3c 81 49 40 00 91 4b 40 3c 81 4b 40 00 91 48 40 3c 81 48 40 00 91 49 40 3c 81 49 40 00 91 4b 40 78 81 4b 40\n8b 20 91 42 40 78 81 42 40 00 91 47 40 78 81 47 40 00 91 47 40 78 81 47 40 00 91 47 40 78 81 47 40 00 91 45 40 3c 81 45\n40 00 91 44 40 3c 81 44 40 00 91 45 40 81 70 81 45 40 00 91 44 40 84 1c 81 44 40 00 91 44 40 3c 81 44 40 00 91 42 40 3c\n81 42 40 00 91 41 40 3c 81 41 40 00 91 42 40 81 70 81 42 40 00 91 44 40 82 2c 81 44 40 00 91 44 40 3c 81 44 40 00 91 42\n40 3c 81 42 40 00 91 40 40 3c 81 40 40 00 91 3f 40 3c 81 3f 40 00 91 45 40 3c 81 45 40 00 91 44 40 3c 81 44 40 00 91 42\n40 3c 81 42 40 00 91 40 40 3c 81 40 40 00 91 44 40 3c 81 44 40 00 91 49 40 3c 81 49 40 00 91 47 40 3c 81 47 40 00 91 45\n40 3c 81 45 40 00 91 44 40 3c 81 44 40 00 91 45 40 3c 81 45 40 00 91 42 40 3c 81 42 40 00 91 44 40 82 68 81 44 40 00 91\n49 40 3c 81 49 40 00 91 48 40 3c 81 48 40 00 91 49 40 82 68 81 49 40 00 91 46 40 78 81 46 40 00 91 4b 40 78 81 4b 40 00\n91 4b 40 78 81 4b 40 00 91 4b 40 78 81 4b 40 00 91 49 40 3c 81 49 40 00 91 47 40 3c 81 47 40 00 91 49 40 81 70 81 49 40\n00 91 47 40 81 70 81 47 40 00 91 47 40 81 70 81 47 40 00 91 46 40 81 70 81 46 40 00 91 4a 40 81 70 81 4a 40 00 91 49 40\n83 60 81 49 40 78 91 44 40 78 81 44 40 00 91 49 40 78 81 49 40 00 91 49 40 78 81 49 40 00 91 49 40 78 81 49 40 00 91 48\n40 3c 81 48 40 00 91 46 40 3c 81 46 40 00 91 48 40 3c 81 48 40 00 91 49 40 3c 81 49 40 00 91 4b 40 81 70 81 4b 40 00 91\n49 40 3c 81 49 40 00 91 48 40 3c 81 48 40 00 91 49 40 81 70 81 49 40 00 91 42 40 81 70 81 42 40 00 91 44 40 83 60 81 44\n40 00 91 42 40 82 68 81 42 40 82 68 91 44 40 78 81 44 40 00 91 42 40 3c 81 42 40 00 91 40 40 3c 81 40 40 00 91 42 40 78\n81 42 40 00 91 42 40 78 81 42 40 00 91 42 40 78 81 42 40 00 91 40 40 3c 81 40 40 00 91 3f 40 3c 81 3f 40 00 91 40 40 82\n68 81 40 40 00 91 42 40 3c 81 42 40 00 91 44 40 3c 81 44 40 00 91 45 40 78 81 45 40 00 91 44 40 81 70 81 44 40 00 91 40\n40 78 81 40 40 00 91 45 40 78 81 45 40 00 91 45 40 78 81 45 40 00 91 45 40 78 81 45 40 00 91 44 40 3c 81 44 40 00 91 42\n40 3c 81 42 40 00 91 44 40 78 81 44 40 00 91 46 40 3c 81 46 40 00 91 48 40 3c 81 48 40 00 91 49 40 81 70 81 49 40 00 91\n46 40 81 70 81 46 40 00 91 44 40 81 70 81 44 40 00 91 44 40 85 50 81 44 40 00 91 44 40 81 70 81 44 40 00 91 42 40 81 70\n81 42 40 00 91 41 40 81 70 81 41 40 00 91 45 40 81 70 81 45 40 00 91 44 40 87 40 81 44 40 77 90 00 00 00 ff 2f 00 4d 54\n72 6b 00 00 08 ba 98 30 92 3d 40 81 70 82 3d 40 00 92 3c 40 81 70 82 3c 40 00 92 40 40 81 70 82 40 40 00 92 3f 40 83 60\n82 3f 40 00 92 3d 40 81 70 82 3d 40 00 92 42 40 82 68 82 42 40 00 92 40 40 78 82 40 40 00 92 3f 40 78 82 3f 40 00 92 3d\n40 78 82 3d 40 00 92 3d 40 81 70 82 3d 40 00 92 3b 40 81 70 82 3b 40 00 92 3d 40 81 70 82 3d 40 00 92 42 40 82 68 82 42\n40 00 92 40 40 78 82 40 40 00 92 3f 40 78 82 3f 40 00 92 3d 40 78 82 3d 40 00 92 3f 40 81 70 82 3f 40 00 92 44 40 81 70\n82 44 40 78 92 45 40 78 82 45 40 00 92 44 40 78 82 44 40 00 92 42 40 78 82 42 40 00 92 41 40 78 82 41 40 00 92 3d 40 78\n82 3d 40 00 92 42 40 81 70 82 42 40 00 92 40 40 85 50 82 40 40 00 92 44 40 81 70 82 44 40 00 92 46 40 81 70 82 46 40 92\n60 92 3d 40 81 70 82 3d 40 00 92 3c 40 81 70 82 3c 40 00 92 40 40 81 70 82 40 40 00 92 3f 40 83 60 82 3f 40 00 92 3d 40\n87 40 82 3d 40 00 92 36 40 78 82 36 40 00 92 38 40 78 82 38 40 00 92 3a 40 78 82 3a 40 00 92 3b 40 78 82 3b 40 00 92 3d\n40 83 60 82 3d 40 81 70 92 40 40 81 70 82 40 40 00 92 3f 40 81 70 82 3f 40 00 92 44 40 81 70 82 44 40 00 92 42 40 83 60\n82 42 40 00 92 40 40 81 70 82 40 40 8b 20 92 44 40 81 70 82 44 40 00 92 43 40 81 70 82 43 40 00 92 47 40 81 70 82 47 40\n00 92 46 40 84 58 82 46 40 00 92 3f 40 78 82 3f 40 00 92 44 40 82 68 82 44 40 00 92 42 40 3c 82 42 40 00 92 40 40 3c 82\n40 40 00 92 42 40 82 68 82 42 40 00 92 40 40 3c 82 40 40 00 92 42 40 3c 82 42 40 00 92 44 40 89 30 82 44 40 8c 18 92 3d\n40 78 82 3d 40 00 92 42 40 78 82 42 40 00 92 42 40 78 82 42 40 00 92 42 40 78 82 42 40 00 92 41 40 3c 82 41 40 00 92 3f\n40 3c 82 3f 40 00 92 41 40 81 70 82 41 40 00 92 42 40 78 82 42 40 00 92 36 40 3c 82 36 40 00 92 38 40 3c 82 38 40 00 92\n39 40 78 82 39 40 00 92 3b 40 78 82 3b 40 00 92 3d 40 3c 82 3d 40 00 92 3b 40 3c 82 3b 40 00 92 3d 40 3c 82 3d 40 00 92\n3e 40 3c 82 3e 40 00 92 3d 40 3c 82 3d 40 00 92 3b 40 3c 82 3b 40 00 92 39 40 3c 82 39 40 00 92 3d 40 3c 82 3d 40 00 92\n3b 40 3c 82 3b 40 00 92 39 40 3c 82 39 40 00 92 3b 40 3c 82 3b 40 00 92 3d 40 3c 82 3d 40 00 92 3b 40 3c 82 3b 40 00 92\n39 40 3c 82 39 40 00 92 38 40 3c 82 38 40 00 92 3b 40 3c 82 3b 40 00 92 39 40 3c 82 39 40 00 92 38 40 3c 82 38 40 00 92\n39 40 3c 82 39 40 00 92 3b 40 3c 82 3b 40 00 92 39 40 3c 82 39 40 00 92 3b 40 3c 82 3b 40 00 92 3d 40 3c 82 3d 40 00 92\n3e 40 3c 82 3e 40 00 92 40 40 3c 82 40 40 00 92 3e 40 3c 82 3e 40 00 92 40 40 3c 82 40 40 00 92 42 40 3c 82 42 40 00 92\n40 40 3c 82 40 40 00 92 3e 40 3c 82 3e 40 00 92 3d 40 3c 82 3d 40 00 92 40 40 3c 82 40 40 00 92 3e 40 3c 82 3e 40 00 92\n3d 40 3c 82 3d 40 00 92 3e 40 3c 82 3e 40 00 92 40 40 3c 82 40 40 00 92 3e 40 3c 82 3e 40 00 92 3d 40 3c 82 3d 40 00 92\n3b 40 3c 82 3b 40 00 92 3e 40 3c 82 3e 40 00 92 3d 40 3c 82 3d 40 00 92 3b 40 3c 82 3b 40 00 92 3d 40 3c 82 3d 40 00 92\n3e 40 3c 82 3e 40 00 92 3d 40 3c 82 3d 40 00 92 3b 40 3c 82 3b 40 00 92 39 40 3c 82 39 40 00 92 3d 40 3c 82 3d 40 00 92\n3b 40 83 60 82 3b 40 00 92 39 40 3c 82 39 40 00 92 38 40 3c 82 38 40 00 92 36 40 3c 82 36 40 00 92 34 40 3c 82 34 40 00\n92 33 40 3c 82 33 40 00 92 31 40 3c 82 31 40 00 92 30 40 3c 82 30 40 00 92 31 40 3c 82 31 40 00 92 33 40 81 70 82 33 40\n8e 08 92 31 40 78 82 31 40 00 92 36 40 78 82 36 40 00 92 36 40 78 82 36 40 00 92 36 40 78 82 36 40 00 92 34 40 3c 82 34\n40 00 92 33 40 3c 82 33 40 00 92 34 40 81 70 82 34 40 00 92 37 40 81 70 82 37 40 00 92 38 40 81 70 82 38 40 00 92 35 40\n78 82 35 40 87 40 92 33 40 78 82 33 40 00 92 38 40 78 82 38 40 00 92 38 40 78 82 38 40 00 92 38 40 78 82 38 40 00 92 36\n40 3c 82 36 40 00 92 34 40 3c 82 34 40 00 92 36 40 82 2c 82 36 40 00 92 39 40 3c 82 39 40 00 92 38 40 3c 82 38 40 00 92\n36 40 3c 82 36 40 00 92 35 40 3c 82 35 40 00 92 33 40 3c 82 33 40 00 92 35 40 3c 82 35 40 00 92 31 40 3c 82 31 40 00 92\n36 40 3c 82 36 40 00 92 35 40 3c 82 35 40 00 92 36 40 3c 82 36 40 00 92 38 40 3c 82 38 40 00 92 39 40 3c 82 39 40 00 92\n38 40 3c 82 38 40 00 92 39 40 3c 82 39 40 00 92 3b 40 3c 82 3b 40 00 92 3d 40 3c 82 3d 40 00 92 3c 40 3c 82 3c 40 00 92\n3d 40 3c 82 3d 40 00 92 3f 40 3c 82 3f 40 00 92 40 40 3c 82 40 40 00 92 3f 40 3c 82 3f 40 00 92 40 40 3c 82 40 40 00 92\n42 40 3c 82 42 40 00 92 44 40 3c 82 44 40 00 92 42 40 3c 82 42 40 00 92 44 40 3c 82 44 40 00 92 45 40 3c 82 45 40 00 92\n44 40 3c 82 44 40 00 92 42 40 3c 82 42 40 00 92 40 40 3c 82 40 40 00 92 44 40 3c 82 44 40 00 92 42 40 3c 82 42 40 00 92\n40 40 3c 82 40 40 00 92 42 40 3c 82 42 40 00 92 44 40 3c 82 44 40 00 92 42 40 3c 82 42 40 00 92 40 40 3c 82 40 40 00 92\n3f 40 3c 82 3f 40 00 92 42 40 3c 82 42 40 00 92 40 40 3c 82 40 40 00 92 3f 40 3c 82 3f 40 00 92 40 40 3c 82 40 40 00 92\n42 40 3c 82 42 40 00 92 40 40 3c 82 40 40 00 92 3f 40 3c 82 3f 40 00 92 3d 40 3c 82 3d 40 00 92 40 40 3c 82 40 40 00 92\n3f 40 81 70 82 3f 40 91 68 92 38 40 78 82 38 40 00 92 3d 40 78 82 3d 40 00 92 3d 40 78 82 3d 40 00 92 3d 40 78 82 3d 40\n00 92 3c 40 3c 82 3c 40 00 92 3a 40 3c 82 3a 40 00 92 3c 40 81 70 82 3c 40 00 92 3d 40 83 60 82 3d 40 00 92 3b 40 82 68\n82 3b 40 00 92 42 40 78 82 42 40 00 92 41 40 81 70 82 41 40 00 92 42 40 81 70 82 42 40 00 92 3b 40 81 70 82 3b 40 00 92\n3d 40 84 1c 82 3d 40 00 92 3d 40 3c 82 3d 40 00 92 3b 40 3c 82 3b 40 00 92 39 40 3c 82 39 40 00 92 38 40 83 60 82 38 40\n93 58 92 3b 40 78 82 3b 40 00 92 40 40 78 82 40 40 00 92 40 40 78 82 40 40 00 92 40 40 78 82 40 40 00 92 3e 40 3c 82 3e\n40 00 92 3d 40 3c 82 3d 40 00 92 3b 40 81 70 82 3b 40 78 92 3d 40 78 82 3d 40 00 92 42 40 78 82 42 40 00 92 42 40 78 82\n42 40 00 92 42 40 78 82 42 40 00 92 40 40 3c 82 40 40 00 92 3f 40 3c 82 3f 40 00 92 40 40 81 70 82 40 40 00 92 42 40 83\n24 82 42 40 00 92 44 40 3c 82 44 40 00 92 45 40 78 82 45 40 00 92 44 40 3c 82 44 40 00 92 42 40 3c 82 42 40 00 92 44 40\n78 82 44 40 00 92 42 40 3c 82 42 40 00 92 40 40 3c 82 40 40 00 92 3f 40 81 70 82 3f 40 00 92 40 40 83 60 82 40 40 00 92\n3f 40 78 82 3f 40 00 92 3d 40 78 82 3d 40 00 92 3f 40 78 82 3f 40 00 92 41 40 3c 82 41 40 00 92 42 40 3c 82 42 40 00 92\n44 40 78 82 44 40 00 92 44 40 78 82 44 40 78 92 3d 40 78 82 3d 40 00 92 3f 40 78 82 3f 40 00 92 3d 40 78 82 3d 40 00 92\n3c 40 81 70 82 3c 40 00 92 3d 40 83 60 82 3d 40 00 92 3f 40 81 70 82 3f 40 00 92 3d 40 78 82 3d 40 00 92 3d 40 78 82 3d\n40 00 92 42 40 78 82 42 40 00 92 42 40 78 82 42 40 00 92 42 40 78 82 42 40 00 92 40 40 3c 82 40 40 00 92 3f 40 3c 82 3f\n40 00 92 40 40 78 82 40 40 00 92 42 40 3c 82 42 40 00 92 44 40 3c 82 44 40 00 92 46 40 81 70 82 46 40 00 92 3f 40 83 60\n82 3f 40 00 92 40 40 81 70 82 40 40 00 92 3f 40 82 68 82 3f 40 00 92 40 40 3c 82 40 40 00 92 42 40 3c 82 42 40 00 92 41\n40 78 82 41 40 00 92 3d 40 83 60 82 3d 40 00 92 3d 40 78 82 3d 40 00 92 42 40 78 82 42 40 00 92 42 40 78 82 42 40 00 92\n42 40 81 70 82 42 40 00 92 41 40 78 82 41 40 00 92 3f 40 78 82 3f 40 00 92 41 40 83 60 82 41 40 77 90 00 00 00 ff 2f 00\n4d 54 72 6b 00 00 07 ac 8b 20 93 38 40 83 60 83 38 40 00 93 37 40 81 70 83 37 40 00 93 3b 40 81 70 83 3b 40 00 93 3a 40\n83 60 83 3a 40 00 93 38 40 81 70 83 38 40 00 93 39 40 82 68 83 39 40 00 93 38 40 3c 83 38 40 00 93 36 40 3c 83 36 40 00\n93 38 40 78 83 38 40 00 93 3d 40 78 83 3d 40 00 93 36 40 78 83 36 40 00 93 38 40 3c 83 38 40 00 93 39 40 3c 83 39 40 00\n93 3b 40 82 68 83 3b 40 00 93 39 40 78 83 39 40 00 93 38 40 78 83 38 40 00 93 36 40 78 83 36 40 00 93 38 40 81 70 83 38\n40 00 93 36 40 78 83 36 40 00 93 34 40 78 83 34 40 00 93 33 40 82 68 83 33 40 00 93 32 40 78 83 32 40 00 93 31 40 87 40\n83 31 40 90 70 93 38 40 81 70 83 38 40 00 93 37 40 81 70 83 37 40 00 93 3b 40 81 70 83 3b 40 00 93 3a 40 83 60 83 3a 40\n00 93 38 40 78 83 38 40 00 93 39 40 78 83 39 40 00 93 38 40 78 83 38 40 00 93 36 40 78 83 36 40 00 93 35 40 81 70 83 35\n40 00 93 39 40 81 70 83 39 40 00 93 38 40 83 60 83 38 40 00 93 36 40 84 58 83 36 40 00 93 38 40 3c 83 38 40 00 93 36 40\n3c 83 36 40 00 93 34 40 78 83 34 40 00 93 36 40 3c 83 36 40 00 93 38 40 3c 83 38 40 00 93 39 40 78 83 39 40 00 93 36 40\n78 83 36 40 00 93 38 40 81 70 83 38 40 00 93 31 40 89 30 83 31 40 00 93 36 40 81 70 83 36 40 00 93 34 40 78 83 34 40 00\n93 33 40 78 83 33 40 00 93 34 40 78 83 34 40 00 93 36 40 78 83 36 40 00 93 38 40 78 83 38 40 00 93 36 40 78 83 36 40 00\n93 38 40 78 83 38 40 00 93 39 40 78 83 39 40 00 93 3b 40 89 30 83 3b 40 00 93 3d 40 81 70 83 3d 40 00 93 3c 40 81 70 83\n3c 40 00 93 40 40 81 70 83 40 40 00 93 3f 40 83 60 83 3f 40 00 93 3d 40 84 58 83 3d 40 00 93 3b 40 78 83 3b 40 00 93 3a\n40 78 83 3a 40 00 93 38 40 81 70 83 38 40 00 93 37 40 3c 83 37 40 00 93 35 40 3c 83 35 40 00 93 37 40 81 70 83 37 40 00\n93 38 40 3c 83 38 40 00 93 3a 40 3c 83 3a 40 00 93 38 40 3c 83 38 40 00 93 37 40 3c 83 37 40 00 93 38 40 3c 83 38 40 00\n93 3a 40 3c 83 3a 40 00 93 3b 40 3c 83 3b 40 00 93 38 40 3c 83 38 40 00 93 39 40 3c 83 39 40 00 93 3b 40 3c 83 3b 40 00\n93 39 40 3c 83 39 40 00 93 38 40 3c 83 38 40 00 93 3a 40 3c 83 3a 40 00 93 3b 40 3c 83 3b 40 00 93 3d 40 3c 83 3d 40 00\n93 3a 40 3c 83 3a 40 00 93 3b 40 3c 83 3b 40 00 93 3d 40 3c 83 3d 40 00 93 3b 40 3c 83 3b 40 00 93 3a 40 3c 83 3a 40 00\n93 3c 40 3c 83 3c 40 00 93 3d 40 3c 83 3d 40 00 93 3f 40 3c 83 3f 40 00 93 3c 40 3c 83 3c 40 00 93 3d 40 83 60 83 3d 40\n98 30 93 36 40 81 70 83 36 40 00 93 35 40 81 70 83 35 40 00 93 39 40 81 70 83 39 40 00 93 38 40 83 60 83 38 40 00 93 36\n40 83 60 83 36 40 93 58 93 38 40 78 83 38 40 00 93 3d 40 78 83 3d 40 00 93 3d 40 78 83 3d 40 00 93 3d 40 78 83 3d 40 00\n93 3c 40 3c 83 3c 40 00 93 3a 40 3c 83 3a 40 00 93 3c 40 81 70 83 3c 40 00 93 3d 40 81 70 83 3d 40 00 93 39 40 81 70 83\n39 40 00 93 36 40 81 70 83 36 40 00 93 38 40 81 70 83 38 40 00 93 35 40 81 70 83 35 40 00 93 36 40 81 70 83 36 40 00 93\n38 40 83 60 83 38 40 00 93 33 40 83 60 83 33 40 9b 18 93 2c 40 78 83 2c 40 00 93 31 40 78 83 31 40 00 93 31 40 78 83 31\n40 00 93 31 40 78 83 31 40 00 93 30 40 3c 83 30 40 00 93 2e 40 3c 83 2e 40 00 93 30 40 81 70 83 30 40 00 93 31 40 81 70\n83 31 40 90 70 93 31 40 83 60 83 31 40 00 93 30 40 81 70 83 30 40 00 93 34 40 81 70 83 34 40 00 93 33 40 83 60 83 33 40\n00 93 31 40 78 83 31 40 00 93 34 40 78 83 34 40 00 93 39 40 78 83 39 40 00 93 39 40 78 83 39 40 00 93 39 40 78 83 39 40\n00 93 38 40 3c 83 38 40 00 93 36 40 3c 83 36 40 00 93 38 40 83 60 83 38 40 00 93 36 40 81 70 83 36 40 00 93 38 40 83 60\n83 38 40 00 93 39 40 81 70 83 39 40 00 93 36 40 82 2c 83 36 40 00 93 36 40 3c 83 36 40 00 93 34 40 3c 83 34 40 00 93 33\n40 3c 83 33 40 00 93 34 40 78 83 34 40 00 93 31 40 78 83 31 40 00 93 38 40 83 60 83 38 40 00 93 36 40 81 70 83 36 40 00\n93 33 40 81 70 83 33 40 00 93 34 40 3c 83 34 40 00 93 33 40 3c 83 33 40 00 93 34 40 3c 83 34 40 00 93 36 40 3c 83 36 40\n00 93 34 40 3c 83 34 40 00 93 33 40 3c 83 33 40 00 93 31 40 3c 83 31 40 00 93 34 40 3c 83 34 40 00 93 33 40 3c 83 33 40\n00 93 31 40 3c 83 31 40 00 93 33 40 3c 83 33 40 00 93 34 40 3c 83 34 40 00 93 33 40 3c 83 33 40 00 93 31 40 3c 83 31 40\n00 93 30 40 3c 83 30 40 00 93 33 40 3c 83 33 40 00 93 31 40 78 83 31 40 00 93 34 40 78 83 34 40 00 93 39 40 78 83 39 40\n00 93 39 40 78 83 39 40 00 93 39 40 78 83 39 40 00 93 37 40 3c 83 37 40 00 93 36 40 3c 83 36 40 00 93 34 40 81 70 83 34\n40 78 93 36 40 78 83 36 40 00 93 3b 40 78 83 3b 40 00 93 3b 40 78 83 3b 40 00 93 3b 40 78 83 3b 40 00 93 39 40 3c 83 39\n40 00 93 38 40 3c 83 38 40 00 93 39 40 3c 83 39 40 00 93 38 40 3c 83 38 40 00 93 36 40 3c 83 36 40 00 93 34 40 3c 83 34\n40 00 93 33 40 81 70 83 33 40 78 93 38 40 78 83 38 40 00 93 3f 40 78 83 3f 40 00 93 3f 40 78 83 3f 40 00 93 3f 40 78 83\n3f 40 00 93 3d 40 3c 83 3d 40 00 93 3c 40 3c 83 3c 40 00 93 3d 40 83 60 83 3d 40 00 93 3c 40 81 70 83 3c 40 00 93 40 40\n82 68 83 40 40 00 93 31 40 78 83 31 40 00 93 36 40 78 83 36 40 00 93 36 40 78 83 36 40 00 93 36 40 78 83 36 40 00 93 35\n40 3c 83 35 40 00 93 33 40 3c 83 33 40 00 93 31 40 83 60 83 31 40 00 93 33 40 82 68 83 33 40 00 93 33 40 78 83 33 40 00\n93 38 40 78 83 38 40 00 93 38 40 78 83 38 40 00 93 38 40 78 83 38 40 00 93 36 40 3c 83 36 40 00 93 34 40 3c 83 34 40 00\n93 36 40 78 83 36 40 00 93 36 40 78 83 36 40 00 93 36 40 78 83 36 40 00 93 34 40 3c 83 34 40 00 93 33 40 3c 83 33 40 00\n93 34 40 78 83 34 40 00 93 33 40 3c 83 33 40 00 93 31 40 3c 83 31 40 00 93 33 40 78 83 33 40 00 93 2c 40 78 83 2c 40 00\n93 31 40 78 83 31 40 00 93 31 40 78 83 31 40 00 93 31 40 78 83 31 40 00 93 2f 40 3c 83 2f 40 00 93 2e 40 3c 83 2e 40 00\n93 33 40 82 2c 83 33 40 00 93 34 40 3c 83 34 40 00 93 36 40 81 34 83 36 40 00 93 34 40 3c 83 34 40 00 93 33 40 3c 83 33\n40 00 93 31 40 3c 83 31 40 00 93 38 40 83 60 83 38 40 00 93 39 40 82 68 83 39 40 00 93 38 40 3c 83 38 40 00 93 39 40 3c\n83 39 40 00 93 3b 40 78 83 3b 40 00 93 39 40 78 83 39 40 00 93 38 40 78 83 38 40 00 93 36 40 78 83 36 40 00 93 3d 40 78\n83 3d 40 00 93 3b 40 3c 83 3b 40 00 93 39 40 3c 83 39 40 00 93 38 40 78 83 38 40 00 93 36 40 78 83 36 40 00 93 38 40 83\n60 83 38 40 77 90 00 00 00 ff 2f 00 4d 54 72 6b 00 00 07 cd 00 90 31 40 83 60 80 31 40 00 90 30 40 81 70 80 30 40 00 90\n34 40 81 70 80 34 40 00 90 33 40 83 60 80 33 40 00 90 31 40 78 80 31 40 00 90 33 40 78 80 33 40 00 90 34 40 82 68 80 34\n40 00 90 33 40 3c 80 33 40 00 90 31 40 3c 80 31 40 00 90 33 40 78 80 33 40 00 90 38 40 78 80 38 40 00 90 31 40 78 80 31\n40 00 90 33 40 3c 80 33 40 00 90 34 40 3c 80 34 40 00 90 36 40 82 68 80 36 40 00 90 34 40 78 80 34 40 00 90 33 40 78 80\n33 40 00 90 31 40 78 80 31 40 00 90 33 40 81 70 80 33 40 00 90 31 40 82 68 80 31 40 00 90 2f 40 78 80 2f 40 00 90 2d 40\n78 80 2d 40 00 90 2c 40 78 80 2c 40 00 90 2d 40 81 70 80 2d 40 00 90 2e 40 81 70 80 2e 40 00 90 30 40 81 70 80 30 40 00\n90 31 40 81 70 80 31 40 00 90 2c 40 78 80 2c 40 00 90 2d 40 78 80 2d 40 00 90 2f 40 82 68 80 2f 40 00 90 2d 40 78 80 2d\n40 00 90 2c 40 78 80 2c 40 00 90 2a 40 78 80 2a 40 00 90 31 40 81 70 80 31 40 00 90 2d 40 82 68 80 2d 40 00 90 2c 40 78\n80 2c 40 00 90 2a 40 78 80 2a 40 00 90 28 40 78 80 28 40 00 90 2a 40 81 70 80 2a 40 00 90 2c 40 81 70 80 2c 40 00 90 2d\n40 78 80 2d 40 00 90 2c 40 78 80 2c 40 00 90 2d 40 78 80 2d 40 00 90 2f 40 78 80 2f 40 00 90 31 40 78 80 31 40 00 90 2f\n40 78 80 2f 40 00 90 31 40 78 80 31 40 00 90 33 40 78 80 33 40 00 90 34 40 81 70 80 34 40 00 90 31 40 82 68 80 31 40 00\n90 2f 40 78 80 2f 40 00 90 2e 40 78 80 2e 40 00 90 2c 40 78 80 2c 40 00 90 31 40 81 70 80 31 40 00 90 33 40 81 70 80 33\n40 00 90 2c 40 81 70 80 2c 40 9a 20 90 2f 40 81 70 80 2f 40 00 90 2e 40 81 70 80 2e 40 00 90 33 40 81 70 80 33 40 00 90\n31 40 83 60 80 31 40 00 90 2f 40 84 58 80 2f 40 00 90 38 40 78 80 38 40 00 90 36 40 78 80 36 40 00 90 34 40 78 80 34 40\n00 90 3b 40 81 70 80 3b 40 00 90 2f 40 81 70 80 2f 40 00 90 34 40 81 70 80 34 40 00 90 39 40 81 70 80 39 40 00 90 38 40\n81 70 80 38 40 00 90 3d 40 83 60 80 3d 40 00 90 3c 40 81 70 80 3c 40 00 90 3d 40 81 70 80 3d 40 95 48 90 31 40 3c 80 31\n40 00 90 33 40 3c 80 33 40 00 90 34 40 78 80 34 40 00 90 36 40 78 80 36 40 00 90 38 40 3c 80 38 40 00 90 36 40 3c 80 36\n40 00 90 38 40 3c 80 38 40 00 90 39 40 3c 80 39 40 00 90 38 40 3c 80 38 40 00 90 36 40 3c 80 36 40 00 90 34 40 3c 80 34\n40 00 90 38 40 3c 80 38 40 00 90 36 40 3c 80 36 40 00 90 34 40 3c 80 34 40 00 90 36 40 3c 80 36 40 00 90 38 40 3c 80 38\n40 00 90 36 40 3c 80 36 40 00 90 34 40 3c 80 34 40 00 90 33 40 3c 80 33 40 00 90 36 40 3c 80 36 40 00 90 34 40 3c 80 34\n40 00 90 33 40 3c 80 33 40 00 90 34 40 3c 80 34 40 00 90 36 40 3c 80 36 40 00 90 34 40 3c 80 34 40 00 90 39 40 3c 80 39\n40 00 90 38 40 3c 80 38 40 00 90 39 40 3c 80 39 40 00 90 33 40 3c 80 33 40 00 90 31 40 3c 80 31 40 00 90 33 40 3c 80 33\n40 00 90 34 40 3c 80 34 40 00 90 33 40 3c 80 33 40 00 90 38 40 3c 80 38 40 00 90 36 40 3c 80 36 40 00 90 38 40 3c 80 38\n40 00 90 31 40 81 70 80 31 40 95 48 90 34 40 78 80 34 40 00 90 39 40 78 80 39 40 00 90 39 40 78 80 39 40 00 90 39 40 78\n80 39 40 00 90 38 40 3c 80 38 40 00 90 36 40 3c 80 36 40 00 90 38 40 81 70 80 38 40 00 90 39 40 81 70 80 39 40 00 90 36\n40 81 70 80 36 40 00 90 2f 40 81 70 80 2f 40 00 90 34 40 81 70 80 34 40 00 90 2d 40 83 60 80 2d 40 00 90 2c 40 81 70 80\n2c 40 91 68 90 2c 40 78 80 2c 40 00 90 31 40 78 80 31 40 00 90 31 40 78 80 31 40 00 90 31 40 78 80 31 40 00 90 2f 40 3c\n80 2f 40 00 90 2e 40 3c 80 2e 40 00 90 2f 40 3c 80 2f 40 00 90 2e 40 3c 80 2e 40 00 90 2c 40 3c 80 2c 40 00 90 2f 40 3c\n80 2f 40 00 90 2e 40 3c 80 2e 40 00 90 2c 40 3c 80 2c 40 00 90 2e 40 3c 80 2e 40 00 90 2f 40 3c 80 2f 40 00 90 2e 40 3c\n80 2e 40 00 90 2c 40 3c 80 2c 40 00 90 2a 40 3c 80 2a 40 00 90 2e 40 3c 80 2e 40 00 90 2c 40 3c 80 2c 40 00 90 2a 40 3c\n80 2a 40 00 90 2c 40 3c 80 2c 40 00 90 2e 40 3c 80 2e 40 00 90 2c 40 3c 80 2c 40 00 90 2f 40 3c 80 2f 40 00 90 2e 40 3c\n80 2e 40 00 90 2c 40 3c 80 2c 40 00 90 2b 40 81 70 80 2b 40 00 90 2c 40 81 70 80 2c 40 00 90 2e 40 81 70 80 2e 40 00 90\n33 40 81 70 80 33 40 00 90 2c 40 81 70 80 2c 40 85 50 90 25 40 83 60 80 25 40 00 90 30 40 81 70 80 30 40 00 90 28 40 81\n70 80 28 40 00 90 27 40 83 60 80 27 40 00 90 25 40 78 80 25 40 00 90 25 40 3c 80 25 40 00 90 27 40 3c 80 27 40 00 90 28\n40 78 80 28 40 00 90 2a 40 78 80 2a 40 00 90 2c 40 3c 80 2c 40 00 90 2a 40 3c 80 2a 40 00 90 2c 40 3c 80 2c 40 00 90 2d\n40 3c 80 2d 40 00 90 2c 40 3c 80 2c 40 00 90 2a 40 3c 80 2a 40 00 90 28 40 3c 80 28 40 00 90 2c 40 3c 80 2c 40 00 90 2a\n40 3c 80 2a 40 00 90 28 40 3c 80 28 40 00 90 2a 40 3c 80 2a 40 00 90 2c 40 3c 80 2c 40 00 90 2a 40 3c 80 2a 40 00 90 28\n40 3c 80 28 40 00 90 27 40 3c 80 27 40 00 90 2a 40 3c 80 2a 40 00 90 28 40 78 80 28 40 00 90 34 40 78 80 34 40 00 90 39\n40 78 80 39 40 00 90 39 40 78 80 39 40 00 90 39 40 78 80 39 40 00 90 38 40 3c 80 38 40 00 90 36 40 3c 80 36 40 00 90 38\n40 78 80 38 40 00 90 2c 40 78 80 2c 40 00 90 31 40 78 80 31 40 00 90 2f 40 78 80 2f 40 00 90 2d 40 81 70 80 2d 40 00 90\n2c 40 78 80 2c 40 8f 00 90 31 40 78 80 31 40 00 90 36 40 78 80 36 40 00 90 36 40 78 80 36 40 00 90 36 40 78 80 36 40 00\n90 35 40 3c 80 35 40 00 90 33 40 3c 80 33 40 00 90 35 40 81 70 80 35 40 00 90 36 40 81 70 80 36 40 86 48 90 2c 40 78 80\n2c 40 00 90 31 40 78 80 31 40 00 90 31 40 78 80 31 40 00 90 31 40 78 80 31 40 00 90 30 40 3c 80 30 40 00 90 2e 40 3c 80\n2e 40 00 90 30 40 3c 80 30 40 00 90 31 40 3c 80 31 40 00 90 33 40 3c 80 33 40 00 90 30 40 3c 80 30 40 00 90 28 40 81 70\n80 28 40 78 90 2d 40 78 80 2d 40 00 90 27 40 81 70 80 27 40 78 90 2c 40 78 80 2c 40 00 90 25 40 78 80 25 40 8c 18 90 31\n40 81 70 80 31 40 00 90 30 40 81 70 80 30 40 00 90 34 40 81 70 80 34 40 00 90 33 40 83 60 80 33 40 00 90 31 40 78 80 31\n40 00 90 34 40 78 80 34 40 00 90 39 40 78 80 39 40 00 90 39 40 78 80 39 40 00 90 39 40 78 80 39 40 00 90 38 40 3c 80 38\n40 00 90 36 40 3c 80 36 40 00 90 34 40 3c 80 34 40 00 90 33 40 3c 80 33 40 00 90 31 40 3c 80 31 40 00 90 2f 40 3c 80 2f\n40 00 90 2e 40 81 70 80 2e 40 00 90 2d 40 82 68 80 2d 40 00 90 2c 40 3c 80 2c 40 00 90 2a 40 3c 80 2a 40 00 90 29 40 81\n70 80 29 40 00 90 2a 40 83 60 80 2a 40 00 90 2c 40 8f 00 80 2c 40 00 90 2b 40 83 60 80 2b 40 00 90 2c 40 87 40 80 2c 40\n00 90 31 40 8f 00 80 31 40 77 90 00 00 00 ff 2f 00\n```\n\n\n### How to split MIDI tracks into separate MIDI files ###\n\nThe following program takes a multi-track MIDI file with three\nor more tracks, and splits out each track into a separate MIDI\nfile.  The expression track of the original MIDI file is copied\ninto the 0th track of the new MIDI files, and the individual\ntracks of the first MIDI file are copied to the 1st track of\nthe output MIDI files.\n\n```cpp\n#include \"MidiFile.h\"\n#include \u003ciostream\u003e\n#include \u003cvector\u003e\nusing namespace std;\nusing namespace smf;\n\nint main(int argc, char** argv) {\n   if (argc != 3) {\n      cerr \u003c\u003c \"Usage: \" \u003c\u003c argv[0] \u003c\u003c \" input output\" \u003c\u003c endl;\n      return 1;\n   }\n   MidiFile midifile(argv[1]);\n   if (!midifile.status()) {\n      cerr \u003c\u003c \"Problem reading input\" \u003c\u003c endl;\n      return 1;\n   }\n   if (midifile.getTrackCount() \u003c 3) {\n      cerr \u003c\u003c \"Not enough tracks to split\" \u003c\u003c endl;\n      return 1;\n   }\n   string basename = argv[2];\n   if (basename.substr(basename.size() - 4) == \".mid\")\n      basename = basename.substr(0, basename.size() - 4);\n   int outcount = midifile.getTrackCount() - 1;\n   vector\u003cMidiFile\u003e outputs(outcount);\n   for (int i=0; i\u003coutcount; i++) {\n      outputs[i].addTrack();\n      for (int j=0; j\u003cmidifile[0].getEventCount(); j++)\n         outputs[i].addEvent(midifile[0][j]);\n      for (int j=0; j\u003cmidifile[i+1].getEventCount(); j++)\n         outputs[i].addEvent(1, midifile[i+1][j]);\n   }\n   for (int i=0; i\u003coutcount; i++)\n      outputs[i].write(basename + \"-\" + to_string(i+1) + \".mid\");\n   return 0;\n}\n```\n\nHere is the first file extracted from the MIDI file input for the\ntemperament example:\n\n```\n4d 54 68 64 00 00 00 06 00 01 00 02 00 78 4d 54 72 6b 00 00 00 13 00 ff 51\n03 08 8e 6c 00 ff 58 04 02 01 30 08 00 ff 2f 00 4d 54 72 6b 00 00 09 bd b2\n50 90 49 40 81 70 80 49 40 00 90 48 40 81 70 80 48 40 00 90 4c 40 81 70 80\n4c 40 00 90 4b 40 83 60 80 4b 40 00 90 49 40 82 68 80 49 40 00 90 4b 40 78\n80 4b 40 00 90 4c 40 78 80 4c 40 00 90 4b 40 78 80 4b 40 00 90 49 40 81 70\n80 49 40 00 90 47 40 81 70 80 47 40 00 90 49 40 81 70 80 49 40 00 90 4b 40\n81 70 80 4b 40 82 68 90 4c 40 78 80 4c 40 00 90 4b 40 78 80 4b 40 00 90 49\n40 78 80 49 40 00 90 47 40 78 80 47 40 00 90 4b 40 78 80 4b 40 00 90 50 40\n82 68 80 50 40 00 90 4e 40 78 80 4e 40 00 90 50 40 78 80 50 40 00 90 51 40\n78 80 51 40 00 90 53 40 84 58 80 53 40 00 90 51 40 78 80 51 40 00 90 50 40\n78 80 50 40 00 90 4e 40 78 80 4e 40 00 90 50 40 3c 80 50 40 00 90 4e 40 3c\n80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 49 40 83 60\n80 49 40 00 90 47 40 82 68 80 47 40 00 90 49 40 78 80 49 40 00 90 47 40 78\n80 47 40 00 90 45 40 78 80 45 40 00 90 44 40 81 70 80 44 40 00 90 46 40 78\n80 46 40 00 90 47 40 78 80 47 40 00 90 49 40 81 70 80 49 40 00 90 47 40 83\n60 80 47 40 00 90 46 40 81 70 80 46 40 00 90 47 40 84 58 80 47 40 00 90 49\n40 78 80 49 40 00 90 4b 40 78 80 4b 40 00 90 4c 40 78 80 4c 40 00 90 4c 40\n81 70 80 4c 40 00 90 4b 40 81 70 80 4b 40 00 90 4c 40 78 80 4c 40 00 90 4b\n40 78 80 4b 40 00 90 4c 40 78 80 4c 40 00 90 4e 40 78 80 4e 40 00 90 50 40\n3c 80 50 40 00 90 4e 40 3c 80 4e 40 00 90 50 40 3c 80 50 40 00 90 51 40 3c\n80 51 40 00 90 50 40 3c 80 50 40 00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80\n4c 40 00 90 50 40 3c 80 50 40 00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c\n40 00 90 4e 40 3c 80 4e 40 00 90 50 40 3c 80 50 40 00 90 4e 40 3c 80 4e 40\n00 90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 4e 40 3c 80 4e 40 00\n90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 4c 40 3c 80 4c 40 00 90\n4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 49\n40 3c 80 49 40 00 90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 49 40\n3c 80 49 40 00 90 4b 40 3c 80 4b 40 00 90 4c 40 3c 80 4c 40 00 90 4b 40 3c\n80 4b 40 00 90 49 40 3c 80 49 40 00 90 47 40 3c 80 47 40 00 90 4b 40 3c 80\n4b 40 00 90 49 40 3c 80 49 40 00 90 47 40 3c 80 47 40 00 90 49 40 3c 80 49\n40 00 90 4b 40 3c 80 4b 40 00 90 49 40 3c 80 49 40 00 90 47 40 3c 80 47 40\n00 90 46 40 3c 80 46 40 00 90 49 40 3c 80 49 40 00 90 47 40 82 2c 80 47 40\n00 90 49 40 3c 80 49 40 00 90 4b 40 3c 80 4b 40 00 90 47 40 3c 80 47 40 00\n90 49 40 82 68 80 49 40 00 90 4c 40 78 80 4c 40 00 90 4b 40 82 68 80 4b 40\n00 90 4e 40 78 80 4e 40 00 90 4c 40 84 58 80 4c 40 00 90 4b 40 81 70 80 4b\n40 00 90 49 40 81 70 80 49 40 00 90 48 40 3c 80 48 40 00 90 46 40 3c 80 46\n40 00 90 48 40 78 80 48 40 00 90 4b 40 78 80 4b 40 00 90 50 40 3c 80 50 40\n00 90 4e 40 3c 80 4e 40 00 90 50 40 3c 80 50 40 00 90 51 40 3c 80 51 40 00\n90 50 40 3c 80 50 40 00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90\n50 40 3c 80 50 40 00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4e\n40 3c 80 4e 40 00 90 50 40 3c 80 50 40 00 90 4e 40 3c 80 4e 40 00 90 4c 40\n3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 4e 40 3c 80 4e 40 00 90 4d 40 81\n70 80 4d 40 00 90 51 40 81 70 80 51 40 00 90 50 40 84 58 80 50 40 00 90 4e\n40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4a 40 81 70 80 4a 40 78 90 49\n40 78 80 49 40 00 90 4e 40 78 80 4e 40 00 90 4e 40 78 80 4e 40 00 90 4e 40\n78 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4a 40 3c 80 4a 40 00 90 4c 40 82\n68 80 4c 40 00 90 4a 40 3c 80 4a 40 00 90 49 40 3c 80 49 40 00 90 4a 40 83\n60 80 4a 40 00 90 49 40 81 70 80 49 40 00 90 4e 40 81 70 80 4e 40 00 90 4c\n40 81 70 80 4c 40 00 90 4c 40 81 34 80 4c 40 00 90 4e 40 3c 80 4e 40 00 90\n4c 40 3c 80 4c 40 00 90 4a 40 3c 80 4a 40 00 90 49 40 3c 80 49 40 00 90 4c\n40 3c 80 4c 40 00 90 4a 40 3c 80 4a 40 00 90 49 40 3c 80 49 40 00 90 4a 40\n3c 80 4a 40 00 90 4c 40 3c 80 4c 40 00 90 4a 40 3c 80 4a 40 00 90 49 40 3c\n80 49 40 00 90 47 40 3c 80 47 40 00 90 4a 40 3c 80 4a 40 00 90 49 40 83 60\n80 49 40 00 90 48 40 81 70 80 48 40 00 90 4c 40 81 70 80 4c 40 00 90 4b 40\n84 58 80 4b 40 00 90 44 40 78 80 44 40 00 90 49 40 78 80 49 40 00 90 49 40\n78 80 49 40 00 90 49 40 78 80 49 40 00 90 47 40 3c 80 47 40 00 90 45 40 3c\n80 45 40 00 90 47 40 83 60 80 47 40 00 90 45 40 81 70 80 45 40 00 90 44 40\n81 70 80 44 40 81 70 90 4b 40 83 60 80 4b 40 00 90 4a 40 81 70 80 4a 40 00\n90 4e 40 81 70 80 4e 40 00 90 4d 40 81 70 80 4d 40 00 90 4c 40 81 70 80 4c\n40 00 90 4b 40 3c 80 4b 40 00 90 49 40 3c 80 49 40 00 90 4b 40 3c 80 4b 40\n00 90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 49 40 3c 80 49 40 00\n90 47 40 3c 80 47 40 00 90 4b 40 3c 80 4b 40 00 90 49 40 3c 80 49 40 00 90\n47 40 3c 80 47 40 00 90 49 40 3c 80 49 40 00 90 4b 40 3c 80 4b 40 00 90 49\n40 3c 80 49 40 00 90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 49 40\n3c 80 49 40 00 90 48 40 81 70 80 48 40 00 90 47 40 81 70 80 47 40 00 90 46\n40 81 70 80 46 40 00 90 45 40 81 70 80 45 40 00 90 44 40 81 70 80 44 40 89\n30 90 49 40 83 60 80 49 40 00 90 48 40 81 70 80 48 40 00 90 4c 40 81 70 80\n4c 40 00 90 4b 40 85 50 80 4b 40 00 90 49 40 83 60 80 49 40 00 90 48 40 81\n70 80 48 40 78 90 49 40 3c 80 49 40 00 90 4b 40 3c 80 4b 40 00 90 4c 40 78\n80 4c 40 00 90 4e 40 78 80 4e 40 00 90 50 40 3c 80 50 40 00 90 4e 40 3c 80\n4e 40 00 90 50 40 3c 80 50 40 00 90 51 40 3c 80 51 40 00 90 50 40 3c 80 50\n40 00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 50 40 3c 80 50 40\n00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4e 40 3c 80 4e 40 00\n90 50 40 3c 80 50 40 00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90\n4b 40 3c 80 4b 40 00 90 4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4b\n40 3c 80 4b 40 00 90 4c 40 3c 80 4c 40 00 90 4e 40 3c 80 4e 40 00 90 4c 40\n3c 80 4c 40 00 90 4a 40 3c 80 4a 40 00 90 49 40 3c 80 49 40 00 90 4c 40 3c\n80 4c 40 00 90 4a 40 3c 80 4a 40 00 90 49 40 3c 80 49 40 00 90 4a 40 3c 80\n4a 40 00 90 4c 40 3c 80 4c 40 00 90 4a 40 3c 80 4a 40 00 90 49 40 3c 80 49\n40 00 90 47 40 3c 80 47 40 00 90 4a 40 3c 80 4a 40 00 90 49 40 3c 80 49 40\n00 90 47 40 3c 80 47 40 00 90 49 40 3c 80 49 40 00 90 4a 40 3c 80 4a 40 00\n90 49 40 3c 80 49 40 00 90 47 40 3c 80 47 40 00 90 45 40 3c 80 45 40 00 90\n49 40 3c 80 49 40 00 90 47 40 3c 80 47 40 00 90 45 40 3c 80 45 40 00 90 47\n40 3c 80 47 40 00 90 49 40 3c 80 49 40 00 90 47 40 3c 80 47 40 00 90 45 40\n3c 80 45 40 00 90 44 40 3c 80 44 40 00 90 47 40 3c 80 47 40 00 90 45 40 81\n70 80 45 40 81 70 90 49 40 83 60 80 49 40 00 90 48 40 81 70 80 48 40 00 90\n4c 40 81 70 80 4c 40 00 90 4b 40 84 58 80 4b 40 00 90 49 40 78 80 49 40 00\n90 50 40 78 80 50 40 00 90 50 40 78 80 50 40 00 90 50 40 78 80 50 40 00 90\n4e 40 3c 80 4e 40 00 90 4c 40 3c 80 4c 40 00 90 4e 40 81 70 80 4e 40 00 90\n4c 40 83 60 80 4c 40 00 90 4b 40 81 70 80 4b 40 00 90 4f 40 81 70 80 4f 40\n00 90 4e 40 81 70 80 4e 40 00 90 42 40 81 70 80 42 40 00 90 41 40 81 70 80\n41 40 00 90 45 40 81 70 80 45 40 00 90 44 40 78 80 44 40 83 60 90 48 40 78\n80 48 40 00 90 4e 40 78 80 4e 40 00 90 4e 40 78 80 4e 40 00 90 4e 40 78 80\n4e 40 00 90 4c 40 3c 80 4c 40 00 90 4b 40 3c 80 4b 40 00 90 4c 40 78 80 4c\n40 00 90 4b 40 3c 80 4b 40 00 90 49 40 3c 80 49 40 00 90 4b 40 78 80 4b 40\n00 90 48 40 78 80 48 40 00 90 49 40 85 50 80 49 40 00 90 48 40 81 70 80 48\n40 00 90 47 40 81 70 80 47 40 00 90 46 40 81 70 80 46 40 00 90 45 40 81 70\n80 45 40 00 90 44 40 83 60 80 44 40 00 90 46 40 81 70 80 46 40 00 90 48 40\n81 70 80 48 40 00 90 49 40 83 60 80 49 40 00 90 48 40 81 70 80 48 40 00 90\n4c 40 83 60 80 4c 40 00 90 4b 40 78 80 4b 40 00 90 49 40 78 80 49 40 00 90\n48 40 81 70 80 48 40 00 90 49 40 83 60 80 49 40 00 90 48 40 81 70 80 48 40\n00 90 49 40 8f 00 80 49 40 77 90 00 00 00 ff 2f 00\n```\n\n\n\n### How to create vibrato with pitch-bend messages in a MIDI file ###\n\nThis example demonstrates the generation of a constant vibrato for notes\nin a MIDI file (on a particular channel).  The program adds an extra\ntrack at the end of the file to store the pitch bends.  The vibrato\nrate is constant regardless of the tempo setting for the MIDI file,\nsince the vibrato is calculated in physical time rather than tick time.\nThe `MidiFile::getAbsoluteTickTime()` function calculates the conversion\nbetween physical time in seconds and tick time in the MIDI file.\n\n```cpp\n#include \"MidiFile.h\"\n#include \"Options.h\"\n#include \u003ciostream\u003e\n#include \u003cutility\u003e\n#include \u003ccmath\u003e\nusing namespace std;\nusing namespace smf;\n\nint main(int argc, char** argv) {\n   Options options;\n   options.define(\"f|frequency=d:4.0\",     \"vibrato frequency\");\n   options.define(\"d|depth=d:20.0\",        \"vibrato depth in cents\");\n   options.define(\"b|bend-max=d:200.0\",    \"pitch bend depth\");\n   options.define(\"s|sample-rate=d:100.0\", \"sample rate\");\n   options.define(\"o|output-file=s\",       \"output filename\");\n   options.define(\"c|channel=i:0\",         \"output channel\");\n   options.process(argc, argv);\n\n   MidiFile midifile;\n   if (options.getArgCount() == 0) midifile.read(cin);\n   else midifile.read(options.getArg(1));\n   if (!midifile.status()) {\n      cerr \u003c\u003c \"Problem reading file\" \u003c\u003c endl;\n      return 1;\n   }\n\n   string filename  = options.getString(\"output-file\");\n   int    channel   = options.getInteger(\"channel\");\n   double freq      = options.getDouble(\"frequency\");\n   double depth     = options.getDouble(\"depth\");\n   double bend      = options.getDouble(\"bend-max\");\n   double srate     = options.getDouble(\"sample-rate\");\n   double phase     = 0.0;\n   double twopi     = 2.0 * M_PI;\n   double increment = twopi * freq / srate;\n   double maxtime   = midifile.getFileDurationInSeconds();\n   midifile.addTrack(); // store vibrato in separate track\n   pair\u003cint, double\u003e tickbend;\n   vector\u003cpair\u003cdouble, double\u003e\u003e storage;\n   int count = maxtime * srate;\n   storage.reserve(maxtime * srate + 1000);\n   for (int i=0; i\u003ccount; i++) {\n      tickbend.first = int(midifile.getAbsoluteTickTime(i/srate) + 0.5);\n      tickbend.second = depth/bend * sin(phase);\n      if ((storage.size() \u003e 0) \u0026\u0026 (tickbend.first == 0)) break;\n      storage.push_back(tickbend);\n      phase += increment;\n      if (phase \u003e twopi) phase -= twopi;\n   }\n   int track = midifile.getTrackCount() - 1;\n   for (int i=0; i\u003c(int)storage.size(); i++)\n      midifile.addPitchBend(track, storage[i].first, channel, storage[i].second);\n   if (filename.empty()) cout \u003c\u003c midifile;\n   else midifile.write(filename);\n   return 0;\n}\n```\n\n\n### Polyrhythm generator ###\n\nHere is a program that generates polyrhythm patterns. Command line\noptions are:\n\n| option   | default value | meaning                                    |\n|:--------:|:-------------:|:------------------------------------------:|\n| `-a`     |   2           | first instrument's division of the cycle   |\n| `-b`     |   3           | first instrument's division of the cycle   |\n| `-c`     |   10          | number of cycles                           |\n| `-d`     |   2.0         | duration of each cycle                     |\n| `--key1` |   76          | percussion key number for first instrument |\n| `--key2` |   77          | percussion key number for first instrument |\n| `-o`     |               | output filename                            |\n\n\n```cpp\n#include \"MidiFile.h\"\n#include \"Options.h\"\n#include \u003ciostream\u003e\n#include \u003cutility\u003e\n#include \u003ccmath\u003e\nusing namespace std;\nusing namespace smf;\n\nint main(int argc, char** argv) {\n   Options options;\n   options.define(\"a=i:2\",           \"cycle division 1\");\n   options.define(\"b=i:3\",           \"cycle division 2\");\n   options.define(\"c|cycle=i:10\",    \"cycle count\");\n   options.define(\"d|dur=d:2.0\",     \"duration of cycle in seconds\");\n   options.define(\"key1=i:76\",       \"first percussion key number\");\n   options.define(\"key2=i:77\",       \"second percussion key number\");\n   options.define(\"o|output-file=s\", \"output filename\");\n   options.process(argc, argv);\n\n   int a = options.getInteger(\"a\");\n   int b = options.getInteger(\"b\");\n   int c = options.getInteger(\"cycle\");\n   int key1 = options.getInteger(\"key1\");\n   int key2 = options.getInteger(\"key2\");\n   double dur = options.getDouble(\"dur\");\n   double tempo = 60.0 / dur;\n\n   MidiFile midifile;\n   midifile.setTPQ(a*b);\n   midifile.addTempo(0, 0, tempo);\n   midifile.addTracks(2);\n   for (int i=0; i\u003cb*c + 1; i++) {\n      midifile.addNoteOn(1, i*a, 9, key1, 64);\n      midifile.addNoteOff(1, (i+1)*a, 9, key1);\n   }\n   for (int i=0; i\u003ca*c + 1; i++) {\n      midifile.addNoteOn(2, i*b, 9, key2, 64);\n      midifile.addNoteOff(2, (i+1)*b, 9, key2);\n   }\n\n   string filename  = options.getString(\"output-file\");\n   if (filename.empty()) cout \u003c\u003c midifile;\n   else midifile.write(filename);\n   return 0;\n}\n```\n\nThis program demonstrates how to set the ticks-per-quarter-note value in the\nMIDI header.  In this case it is set to the factor of `a*b` which is the duration\nof one cycle (so each cycle has the duration of a quarter note).  A tempo meta-message\nis also calculated based on the desired duration of a cycle.\n\nFor example, try the options `-a 3 -b 4 -c 200 -d 1 -o 3x4.mid`, which will play\na 3-against-4 pattern for 200 cycles with each cycle lasting 1 second.  Or here\nis 11-against-13 for 100 cycles: `-a 11 -b 13 -c 100 -d 5 -o 11x13.mid`.\n\n\n\n","funding_links":[],"categories":["TODO scan for Android support in followings","C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraigsapp%2Fmidifile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcraigsapp%2Fmidifile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraigsapp%2Fmidifile/lists"}