### Example match.abc file structure Source: https://github.com/sshlien/abcmidi/blob/master/doc/abcmatch.txt This is an example of a match.abc file, which contains the musical bars to search for. It must include basic ABC fields like X:, M:, L:, and K:, followed by the musical notation. ```abc X:1 M:6/8 L:1/8 K:E cff f2e| ``` -------------------------------- ### Page Setup and Initial Drawing Source: https://github.com/sshlien/abcmidi/blob/master/tests/golden/yaps_coleraine.txt Sets up the page with initial transformations, line styles, and draws the title 'Coleraine' and a measure number. ```postscript %%BeginPageSetup gsave 40 796 T 0.8 setlinewidth 0 setlinecap 0.700 0.700 scale %%EndPageSetup 0 -20.0 T 20.0 F0 (Coleraine) 367.1 0 M cshow 12.0 F3 10.0 0.0 hd 14.0 su 30.0 0.0 M (= 142) show 0 -58.0 T ``` -------------------------------- ### ABC Notation with Linear Temperament Source: https://github.com/sshlien/abcmidi/blob/master/tests/golden/abc2abc_demo.txt This example demonstrates setting a linear temperament for ABC notation, with commented-out examples for different temperaments (19-EDO, 22-EDO, 31-EDO, Pythagorean) and an active line for Pythagorean temperament. It also includes MIDI program settings for multiple voices. ```abc X:11 T:Linear Temperament M:4/4 L:1/4 Q:1/4=35 % %MIDI temperamentlinear 1200.0 694.736842 % 19-EDO % %MIDI temperamentlinear 1200.0 709.090909 % 22-EDO % %MIDI temperamentlinear 1200.0 696.774194 % 31-EDO % %MIDI temperamentlinear 1200.0 698.0 % fifth=698 cents % %MIDI temperamentlinear 1200.0 696.57843 % 1/4-comma meantone %%MIDI temperamentlinear 1200.0 701.955001 % Pythagorean % %MIDI temperamentnormal % 12-EDO K:C V:1 %%MIDI program 16 c2 B2 | c3/2z/2 ^A2 | V:2 %%MIDI program 16 G2 G2 | G3/2z/2 G2 | V:3 %%MIDI program 16 (3E_E^D (3=DF_F | =E3/2z/2 E2 | V:4 %%MIDI program 16 C2 G,2 | C3/2z/2 C2 | ``` -------------------------------- ### ABC Music Notation Example Source: https://github.com/sshlien/abcmidi/blob/master/tests/golden/abc2abc_demo.txt A basic ABC music notation example. Ensure correct syntax for notes, chords, and bar lines. ```abc "G"B2 AB|D2 GA|"G"B3/2c/2 BA|G2 D2|"C"E2 G2|G2 A2|"G"G4-|G4|| ``` -------------------------------- ### Example abcmatch output Source: https://github.com/sshlien/abcmidi/blob/master/doc/abcmatch.txt This is an example of the output generated by abcmatch when matches are found. Each line indicates the tune's position in the file, its reference number (X:), and the bar number where the match occurred. ```text abcmatch.exe scotjig.abc 29 30 4 30 31 4 ``` -------------------------------- ### abc2abc Usage Example Source: https://github.com/sshlien/abcmidi/blob/master/doc/readme.txt Demonstrates how to use abc2abc to transpose an ABC file by 2 semitones and redirect the output to a new file. Ensure the input file exists and the output file path is valid. ```bash abc2abc file.abc -t 2 > newfile.abc ``` -------------------------------- ### Drum Multivoice Extension Source: https://github.com/sshlien/abcmidi/blob/master/doc/abcguide.txt Example demonstrating drum patterns in separate voices using %%MIDI drum commands. Ensure %%MIDI drumoff is used to stop drum mode. ```abc X:1 T: drum multivoice extension M: 4/4 L: 1/4 K: G V:1 %%MIDI drum dddd 45 45 45 45 70 50 60 50 %%MIDI drumon z4|z4|\ %%MIDI drumoff z4| ``` ```abc V:2 %%MIDI drum ddddd 54 54 54 54 54 70 50 50 60 50 z4| %%MIDI drumon z4|z4| ``` -------------------------------- ### abc Note Syntax Examples Source: https://context7.com/sshlien/abcmidi/llms.txt Illustrates various abc note syntax elements including pitches, lengths, accidentals, chords, tuplets, broken rhythms, ties, slurs, decorations, and microtones. ```abc X:1 T:Note Syntax Demo M:4/4 L:1/8 K:G % Pitches: C D E F G A B = middle octave; c d e f g a b = one octave up % Comma (,) lowers one octave; apostrophe (') raises one octave C, D, E, F, C D E F c d e f c' d' e' f' | % Note lengths: C = 1 unit, C2 = 2 units, C/2 = half, C/ = quarter, C3/4 = 3/4 C C2 C/2 C/ C3/4 z2 | % z = rest % Accidentals: ^ = sharp, _ = flat, = = natural, ^^ = double sharp ^F _B =E ^^G __A | % Chords (bracket notation) [CEG]2 [FAc] z2 | % Triplet and general tuple notation (3CDE (3:2:3 FGA | % Broken rhythm: a>b = a dotted, b short; aA B input.mid output.mid -from n ``` -------------------------------- ### ABC Notation with MIDI Trim Command Source: https://github.com/sshlien/abcmidi/blob/master/tests/golden/abc2abc_demo.txt This example uses the %%MIDI trim command to distinguish slurs. It also includes various MIDI control commands for program, beat, chord progression, bass progression, chord volume, and bass volume. ```abc X:10 T:Heights of Alma % Nottingham Music Database S:KCC p3, via EF M:4/4 L:1/4 K:A %%MIDI trim 1/5 %%MIDI program 74 %%MIDI beat 89 79 69 4 %%MIDI chordprog 45 %%MIDI bassprog 45 %%MIDI chordvol 77 %%MIDI bassvol 73 P:A (e/2d/2)|"A"cA AE|"A"(A/2B/2c/2d/2) e2|"A"(f/2e/2d/2c/2) eA| "G"(d/2=c/2B/2A/2) =Ge/2d/2| "A"cA AE|"A"A/2B/2c/2d/2 e2|"A"(f/2e/2d/2c/2) "E7"(e/2f/2e/2d/2)| %Warning : Missing repeat at start ? Unexpected :| found "A"cA A:| P:B c/2d/2|"A"ea ca|"A"e/2f/2e/2c/2 AB/2=c/2|"G"d=g Bg|"G"d/2e/2d/2B/2 =Gc/2d/2| "A"ea ca|"A"e/2f/2e/2c/2 AB/2c/2|"E7"(d/2c/2B/2A/2) (G/2B/2e/2d/2)| %Warning : Unexpected :| found "A"cA A:| ``` -------------------------------- ### Tune with Ties for Non-Standard Note Lengths Source: https://github.com/sshlien/abcmidi/blob/master/tests/golden/abc2abc_demo.txt Demonstrates the use of ties (-) to create notes of non-standard lengths. This example uses ties to extend notes beyond the default eighth note. ```abc X:3 T:Smash the Windows T:Roaring Jelly S:One Thousand English Country Dance Tunes, Michael Raven C:Trad M:6/8 L:1/8 Q:1/8=400 K:D |:A %Error : Bar 1 is 1/8 not 6/8 |DED F2A|d2f ecA|G2B F2A|E2F GFE|DED F2A|d2f ecA|Bgf edc|d3-d2:| a|a2f d2f|A2a agf|g2e c2e|A2g gfe|f2d g2e|a2f bag|fed edc|d3-d2a| agf fed|Adf agf|gfe ecA|Ace gfe|fed gfe|agf bag|fed edc|d3-d2z|| ``` -------------------------------- ### Define Fat Double Bar Line at Start in PostScript Source: https://github.com/sshlien/abcmidi/blob/master/tests/golden/yaps_coleraine.txt Defines the PostScript procedure for drawing a fat double bar line at the start of a section. It takes an x coordinate as input. ```postscript /fbar1 { % usage: x fbar1 - fat double bar at start 0 moveto 0 24 rlineto 3 0 rlineto 0 -24 rlineto currentpoint fill moveto 3 0 rmoveto 0 24 rlineto stroke } bind def ``` -------------------------------- ### ABC Notation with Drum Line and MIDI Controls Source: https://github.com/sshlien/abcmidi/blob/master/tests/golden/abc2abc_demo.txt This example features a hornpipe tune with a drum line added. It includes MIDI channel, chord attack, and MIDI program settings for the drum voice. Note the error messages regarding bar lengths. ```abc X:12 T:Cuckoo's Nest % Nottingham Music Database % drum line added by Seymour S:Song M:4/4 L:1/8 R:Hornpipe Q:1/4=144 K:Dm V:1 "Dm"D2DE DCA,C|"Dm"DCDE F2"C7"FA|"F"c2cd A2GF|"C"ECCC C2"A7"FE| "Dm"D2DE DCA,C|"Dm"DCDE F2"C7"FG|"F"ABcA "A7"GFEF|"Dm"E2"Gm"D2 "Dm"D2 %Error : Bar 7 is 3/4 not 4/4 || V:2 %%MIDI channel 10 %%MIDI chordattack 50 [^F,,E,,]/2[^F,,E,,]/2[D,,^F,,]/2[D,,^F,,]/2 ^F,,F,, z4| ^F,,E,,E,,^F,,z4| [^F,,E,,]/2[^F,,E,,]/2[D,,^F,,]/2[D,,^F,,]/2 ^F,,F,, z4| D,,D,,D,,^F,,z4| [^F,,E,,]/2[^F,,E,,]/2[D,,^F,,]/2[D,,^F,,]/2 ^F,,F,, z4| ^F,,D,,D,,^F,,z4| [^F,,E,,]/2[^F,,E,,]/2[D,,^F,,]/2[D,,^F,,]/2 ^F,,E,, z4| E,,^F,,B,,,4 %Error : Bar 15 is 3/4 not 4/4 | ``` -------------------------------- ### Define Test Directories Source: https://github.com/sshlien/abcmidi/blob/master/tests/CMakeLists.txt Sets up directories for sample files, golden reference files, and temporary test files. ```cmake set(SAMPLES_DIR "${PROJECT_SOURCE_DIR}/samples") set(GOLDEN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/golden") set(TEST_TMPDIR "${CMAKE_CURRENT_BINARY_DIR}/tmp") ``` -------------------------------- ### Build with CMake Source: https://github.com/sshlien/abcmidi/blob/master/doc/readme.txt Modern build process using CMake. Available presets include default (Release), debug, and sanitize. ```bash cmake --preset default cmake --build --preset default cmake --install build/default ``` -------------------------------- ### Build abcMIDI with Autoconf Source: https://github.com/sshlien/abcmidi/blob/master/README.md Use this command sequence for the traditional autoconf build process. ```sh ./configure make sudo make install ``` -------------------------------- ### Move and Show Text Source: https://github.com/sshlien/abcmidi/blob/master/tests/golden/yaps_coleraine.txt The 'wd' procedure in PostScript moves the current point to a specified location and then shows a string. It's a shorthand for 'moveto show'. ```postscript /wd { moveto show } bind def ``` -------------------------------- ### Prepare Binary Definitions for Tests Source: https://github.com/sshlien/abcmidi/blob/master/tests/CMakeLists.txt Creates a list of CMake definitions, mapping uppercase binary names to their target file paths, to be passed to the test runner script. ```cmake set(BINARY_DEFS) foreach(bin IN LISTS ABCMIDI_BINARIES) string(TOUPPER "${bin}" BIN_UPPER) list(APPEND BINARY_DEFS "-D${BIN_UPPER}=$") endforeach() ``` -------------------------------- ### Bagpipe Music with Drone Commands Source: https://github.com/sshlien/abcmidi/blob/master/tests/golden/abc2abc_demo.txt Demonstrates bagpipe music notation using drone commands (%%MIDI drone, %%MIDI droneon, %%MIDI droneoff) and grace notes ({g}). Includes specific MIDI program and drone settings. ```abc X:7 T:The First Slip "Arranged by Terry Tully" M:C L:1/8 Q:1/4=80 C:Traditional Irish S:Reel Z:The Brussels Caledonian Corneymusers Pipe Band Z:http://membres.lycos.fr/corneymusers/Tunes.html K:HP %%MIDI program 109 %%MIDI drone 70 45 33 90 90 %%MIDI droneon |: {g}eA{gAGAG}A2{gef}e2{g}dB| {g}eA{gAGAG}A2{g}GB{gBeBG}B2| {g}eA{gAGAG}A2{gef}e2{g}fa| ! ge{gde}dB{G}ABcd:||: {g}ea{g}ag{ef}e2{A}ef| {g}dB{gBeBG}B2{g}GB{gBeBG}B2| ! {g}ea{g}ag{ef}e2{A}ef| {a}ge{gde}dB{G}ABcd:| %%MIDI droneoff ``` -------------------------------- ### Show String with Padding (W0) Source: https://github.com/sshlien/abcmidi/blob/master/tests/golden/yaps_coleraine.txt Shows a string, pads it with spaces to a fixed width, and then shows it. Usage: str W0. ```postscript /W0 { dup stringwidth pop str cvs exch show ( ) show pop pop } bind def ``` -------------------------------- ### ABC Notation for Percussion (Voice 4, F# Key) Source: https://github.com/sshlien/abcmidi/blob/master/tests/golden/midi2abc_coleraine.txt ABC notation for the fourth voice, in the key of F# and likely for percussion, using a different rhythmic and melodic pattern than the previous example. ```abc K:F# % 6 sharps =G,,3/2=A,,/2 G,,A,,/2G,,/2A,,| =A,,=G,,3/2A,,/2 G,,A,,G,,/2A,,/2| =G,,G,,3/2=A,,/2 G,,A,,/2G,,/2A,,| =A,,=G,,3/2A,,/2 G,,A,,G,,/2A,,/2| =G,,G,,G,, G,,z2| z=G,,G,, G,,z2| z=G,,G,, G,,z2| z=G,,3z2| z=G,,3/2=A,,/2 G,,A,,/2G,,/2A,,| =A,,=G,,3/2A,,/2 G,,A,,G,,/2A,,/2| =G,,G,,3/2=A,,/2 G,,A,,/2G,,/2A,,| =A,,=G,,3/2A,,/2 G,,A,,G,,/2A,,/2| =G,,G,,G,, G,,z2| z=G,,G,, G,,z2| z=G,,G,, G,,z2| z=G,,3 ``` -------------------------------- ### Configure Bagpipe Drone with %%MIDI drone Source: https://context7.com/sshlien/abcmidi/llms.txt Use `%%MIDI drone` to set up a continuous drone sound for bagpipe tunes. Specify instrument program and pitches with velocities. Ensure `%%MIDI droneon` is used to activate and `%%MIDI droneoff` to deactivate. ```abc %%MIDI program 109 % Bag pipe instrument %%MIDI drone 70 45 33 90 90 % bassoon, pitches A, and A,,, velocities 90/90 %%MIDI droneon ``` ```abc %%MIDI droneoff ``` -------------------------------- ### Grace Note Smooth Curve (gsl) Source: https://github.com/sshlien/abcmidi/blob/master/tests/golden/yaps_coleraine.txt Draws a smooth curve for grace notes. Requires three points (x1, y1, x2, y2, x3, y3) and a starting point (x0, y0). ```postscript /gsl { moveto curveto stroke } bind def ``` -------------------------------- ### Run abcMIDI Test Suite Source: https://context7.com/sshlien/abcmidi/llms.txt Execute the full test suite for abcMIDI using the debug preset. ```sh ctest --preset debug ``` -------------------------------- ### Four-Part Arrangement with Multiple Voices (V:) Source: https://github.com/sshlien/abcmidi/blob/master/tests/golden/abc2abc_demo.txt Shows a four-part arrangement using the V: directive to define multiple voices (soprano, alto, tenor, bass). Each voice is defined on a new line starting with V:. ```abc X:4 T:Candlemas Eve S:Hymn 126 Arr. R. Herrick from an old church-gallery book M:4/4 L:1/8 Q:1/8=400 N:from an old church-gallery book H:The old church-gallery book was discovered by the Rev. L.J.T. Darwall. H:The source has a 4-part harmony. O:English R:Reel K:G V:1 % soprano D2 | G2 G2 B2 G2 | E2 F2 G2 Bd | c2 B2 A2 G2 | A6 Bc | d2 B2 G2 AB | c2 A2 F2 GA | B2 G2 E2 F2 | G6 Bc | d2 d2 d2 B2 | e2 c2 A2Bd | c2 B2 A2 G2 | d6 B2 | e2 d2 c2 B2 | A2 G2 F2 GA | B2 G2 E2 F2 | G6 z2 || V:2 % alto D2 %Error : Bar 17 is 1/4 not 4/4 | D2 C2 B,2 D2 | C2 C2 D2 D2 | G2 G2 E2 E2 | F6 G2 | G2 F2 E2 D2 | C2 E2 D2 E2 | D2 D2 C2 C2 | D6 G2 | G2 G2 G2 G2 | G2 G2 F2 D2 | G2 G2 E2 G2 | F6 D2 | C2 D2 EF G2 | E2 E2 D2 E2 | D2 B,2 C2 D2 | D6 z2 || V:3 % tenor D,2 %Error : Bar 34 is 1/4 not 4/4 | G,2 G,2 G,2 G,2 | G,2 A,2 B,2 B,2 | E2 D2 C2 B,2 | D6 D2 | D2 D2 B,2 G,2 | E,2 A,2 A,2 C2 | G,2 G,2 G,2 A,2 | B,6 DC | B,2 D2 B,2 D2 | C2 E2 D2 B,2 | C2 D2 C2 G,2 | A,6 G,2 | G,2 G,2 C2 D2 | CD CB, A,2 C2 | G,2 G,2 A,2 A,2 | B,6 z2 || V:4 % bass up one octave D2 %Error : Bar 51 is 1/4 not 4/4 | B,2 A,2 G,2 B,2 | C2 A,2 G,2 G2 | E2 G2 A2 E2 | D6 GA | B,2 D2 E2 E2 | A,2 C2 D2 C2 | B,2 A,B, C2 A,2 | G,6 G,2 | G2 B2 G2 G2 | c2 C2 D2 G2 | E2 G2 C2 E2 | D6 G2 | C2 B,2 A,2 G,2 | A,2 C2 D2 C2 | B,2 E2 A,2 D2 | G,6 z2 || ``` -------------------------------- ### Select Stress Model Implementation Source: https://github.com/sshlien/abcmidi/blob/master/doc/abcguide.txt Select the stress model implementation, either model 1 (modifies articulation and trim) or model 2 (modifies onset and ending for rhythmic expansion/contraction). Model 2 requires the -BF runtime parameter. ```abc %%MIDI stressmodel n ``` -------------------------------- ### abcmatch command-line usage Source: https://github.com/sshlien/abcmidi/blob/master/doc/abcmatch.txt This shows the basic usage of the abcmatch command-line tool. It requires an ABC file as input and accepts various optional parameters for controlling the search and output. ```bash abcmatch version 1.55 Usage : abcmatch [-options] [reference number] selects a tune -c returns error and warning messages -v selects verbose option -r resolution for matching -con pitch contour match -fixed fixed number of notes -qnt quantized pitch contour -lev use levenshtein distance -a report any matching bars (default all bars) -ign ignore simple bars -br %d only report number of matched bars when above given threshold -tp [reference number] -ver returns version number -pitch_hist pitch histogram -wpitch_hist interval weighted pitch histogram -length_hist pitch histogram -interval_hist pitch interval histogram -pitch_table separate pitch pdfs for each tune -interval_table separate interval pdfs for each tune ``` -------------------------------- ### Build abcMIDI with CMake Source: https://github.com/sshlien/abcmidi/blob/master/README.md Configure and build the abcMIDI package using CMake presets. Available presets include 'default', 'debug', and 'sanitize'. ```sh # Configure and build (pick a preset: default, debug, sanitize) cmake --preset default cmake --build --preset default ``` ```sh # Install cmake --install build/default ``` -------------------------------- ### Configure Guitar Chord Accompaniment with %%MIDI gchord Source: https://context7.com/sshlien/abcmidi/llms.txt The %%MIDI gchord directive configures automatic chord-and-bass accompaniment patterns generated from guitar chord symbols in double quotes. It supports patterns, arpeggios, and multi-bar configurations. ```abc X:1 T:The Friendly Visit R:hornpipe M:4/4 L:1/8 K:G %%MIDI chordprog 25 % acoustic guitar (steel) for chords %%MIDI bassprog 32 % acoustic bass %%MIDI chordvol 80 %%MIDI bassvol 90 %%MIDI gchord fzczfzcz % 4/4 default: bass-chord-rest-chord pattern |: BA | "G"(3GFG DG BGBd | "C"(3cBc AB "D7"cdef | "G"g2df "C"ecAG | "Am"FGAB "D7"cAFD | "G"(3GFG DG BGBd | "C"(3cBc AB "D7"cdef | "G"gdBG "D7"FAdc | "G"B2G2 G2 :| % Arpeggio: play individual chord notes g=lowest, h=2nd, i=3rd %%MIDI gchord ghih "C" z4 | "G" z4 | % Spread over 2 bars %%MIDI gchordbars 2 %%MIDI gchord fzczfzczfzczfzcz "G" z4 | "D" z4 | ``` -------------------------------- ### Control Note Articulation with %%MIDI trim and expand Source: https://context7.com/sshlien/abcmidi/llms.txt Employ `%%MIDI trim` to create gaps between notes for staccato effects, specifying the fraction of note length to trim. Use `%%MIDI expand` to make notes overlap for legato. Set trim to `0/1` to disable trimming. ```abc %%MIDI trim 1/5 ``` ```abc %%MIDI trim 0/1 ``` ```abc %%MIDI expand 1/8 ``` -------------------------------- ### Show String with Width Adjustment (WS) Source: https://github.com/sshlien/abcmidi/blob/master/tests/golden/yaps_coleraine.txt Displays a string with calculated spacing to fit a given width. Usage: w nspaces str WS. ```postscript /WS { dup stringwidth pop 4 -1 roll sub neg 3 -1 roll div 0 8#040 4 -1 roll widthshow } bind def ``` -------------------------------- ### Select MIDI Channel and Instrument with %%MIDI Directives Source: https://context7.com/sshlien/abcmidi/llms.txt Use %%MIDI channel and %%MIDI program directives to specify the MIDI channel (1-16) and General MIDI instrument (0-127) for a voice. Inline MIDI commands [I:MIDI program] can also be used. ```abc X:1 T:Instrument Selection M:4/4 L:1/8 K:C V:1 %%MIDI channel 1 %%MIDI program 40 % Violin CDEF GABC | V:2 %%MIDI channel 2 %%MIDI program 0 % Acoustic Grand Piano CDEF GABC | V:3 %%MIDI channel 3 %%MIDI program 56 % Trumpet CDEF GABC | % Inline MIDI commands avoid breaking music lines [I:MIDI program 73] c2de [I:MIDI program 0] fgab | ``` -------------------------------- ### Draw a Line and Show Text Source: https://github.com/sshlien/abcmidi/blob/master/tests/golden/yaps_coleraine.txt The 'wln' procedure draws a horizontal line and then shows text. It takes the text string as an argument and positions the line relative to the text. ```postscript /wln { dup 3 1 roll moveto gsave 0.6 setlinewidth lineto stroke grestore } bind def ``` -------------------------------- ### Karaoke File with w: Field and Part Notation Source: https://github.com/sshlien/abcmidi/blob/master/tests/golden/abc2abc_demo.txt Generates a karaoke file using the 'w:' field for lyrics and part notation (P:) to structure verses. Includes MIDI directives for chords and volume. ```abc X:5 T:Oh You New York Girls C:Trad M:4/4 L:1/8 Q:1/4=200 P:(AB)3 K:C % 0 sharps %%MIDI gchord fz %%MIDI chordvol 90 P:A g2|e2g2g3g|f2a2a3a|g2g2f2g2|e6 w:As I walked out on So-uth Street, a fair maid I did meet w:I said, "My dear young la-dy, I'm a stran-ger here in town w:I took her out to Tiff-an-y's, I spared her no ex-pense g2|c'3c'c'2g2|b2 a2a3a|g3 gf2d2|c4 w:Who asked me please to see her home, she lived on Blee-cker Street w:I left my ship just yes-ter-day, from Liver-pool I was bound." w:I bought her two gold ea-r-rings, they cost me fif-teen cents. P:B e2f2|g6e2|f2 a6|b4 a4|a2g4 z2| w:And a-way, you John-ny, my dear hon-ey c'6b2|b2a2 a4|g3g f2B2|d2c4 w:Oh you New York girls, can you dance the pol-ka? ``` -------------------------------- ### Convert MIDI to ABC Notation with midi2abc Source: https://context7.com/sshlien/abcmidi/llms.txt Convert MIDI files to ABC notation using `midi2abc`. Options include saving to a file (`-o`), auto-detecting key signatures (`-gk`), specifying time signature and tempo (`-m`, `-Q`), and selecting specific channels (`-c`). ```sh # Basic conversion (output to stdout) midi2abc -f song.mid ``` ```sh # Save to file midi2abc -f song.mid -o song.abc ``` ```sh midi2abc -f song.mid > song.abc ``` ```sh # Auto-detect key signature by minimizing accidentals midi2abc -f song.mid -gk -o song.abc ``` ```sh # Specify time signature and tempo explicitly midi2abc -f song.mid -m 3/4 -Q 120 -o waltz.abc ``` ```sh # Convert only channel 2 (e.g., a specific instrument) midi2abc -f song.mid -c 2 -o melody.abc ``` ```sh # Guess anacrusis (pickup bar) automatically midi2abc -f song.mid -xa -o song.abc ``` ```sh # Split non-homophonic chords into separate voices midi2abc -f song.mid -splitvoices -o song.abc ``` ```sh # Piano-roll style note list (for debugging/analysis) midi2abc -f song.mid -midigram ``` ```sh # Produce mftext-style event dump inline midi2abc -f song.mid -mftext ``` ```sh # Custom quantization: 32nd-note resolution midi2abc -f song.mid -aul 32 -o song.abc ``` ```sh # Summary statistics about the MIDI file midi2abc -f song.mid -stats ``` -------------------------------- ### Show String with Pop (W1) Source: https://github.com/sshlien/abcmidi/blob/master/tests/golden/yaps_coleraine.txt Shows a string and pops two additional items from the stack. Usage: str W1. ```postscript /W1 { show pop pop } bind def ``` -------------------------------- ### Embed MIDI Commands in Info Fields Source: https://github.com/sshlien/abcmidi/blob/master/doc/abcguide.txt Allows embedding %%MIDI commands within info fields using the '[I:MIDI command]' syntax, avoiding line breaks in the music. The '=' following 'MIDI' is crucial. ```abc [I:MIDI drumon] ``` -------------------------------- ### Run abcMIDI Tests with CMake Source: https://github.com/sshlien/abcmidi/blob/master/README.md Execute the test suite for the abcMIDI package using CMake presets. Use '-L golden' or '-L smoke' to run specific test types. ```sh # Run all tests ctest --preset debug ``` ```sh # Run only golden-file tests / only smoke tests ctest --preset debug -L golden ctest --preset debug -L smoke ``` -------------------------------- ### Makefile for abcmatch compilation Source: https://github.com/sshlien/abcmidi/blob/master/doc/abcmatch.txt This Makefile outlines the compilation process for abcmatch using gcc. It specifies the object files required and the linking command to create the executable. ```makefile CFLAGS=-c abcmatch: parseabc.o matchsup.o abcmatch.o gcc parseabc.o matchsup.o abcmatch.o -o abcmatch.exe parseabc.o : parseabc.c abc.h gcc $(CFLAGS) abcparse.c matchsup.o : matchsup.c abc.h gcc $(CFLAGS) abcstore.c abcmatch.o : abcmatch.c abc.h gcc $(CFLAGS) abcmatch.c ``` -------------------------------- ### midicopy Basic Usage Source: https://github.com/sshlien/abcmidi/blob/master/doc/readme.txt Copies the contents of an input MIDI file to a new output MIDI file without any modifications. This is the most basic usage of the midicopy tool. ```bash midicopy.exe input.mid output.mid ``` -------------------------------- ### midi2abc Usage Source: https://github.com/sshlien/abcmidi/blob/master/doc/readme.txt Command-line options for the midi2abc program, which converts MIDI files to abc notation. ```bash midi2abc -a -xa extract anacrusis from file (find first strong note) -ga guess anacrusis (minimize ties across bars) -gk guess key signature by minimizing accidentals -gu guess the number of midi pulses per note from note duration statistics in the MIDI file -m