You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+45-28Lines changed: 45 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,5 @@
1
+
# Gong
2
+
1
3
## Introduction
2
4
3
5
gong is a small multitrack MIDI control language. It consists of a shell with live mode, player and a linter.
@@ -16,57 +18,54 @@ go install github.com/mgnsk/gong/cmd/gong@latest # Requires rtmidi development p
16
18
- The default command lists the available MIDI ports. The default port is the 0 port.
17
19
18
20
```sh
19
-
$ gong
20
-
0: Midi Through:Midi Through Port-0 14:0
21
-
1: Hydrogen:Hydrogen Midi-In 135:0
22
-
2: VMPK Input:in 128:0
21
+
$ gong
22
+
0: Midi Through:Midi Through Port-0 14:0
23
+
1: Hydrogen:Hydrogen Midi-In 135:0
24
+
2: VMPK Input:in 128:0
23
25
```
24
26
25
27
- Play a file through a specific port. The port name must contain the passed in flag value:
26
28
27
29
```sh
28
-
$ gong play --port "VMPK" examples/bach
30
+
gong play --port "VMPK" examples/bach
29
31
```
30
32
31
33
To use piped input, pass `-` as the argument:
32
34
33
35
```sh
34
-
$ cat examples/bach | gong play --port "VMPK" -
36
+
cat examples/bach | gong play --port "VMPK" -
35
37
```
36
38
37
39
- Port can also be specified by its number:
38
40
39
41
```sh
40
-
$ gong play --port 2 examples/bonham
42
+
gong play --port 2 examples/bonham
41
43
```
42
44
43
45
- Enter a shell on the default port:
44
46
45
47
```sh
46
-
$ gong shell
47
-
>>>
48
+
gong shell
48
49
```
49
50
50
51
A shell is a text shell for the gong language. It is capable of multiline input when entering bars.
51
52
52
53
- Enter a shell on a specific port:
53
54
54
55
```sh
55
-
$ gong shell --port "Hydrogen"
56
-
>>>
56
+
gong shell --port "Hydrogen"
57
57
```
58
58
59
59
- Load a file and enter a shell:
60
60
61
61
```sh
62
-
$ gong load --port "Hydrogen" examples/bonham
63
-
>>>
62
+
gong load --port "Hydrogen" examples/bonham
64
63
```
65
64
66
65
- Enter live mode by entering the `live` command (TODO):
67
66
68
67
```sh
69
-
$ gong live --port "Hydrogen" examples/live_drumset
68
+
gong live --port "Hydrogen" examples/live_drumset
70
69
```
71
70
72
71
Live mode is an unbuffered input mode in the shell. Whenever an assigned key is pressed,
@@ -75,13 +74,13 @@ a note on message is sent to the port.
75
74
- Lint a file:
76
75
77
76
```sh
78
-
$ gong lint examples/bonham
77
+
gong lint examples/bonham
79
78
```
80
79
81
80
- Help.
82
81
83
82
```sh
84
-
> gong --help
83
+
$ gong --help
85
84
gong is a MIDI control language and interpreter.
86
85
87
86
Usage:
@@ -92,6 +91,7 @@ Available Commands:
92
91
completion Generate the autocompletion script for the specified shell
93
92
help Help about any command
94
93
lint Lint a file
94
+
live Load a file and continuein a live shell
95
95
load Load a file and continuein a gong shell
96
96
play Play a file
97
97
shell Run a gong shell
@@ -105,13 +105,16 @@ Use " [command] --help" for more information about a command.
105
105
## Syntax
106
106
107
107
The language consists of commands and note lists.
108
-
The commands tempo, program, control, start and stop are global commands. The commands timesig, velocity and channel are local (when used in bars). TODO: make the distinction that global commands are like global functions and local commands are like local variables.
108
+
The commands tempo, program, control, start and stop are global commands.
109
+
The commands timesig, velocity and channel, when used in bars, are local to bars.
110
+
111
+
-### Comments
109
112
110
-
-#### Comments
111
113
```
112
114
// This is a line comment.
113
115
```
114
-
-#### Commands
116
+
117
+
-### Commands
115
118
116
119
```
117
120
// Assign a note.
@@ -142,17 +145,22 @@ The commands tempo, program, control, start and stop are global commands. The co
142
145
control 1 127
143
146
```
144
147
145
-
-#### Note assignment
148
+
-### Note assignment
149
+
146
150
Assign a MIDI note number to a note letter.
151
+
147
152
```
148
153
// Kick drum (on the drum channel).
149
154
assign k 36
150
155
// Middle C (on other channels).
151
156
assign c 60
152
157
```
153
-
-#### Notes
158
+
159
+
-### Notes
160
+
154
161
Notes are written as a letter symbol (must be assigned first) plus properties.
155
162
The available properties are
163
+
156
164
- sharp (`#`)
157
165
- flat (`$`)
158
166
- accentuated (`^`)
@@ -161,7 +169,9 @@ The commands tempo, program, control, start and stop are global commands. The co
161
169
- dot (`.`)
162
170
- tuplet (`/3`) (The number in the tuplet specifies the divison, for example a quintuplet `/5`)
163
171
- let ring (`*`)
164
-
-#### Note values
172
+
173
+
-### Note values
174
+
165
175
```
166
176
// Whole note.
167
177
x1
@@ -177,14 +187,18 @@ The commands tempo, program, control, start and stop are global commands. The co
177
187
x32
178
188
// And so on...
179
189
```
190
+
180
191
-### Rests
192
+
181
193
```
182
194
// A quarter rest.
183
195
-
184
196
// An 8th rest.
185
197
-8
186
198
```
187
-
-#### Dotted notes and tuplets
199
+
200
+
-### Dotted notes and tuplets
201
+
188
202
```
189
203
// Dotted quarter note.
190
204
x.
@@ -199,7 +213,9 @@ The commands tempo, program, control, start and stop are global commands. The co
199
213
// Dotted 8th quintuplet note.
200
214
x8./5
201
215
```
202
-
-#### Flat and sharp notes.
216
+
217
+
-### Flat and sharp notes
218
+
203
219
```
204
220
// A note.
205
221
c
@@ -208,7 +224,8 @@ The commands tempo, program, control, start and stop are global commands. The co
208
224
// A flat note (MIDI note number - 1).
209
225
c$
210
226
```
211
-
-#### Note grouping
227
+
228
+
-### Note grouping
212
229
213
230
Notes can be arbitrarily grouped and properties applied to multiple notes at once.
214
231
@@ -229,7 +246,7 @@ The commands tempo, program, control, start and stop are global commands. The co
229
246
f8 c8 g8 f#8 c#8 g#8
230
247
```
231
248
232
-
-####Bars
249
+
-### Bars
233
250
234
251
Bars are used to specify multiple tracks playing at once.
235
252
Only `timesig`, `velocity` and `channel` are scoped to the bar.
@@ -263,7 +280,7 @@ The commands tempo, program, control, start and stop are global commands. The co
263
280
The file is included in the `examples` directory. To play into the default port, run
264
281
265
282
```sh
266
-
$ gong play examples/bonham
283
+
gong play examples/bonham
267
284
```
268
285
269
286
```
@@ -333,7 +350,7 @@ play "fill"
333
350
The file is included in the `examples` directory. To play into the default port, run
334
351
335
352
```sh
336
-
$ gong play examples/bach
353
+
gong play examples/bach
337
354
```
338
355
339
356
It is possible to write melodies using gong in a limited way. Here's 2 bars of Bach:
0 commit comments