Skip to content

Commit

Permalink
compact syntax supports more options (q, m, tr)
Browse files Browse the repository at this point in the history
- fixes #79
  • Loading branch information
truj committed May 6, 2023
1 parent 9bd9f2a commit 8c56e74
Show file tree
Hide file tree
Showing 30 changed files with 749 additions and 327 deletions.
24 changes: 9 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ You write your songs in plain text files using the text editor of your choice. M
# Get started
1. Install Java Runtume Environment (JRE) version 1.7 or higher.
2. Go to the [latest release](https://github.com/truj/midica/releases/latest) and download the file `midica.jar`.
3. Start Midica using the command: `java -jar midica.jar`
3. Start Midica using the command: `java -jar midica.jar` (or just by double-click if your operating system supports that)
4. Download one of the [example files](examples/) or create your own file and save it with the file extension `.midica`.
5. In the Midica application, load this file by pressing the upper right button `select file`.
6. Switch to the MidicaPL tab (it's the default tab) and choose this file.
Expand Down Expand Up @@ -173,10 +173,10 @@ This example uses nestable blocks and global commands:
{ q=3 // inner block to be repeated 3 times
// in channel 1: switch to mezzo piano (v=70) and play D3 as an 8th note
1: (v=70) d-:8
1: | (v=70) d-:4 // the pipe "|" checks for measure borders (optional)
// in channel 0: switch to mezzo piano and play some notes and rests ("-" = rest)
0: (v=70) d:8 - d eb d eb
0: | (v=70) d:8 - d eb d eb |
// synchronize: bring all channels to the same time
*
Expand All @@ -192,10 +192,10 @@ This results in a MIDI sequence like this:

Instead of the nested blocks we could have written this equivalent code:

0: (v=70) d:8 - d eb d eb d - d eb d eb d - d eb d eb d - d eb f eb
0: d:8 - d eb d eb d - d eb d eb d - d eb d eb d - d eb f eb
1: (v=70) d-:4 -:/2 d-:4 -:/2 d-:4 -:/2 d-:4 f- c-
1: d-:4 -:/2 d-:4 -:/2 d-:4 -:/2 d-:4 f- c-
0: (v=70) | d:8 - d eb d eb | d - d eb d eb | d - d eb d eb | d - d eb f eb |
0: | d:8 - d eb d eb | d - d eb d eb | d - d eb d eb | d - d eb f eb |
1: (v=70) | d-:4 -:/2 | d-:4 -:/2 | d-:4 -:/2 | d-:4 f- c- |
1: | d-:4 -:/2 | d-:4 -:/2 | d-:4 -:/2 | d-:4 f- c- |

## Example 3

Expand All @@ -221,14 +221,8 @@ This example uses a guitar picking pattern with several chords. It produces the
END

// play the chords using this pattern
0 cmaj travis
0 cmaj7 travis
0 cadd9 travis
0 cmaj travis
0 asus2 travis
0 asus4 travis
0 amin travis
0 asus2 travis
0: | cmaj:travis | cmaj7:travis | cadd9:travis | cmaj:travis |
0: | asus2:travis | asus4:travis | amin:travis | asus2:travis |

This results in the following sequence:

Expand Down
9 changes: 3 additions & 6 deletions examples/london_bridge.midica
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,12 @@ CHORD amaj a-2, e-, a-, c#
CHORD dmaj d-, a-, d, f#

// define a picking pattern for both chords
PATTERN picking_pattern
PATTERN pick
: | 0:8 1 2 1 3 1 2 3 |
END

FUNCTION guitar
// use the same pattern with both chords
1 dmaj picking_pattern q=2
1 amaj picking_pattern
1 dmaj picking_pattern q=3
1 amaj picking_pattern
1 dmaj picking_pattern
1: | (q=2) dmaj:pick | amaj:pick |
1: | (q=3) dmaj:pick | amaj:pick | dmaj:pick |
END
31 changes: 7 additions & 24 deletions examples/old_macdonald_had_a_farm.midica
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// "Old MacDonald had a farm".
//
// This file assumes standard program configuration:
// - Note System: International: c, d, e, ... (lower case)
// - Note System: International: c, d, e, ... (lower case
// - Half Tone Symbols: # / b (c#, cb, d#, db, ...)
// - Octave Naming: +n/-n
// - Syntax: Mixed Case Syntax
Expand Down Expand Up @@ -84,10 +84,10 @@ CONST $tr_short = /8
FUNCTION guitar
CALL guitar_line q=2

// moo moo here and a moo moo there here a moo there a moo
// moo moo here and a moo moo there here a moo there a moo
1: | gmaj:1 | gmaj | gmaj:8 gmaj gmaj:4 gmaj:8 gmaj gmaj:4 |

// ev- ery- where a moo moo
// ev- ery- where a moo moo
1: | gmaj:8 gmaj gmaj gmaj gmaj:4 gmaj:4 |

CALL guitar_line
Expand All @@ -100,25 +100,8 @@ END
// I don't want to do that, so I must use lowlevel syntax here.
// Compact syntax is only used for the (optional) bar lines.
FUNCTION guitar_line
1: |
1 gmaj /4 tr=$tr_long
1 gmaj /2 tr=$tr_short
1 gmaj /4 tr=$tr_long
1: |

1 cmaj /4 tr=$tr_short
1 cmaj /4 tr=$tr_long
1 gmaj /2 tr=$tr_long
1: |

1 gmaj /4
1 gmaj /4 tr=$tr_short
1 dmaj /4
1 dmaj /4 tr=$tr_short
1: |

1 gmaj /4 tr=$tr_long
1 gmaj /2 tr=$tr_short
1 gmaj /4 tr=$tr_long
1: |
1: | (tr=$tr_long) gmaj:4 (tr=$tr_short) gmaj:2 (tr=$tr_long) gmaj:4 |
1: | (tr=$tr_short) cmaj (tr=$tr_long) cmaj (tr=$tr_long) gmaj:2 |
1: | gmaj:4 (tr=$tr_short) gmaj:4 dmaj:4 (tr=$tr_short) dmaj:4 |
1: | (tr=$tr_long) gmaj:4 (tr=$tr_short) gmaj:2 (tr=$tr_long) gmaj:4 |
END
115 changes: 47 additions & 68 deletions examples/rossini_william_tell_overture_finale.midica
Original file line number Diff line number Diff line change
Expand Up @@ -387,38 +387,29 @@ CALL m75_to_80(start=75)
FUNCTION m75_to_80
CALL d_all_staccato

// 75 76 77
0: | e+3:p8ss88 | g#+3:4 f#+3 | e+3:8 d#+3 e+3 c#+3 |
1: | e+2:p8ss88 | g#+2:4 f#+2 | e+2:8 d#+2 e+2 c#+2 |
2: | $leg b,e+:2 |
2 c+ /2 m
2: g#+:4. f#+:8 | c#+,e+ c+,d#+ c#+,e+ a,c#+ |
3: | $leg b,e+:2 |
3 c+ /2 m
3: g#+:4. f#+:8 | c#+,e+ c+,d#+ c#+,e+ a,c#+ |
4: | $leg b-:2 | c | c#:8 c c# a- |
5: | $leg b-,b:2 | g# | a |
6: | $leg e-,g#:2 | e-,g# | e-,e |
7: | e,e+:p8ss88 | e,e+:2 | e,e+:p8888 |
8: | $leg e-,e:1. |
p to /2 q=3, m, tr=/32
p bd2,cc2 /4 q=6
10: | e-:p2tr32 | e-:p2tr32 | e-:p2tr32 |
11: | e+2:p8ss88 |
11 g#+2 /4. tr=/16
11: f#+2:pss | e+2:pss d#+2:pss e+2:pss c#+2:pss |
12: | e+:p8ss88 |
12 g#+ /4. tr=/16
12: f#+:pss | e+:pss d#+:pss e+:pss c#+:pss |
13: | b-,b:p2tr16 | c,c+:p2tr16 |
// 75 76 77
0: | e+3:p8ss88 | g#+3:4 f#+3 | e+3:8 d#+3 e+3 c#+3 |
1: | e+2:p8ss88 | g#+2:4 f#+2 | e+2:8 d#+2 e+2 c#+2 |
2: | $leg b,e+:2 | (m) c+:2 g#+:4. f#+:8 | c#+,e+ c+,d#+ c#+,e+ a,c#+ |
3: | $leg b,e+:2 | (m) c+:2 g#+:4. f#+:8 | c#+,e+ c+,d#+ c#+,e+ a,c#+ |
4: | $leg b-:2 | c | c#:8 c c# a- |
5: | $leg b-,b:2 | g# | a |
6: | $leg e-,g#:2 | e-,g# | e-,e |
7: | e,e+:p8ss88 | e,e+:2 | e,e+:p8888 |
8: | $leg e-,e:1. |
p: | (q=3,m,tr=/32) to:2 (q=6) bd2,cc2:4 |
10: | e-:p2tr32 | e-:p2tr32 | e-:p2tr32 |
11: | e+2:p8ss88 | (tr=/16) g#+2:4. f#+2:pss | e+2:pss d#+2:pss e+2:pss c#+2:pss |
12: | e+:p8ss88 | (tr=/16) g#+:4. f#+:pss | e+:pss d#+:pss e+:pss c#+:pss |
13: | b-,b:p2tr16 | c,c+:p2tr16 |
{ if ${start} == 75
13: $leg | c#,c#+:pss c,c+:pss c#,c#+:pss a-,a:pss |
13: $leg | c#,c#+:pss c,c+:pss c#,c#+:pss a-,a:pss |
}
{ elsif ${start} in 83;119;127
13: | c#,c#+:8 c,c+:8 c#,c#+:8 a-,a:8 |
13: | c#,c#+:8 c,c+:8 c#,c#+:8 a-,a:8 |
}
14: | e-:p2tr16 | e-:p2tr16 | e-:p2tr16 |
15: | e-2:p8888 | e-2:p8888 | e-2:p8888 |
14: | e-:p2tr16 | e-:p2tr16 | e-:p2tr16 |
15: | e-2:p8888 | e-2:p8888 | e-2:p8888 |
*
CALL v_all_ff
CALL d_all_staccato
Expand Down Expand Up @@ -501,8 +492,7 @@ END
8: | e-
p: | perc_all:8
10: | e-
11: | e+:8 - $leg $sf_accent
11 c#+ /4+/16 m
11: | e+:8 - $leg $sf_accent (m) c#+:4+16
12: | e:8
13: | g#-,e
14: | e-
Expand All @@ -517,28 +507,26 @@ CALL v_all_pp
CALL d_all_staccato
CALL m91_to_94(start=91)
FUNCTION m91_to_94
// 91 92 93 94
4: | -:2 $leg |
4 c# /2+/2+/8 m
4: -:2 | g#-,c |
6: | -:2 $leg | c+,e+:2 | b,d | c+:8
// 91 92 93 94
4: | -:2 $leg | (m) c#:2+2+8 -:2 | g#-,c |
6: | -:2 $leg | c+,e+:2 | b,d | c+:8
{ if ${start} == 91
11: | -:16 c+ c#+ c+ d#+ c#+ b a |
}
{ else
11: | c#+ c+ c#+ c+ d#+ c#+ b a |
}
11: | a g# e c# c# c# c# c# | e d# c g#- g#- g#- g#- g#- |
11: | a g# e (q=5) c# | e d# c (q=5) g#- |
{ if ${start} == 91
11: | g#- c# e g# c#+ c#+ c#+ c#+ |
11: | g#- c# e g# (q=4) c#+ |
}
{ else
11: | g#- c# e g# c#+ e+ d#+ c#+ |
11: | g#- c# e g# c#+ e+ d#+ c#+ |
}
12: | g#:8 - a - | g# - - e | f# - - d# | e
13: | c#,e:8 - c#,f# - | c#,e - - g#-,c# | g#-,c# - - g#-,d# | g#-,c#
14: | c#:8 - f#- - | c#- - - c#- | g#- - - g#-2 | c#-
15: | c#-:8 - f#-2 - | c#-2 - - c#-2 | g#-2 - - g#-3 | c#-2
12: | g#:8 - a - | g# - - e | f# - - d# | e
13: | c#,e:8 - c#,f# - | c#,e - - g#-,c# | g#-,c# - - g#-,d# | g#-,c#
14: | c#:8 - f#- - | c#- - - c#- | g#- - - g#-2 | c#-
15: | c#-:8 - f#-2 - | c#-2 - - c#-2 | g#-2 - - g#-3 | c#-2
*
END

Expand All @@ -551,8 +539,7 @@ CALL m99(start=100)
FUNCTION m99
2: | $leg c+,d#+:4. c#+,e+:8 |
{ if ${start} == 99
3: | $leg
3 g#+ /1+/4 m
3: | $leg (m) g#+:1+4
}
11: | d#+:16 c+ g# g# g# g#+ e+ c#+ |
12: | d#:8 - - e |
Expand Down Expand Up @@ -595,7 +582,7 @@ END

// m. 105
3: | g#,b:4 g,a# |
6 c+ *2+/2+/8 m
6: | (m) c+:*2+2+8
11: | b g#+ f#+ e+ d#+ f#+ e+ c#+ |
12: | g# - a# - |
13: | g#-,b- - g-,c# - |
Expand All @@ -616,14 +603,12 @@ FUNCTION m106_to_108
14: | e-:p8r8r | b-2:p8r8r | e-:p8r8r |
15: | e-2:p8r8r | b-3:p8r8r | e-2:p8r8r |
{ if ${start} == 106
3 e /1 m
3: g#:2 |
6 e /1 m
3: (m) e:1 g#:2 |
6: (m) e:1
}
{ else
3 e /2. m
3: g#:2 |
6 e /2. m
3: (m) e:2. g#:2 |
6: (m) e:2.
}
*
END
Expand All @@ -645,7 +630,7 @@ CALL m103_to_104(start=111)

// m. 113
3: | g#,b:4 g,a# |
6 c+ *2+4 m
6: | (m) c+:*2+4
11: | b g#+ f#+ e+ d#+ f#+ e+ d#+ |
12: | g# - a# - |
13: | e-,g#- - g-,c# - |
Expand Down Expand Up @@ -1293,28 +1278,27 @@ END
// 8th with 32th triller (8th rest) 8th with 32th triller (8th rest)
PATTERN p8r8r_tr
{ q=2
$ALL /8 tr=/32
- /8
: (tr=/32) $ALL:8 -
}
END

// half note with 16th triller
PATTERN p2tr16
$ALL /2 tr=/16
: (tr=/16) $ALL:2
END

PATTERN p2tr32
$ALL /2 tr=/32
: (tr=/32) $ALL:2
END

// quarter note with 16th triller
PATTERN p4tr16
$ALL /4 tr=/16
: (tr=/16) $ALL:4
END

// quarter note with 32th triller
PATTERN p4tr32
$ALL /4 tr=/32
: (tr=/32) $ALL:4
END

// 16th 16t 4th with 16th triller
Expand All @@ -1327,26 +1311,21 @@ END
////////////////////////////////////////////////////////////////////////////

PATTERN perc167 // 2=to, 0,1=bd2,cc2
2 /2 m, tr=/32
0,1 /4 q=2
: | (m,tr=32) 2:2 (q=2) 0,1:4 |
END

PATTERN perc186_to_187
2 /2 m, tr=/32 // second measure
: 0,1:4 - $f 0,1,2:8 -:4+8
: | (m,tr=/32) 2:2 0,1:4 - $f | 0,1,2:8 -:4+8 |
END

PATTERN perc194
2 /2 m, tr=32
: 0,1:4 0,1
: | (m,tr=/32) 2:2 0,1:4 0,1 |
END

PATTERN perc232
2 /2 m, tr=/32
0,1 /8 q=4
: | (m,tr=/32) 2:2 (q=4) 0,1:8 |
END

PATTERN perc236
2 /2 m, tr=/32
: 0,1:4 -
: | (m,tr=/32) 2:2 0,1:4 - |
END
Loading

0 comments on commit 8c56e74

Please sign in to comment.