Implement MIDI clock
[quincer.git] / README
blobda1d31898432098b9a43f776307387da751fdcba
1 quincer
3 quincer will be a sequencer for live performance of composed works.
5 Features
6 ========
8 Currently implemented:
9 - Send events to multiple output ports
10 - Send MIDI control change events
11 - Per-pattern tempo setting
12 - Prefixes/suffixes
13 - Input files can include other input files
14 - Ticks-per-beat and beats-per-bar are not constrained
15   (though they must be constant within a pattern)
16 - can emit MIDI clock to drive external sequencers/effects
17 - MIDI clock specified at flexible multiples/divisions
18   of the JACK clock
19 - MIDI clock multiples/divisions are unique per output
20 - run looped or once through
21 - pure JACK (and is a timebase master)
23 Planned features, more imminent items first:
24 - Per-pattern swing setting
25 - Base tempo can be altered at runtime via MIDI CC
26 - Jump controls - use MIDI input to skip around (song mode)
27 - prefix/suffix events mask events from main pattern
29 Rationale
30 =========
32 I want a sequencer for live performance of songs that have been
33 previously composed, with the sequencing mostly fixed.
35 But at performance-time I want the ability to make small adjustments
36 to the song's form to, say, skip a verse or draw out a solo section or
37 delay a verse slightly because the drummer dropped a stick.  I want
38 the ability to decide to take the song a little faster or slower than
39 in rehearsal.
41 I want the ability to write a song in an unusual meter, with swing and
42 mid-song tempo changes.  The content of a song pattern should be
43 allowed to start before beat one of the first bar (e.g. pickups
44 (anacrusis), or drum fills, or cues on a cue track) and end after the
45 last beat of the last bar of the pattern.
47 For compose-time workflow, I want to support multiple use cases for a
48 song.  That is, I want to run a file that has a sequenced drum track,
49 or run a different file with a click track instead of drums and maybe
50 an extra verse.  Among these multiple files, content is re-used where
51 possible and files can be checked into source control.
53 Capturing live input is not important, nor is a graphical interface.
54 Session management isn't on the roadmap currently and probably won't
55 be.
57 I've taken inspiration from a few existing sequencers.  The sequencers
58 in some DAWs are very good for non-standard time signatures and swing
59 and tempo changes, but I'd never want the risk/overhead of using a DAW
60 on stage.  The sequencers that are currently for live use have
61 interesting control capabilities but focus on evolving looped beats in
62 an improvisatory way, a very specific use case that isn't needed for
63 all kinds of music.
65 These features aren't all implemented yet but I've got a solid start.
66 I hope you'll find quincer useful while it's in progress.
69 Input file syntax
70 =================
72 The quincer executable takes a single argument, a filename containing
73 the input.  I use files ending with '.qn' as a convention but the
74 program doesn't care.
76 An input file looks like this:
78 voice basskick sampson 1
79 voice rim sampson 1
80 voice rhykeys sampson 1
81 voice suskeys amsynth 1
82 voice reso amsynth 1
84 pattern 88 0
85 $ 38 127
86 f 41 110
87 g 43 110
88 k 90 80
89 j 69 80
90 b 66 70
91 l 62 60
92 M 81 100
93 m 81 60
95 # Reso on the synth
96 r cc 74 0
97 R cc 74 127
99 0.....'.....'.....'.....|.....'.....'.....'.....
100 $         $-      f  g  |                         basskick
101                   k     |                         rim
102 M m m |                                           rhykeys
103 j---------              l---b-----              | suskeys
104 r                       R                       | reso
106 Time spec
107 ---------
108 Look at the final section first, since everything else leads up to
109 this.  There is a meter line "0.....'.....'.....'....." which defines
110 that a bar has four beats and a beat has six ticks.
112 The meter line must contain a 0 for the first tick. It is allowed to
113 contain bars if it's easier for human readers, the program doesn't
114 care as only the first beat after the 0 defines how many ticks are in
115 a beat. It follows from this that within a pattern the ticks-per-beat
116 and beats-per-bar are constant within a pattern.
118 The next lines after the meter line are voice lines, starting with
119 "$         $-      f  g  | basskick".  These show note events and give
120 the voice a name.  Note events can pretty much be any printable character,
121 except '-' which prolongs a note and '|' which is used to mark the end
122 of the events and the start of the voice name.
124 It is legal to give the same voice name to multiple lines.  This can
125 be used to send a block chord to a piano instrument, for example.
127 Notice that the voice lines have their ending '|' at different beats.
128 The length of the pattern is the length of the longest voice in it
129 ("suskeys" or "reso" in this example).  Patterns that are shorter are
130 looped.  It is undefined what happens if your shorter patterns aren't
131 exactly divisible into the longest one, so be sure you've got that
132 right.
134 Pattern declaration and event definitions
135 -----------------------------------------
136 Before that section the pattern is declared:
138 pattern 88 0
139 $ 38 127
140 f 41 110
143 This takes the form:
144 pattern <bpm> <swing>
145 <notechar> [cc] <pitch> <velocity>
146 <notechar> [cc] <pitch> <velocity>
149 Note that 'bpm' is declared for each pattern, which allows mid-song
150 tempo changes.
152 'swing' isn't implemented yet and may be omitted. 'notechar' can be
153 any printable character except - or | (for reasons explained above) or
154 # (comment delimiter).  Future releases will support other MIDI event
155 types such as pitch bend.
157 Voice declarations
158 ------------------
159 At the top are the voice declarations (e.g. "voice basskick sampson
160 1").  This creates a MIDI output in JACK called "sampson" and sends
161 events from the "basskick" voice to channel 1 of that port.
163 This allows you as many output ports as you need, without requiring a
164 separate view of the note events for each port like in many
165 sequencers.
167 This is also good for a device like the Korg Volca Sample.  To play
168 samples 1-10 on that device, notes must be sent to channels 1-10.
169 This isn't difficult in MIDI but almost no sequencers support that
170 kind of multi-channel output, to the point that a custom
171 channel-splitting cable was devised just for the Sample!  No need
172 custom cables if you use quincer.
174 Multiple patterns
175 -----------------
176 A new pattern declaration can follow the voice lines, as many patterns
177 as you need.  
179 A directive at the top 'run once' will cause the sequencer to play
180 top-to-bottom then stop.
182 You could otherwise specify 'run loop' at the top to cause the
183 sequencer to start over after it has reached the bottom.  This is the
184 default behavior if no 'run ...' directive was specified.
186 Comments
187 --------
188 Comments start with a # and go to the end of the line.
190 Include files
191 -------------
192 At any point in the input you can have a line:
194 include foo.qn
196 ...which will behave like includes in other languages (PHP or C
197 preprocessor).
199 This is powerful because it allows re-use of material from different
200 top-level input files, or even within the same one.  As explained in
201 the rationale section above, a single work can have multiple use
202 cases, slightly different but with common elements.  Traditionally
203 sequencers have a "one song = one file" idiom, an unnecessary
204 constraint on your workflow.
206 Prefixes and Suffixes (affixes)
207 -------------------------------
208 quincer supports events that occur before or after the main pattern.
209 Prefixes are useful for musical pickup beats (anacrusis), drum fills,
210 or cue tracks.  Suffixes can be used when a note must linger into the
211 next pattern.
213 To enter a prefix, just add ticks before the 0 in your meter line
215 .'.0.'.'.'.
216 e  A a     | lead
218 The e in this example is treated as a pick-up.
220 To enter a suffix, start a bar with S in your timeline.
222 0.'.'.'.S.
223   A   aeAA| lead
225 The final two A's are the suffix.
227 Affixes (prefixes/suffixes) don't affect when a pattern begins or
228 ends.  The extra notes will overlap the notes in the previous or next
229 patterns.
231 It is not yet implemented for affixes to mask events in the main
232 pattern, but this is planned.  In other words, if a drum fill is
233 entered as a prefix, then the events in the main pattern's drum voices
234 should be omitted.  Today, all the events just play over each other.
235 When masking is implemented, this will allow for affixes that
236 represent breaks (silence).
238 MIDI clock
239 ----------
240 If a line is specified at the beginning like:
242 clock vsamp 1 1
244 ...then MIDI clock messages (including start & stop) will be emitted
245 to the output 'vsamp'.  This allows you to use external sequencers,
246 whose clocks will be synced to quincer's tempo.  In addition to
247 sequencers, some other kinds of devices can use this information
248 (synths can set LFO, or delay effects like Eventide Timefactor can set
249 tap tempo).
251 The '1 1' is the numerator and denominator, which allow you to stretch
252 or compress the emitted clock signals in a flexible way.  Specifying
253 '2 1' with quincer's BPM set at 120 will cause clock to be emitted at
254 60 BPM.  '4 1' would emit clock at 30 BPM, and '1 2' would emit clock
255 at 240 BPM.  It is supported to specify strange (integer) values such
256 as '3 2', which would emit clock at 80 BPM against quincer's internal
257 120 BPM.
259 Notice that clock is specified per output.  I could emit clock to a
260 Volca Sample device at '1 1' (matching quincer's tempo) but also emit
261 at '2 1' to a Volca Keys device which would run its sequence at half
262 the tempo.
264 License
265 =======
266 Copyright (C) 2016 Erik Mackdanz <erikmack@gmail.com>
268 This program is free software: you can redistribute it and/or modify
269 it under the terms of the GNU General Public License as published by
270 the Free Software Foundation, either version 3 of the License, or
271 (at your option) any later version.
273 This program is distributed in the hope that it will be useful,
274 but WITHOUT ANY WARRANTY; without even the implied warranty of
275 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
276 GNU General Public License for more details.
278 You should have received a copy of the GNU General Public License
279 along with this program.  If not, see <http://www.gnu.org/licenses/>.