Skip to content

Commit fe08f24

Browse files
committed
Revised sequ and example
1 parent f34a220 commit fe08f24

File tree

2 files changed

+115
-52
lines changed

2 files changed

+115
-52
lines changed

examples/sequ1.csd

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<CsoundSynthesizer>
2+
3+
<CsInstruments>
4+
5+
ksmps = 32
6+
0dbfs = 1.0
7+
nchnls = 2
8+
9+
instr 1
10+
;; rhythm array - these steps values multiplied by tempo (ticks) in BPM
11+
irhythm[] fillarray 1, 1.5, 0.5, 0.5, 0.5, 0.5, 1.5, 1
12+
13+
;; instrument array - instrument number to render for each step
14+
inst0[] fillarray 11, 12, 13, 14, 15, 16, 17, 18
15+
inst1[] fillarray 19, 20, 21, 22, 23, 24, 25, 26
16+
17+
;; note array - here in cpsmidinn - esentially the 'p4' output from opcode
18+
;; can be any sequence of values
19+
inotes[] fillarray 60, 61, 62, 63, 64, 65, 66, 67
20+
21+
;; variable tempo
22+
kspeed line 60, p3, 180
23+
24+
;; rhythm, inst, notes, bpm, length, mode, verbose
25+
kSeq0 sequ irhythm, inst0, inotes, kspeed, 8
26+
kSeq1 sequ irhythm, inst1, inotes, kspeed * 1.2, 8
27+
endin
28+
29+
instr 11, 12, 13, 14, 15, 16, 17, 18
30+
kl linseg 0, p3*0.01, 1, p3*.99, 0
31+
a1 oscil 0.9, cpsmidinn(p4)
32+
outs1 a1*kl
33+
endin
34+
35+
instr 19, 20, 21, 22, 23, 24, 25, 26
36+
kl linseg 0, p3*0.01, 1,p3*.99, 0
37+
a1 oscil 0.9, cpsmidinn(p4)
38+
outs2 a1*kl
39+
endin
40+
</CsInstruments>
41+
42+
<CsScore>
43+
i1 0 60
44+
e
45+
</CsScore>
46+
</CsoundSynthesizer>

opcodes/sequencer.xml

Lines changed: 69 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,51 @@
11
<refentry id="sequ">
22
<indexterm id="IndexSequ"><primary>sequ</primary></indexterm>
3-
<refentryinfo><title>Instrument Control:Sensing and Control</title></refentryinfo>
3+
<refentryinfo><title>Instrument Control:Sensing and
4+
Control</title></refentryinfo>
45
<refmeta>
56
<refentrytitle>sequ</refentrytitle>
67
</refmeta>
78

89
<refnamediv>
910
<refname>sequ</refname>
1011
<refpurpose>
11-
A software variant of a sequencer unit
12+
Emulate a hardware sequencer
1213
</refpurpose>
1314
</refnamediv>
1415

1516
<refsect1>
1617
<title>Description</title>
1718
<para>
18-
Generates a seqence of events with controls on forward or
19-
backward, anf optional mutation or random choise.
19+
Uses a collection of arrays to generate a sequence of events
20+
with variable tempo that can be played in forward, reverse, back
21+
and forth, and random directions. The max length of the arrays
22+
is 128, and it can be scaled dynamically. Permutational playback
23+
modes feature randomization, probability and other algorithms.
2024
</para>
2125
</refsect1>
2226
<refsect1>
2327
<title>Syntax</title>
24-
<synopsis>kres <command>sequ</command> initriff[], iinstr[], idata[], kbpm, klen [, kmode] [, kverbos]
28+
<synopsis>kres <command>sequ</command> irhythm[], iinstr[], idata[], kbpm, klen [, kmode] [, kstep] [, kverbose]
2529
</synopsis>
2630
</refsect1>
2731

2832
<refsect1>
2933
<title>Initialization</title>
3034
<para>
31-
<emphasis>initriff</emphasis> - array of lengths of the
32-
underlyig riff in beats. The array length is the maximum length of
33-
the sequence and shouk be less than 65.
35+
<emphasis>irhythm</emphasis> - array of durations in
36+
in beats. The actual duration is determined by these values divided
37+
by the current BPM.
3438
</para>
3539
<para>
36-
<emphasis>iinstr</emphasis> - array of instrument numbers to
37-
schedule when the sequencer triggers an evemnt. An instrument of
38-
zero means do nothing.
40+
<emphasis>iinstr</emphasis> - array of instrument numbers scheduled
41+
per step. An instrument number zero does nothing. It skips the note
42+
associated with the step and produces a silence for that note's duration.
3943
</para>
4044
<para>
41-
<emphasis>idata</emphasis> - array of p4 parameters to the
42-
iinstr calls. This can be pitch information, in cps or midinote
43-
number or oher use.
45+
<emphasis>idata</emphasis> - array of p4 values to the
46+
associated iinstr step. Typically, one would specify pitch
47+
information in cps, or MIDI note number; but the arbitrary list
48+
of p4 data values could have other uses in the called iinstr.
4449
</para>
4550
</refsect1>
4651

@@ -50,66 +55,78 @@
5055
<emphasis>kbpm</emphasis> - speed of looping in beats per minute.
5156
</para>
5257
<para>
53-
<emphasis>klen</emphasis> - length of the active part of the sequence,
58+
<emphasis>klen</emphasis> - length of the active part of the
59+
sequence (starting from step 0).
5460
</para>
5561
<para>
56-
<emphasis>kmode</emphasis> - control for the sequencer. A value
57-
of 0 (default) loops forward through the riff, calling the
58-
associated instrument on triggering.
62+
<emphasis>kmode</emphasis> - control the sequencer playback. A value
63+
of 0 (default) loops forward through the sequence, calling the
64+
associated instrument on each step. Other modes are
65+
supported. (See below).
5966
</para>
6067
<para>
61-
<emphasis>kverbose</emphasis> - if non zero prints messages
62-
about the internal state changes. Default is zero
68+
Current playback options for <emphasis>kmode</emphasis> are:
69+
70+
<itemizedlist>
71+
<listitem><para>0 - forward loop</para></listitem>
72+
<listitem><para>n&gt;0 - forward loop with a mutation every n
73+
events</para></listitem>
74+
<listitem><para>-1 - backward loop</para></listitem>
75+
<listitem><para>-2 - back and forth</para></listitem>
76+
<listitem><para>-3 - random events</para></listitem>
77+
<listitem><para>-4 - play the entire sequence forward one time
78+
and stop</para></listitem>
79+
<listitem><para>-5 - play the entire sequence backward one time
80+
and stop</para></listitem>
81+
<listitem><para>-6 - reset</para></listitem>
82+
</itemizedlist>
83+
</para>
84+
<para>
85+
<emphasis>kstep</emphasis> - if non zero, replace the irhythm array
86+
with k-rate triggers. These could be from a MIDI keyboard or any other
87+
krate controller.
88+
Default is zero.
6389
</para>
6490
<para>
65-
<emphasis>kres</emphasis> - gives the index of the event created
66-
for the current k-cycle, or -1 if no event happened.
91+
<emphasis>kverbose</emphasis> - if non zero, prints messages
92+
about the internal state changes. Default is zero.
6793
</para>
6894
<para>
69-
<emphasis>sequ</emphasis> is a complex opcode that generates a
70-
sequence of instrument events in various orders, controlled by
71-
kmode.
95+
<emphasis>kres</emphasis> - gives the index of the event created
96+
for the current k-cycle, or -1 if no event happened.
7297
</para>
7398

7499
<note>
75100
<para>
76-
values of <emphasis>kmode</emphasis> currently implemented are:
77-
78-
<itemizedlist>
79-
<listitem><para>0 - forward loop</para></listitem>
80-
<listitem><para>n&gt;0 - forward loop with a mutation every n events</para></listitem>
81-
<listitem><para>-1 - backward loop</para></listitem>
82-
<listitem><para>-2 - pause</para></listitem>
83-
<listitem><para>-3 - random events</para></listitem>
84-
<listitem><para>-5 - reset</para></listitem>
85-
</itemizedlist>
86-
87-
Note also that while the arrays are i-time the values of the
88-
entris are read a k-rate wen used. This means that using global
89-
i-rate vectors and it is possible with care to change note
90-
details at performance time.
101+
While the irhythm, iinstr, and idata, arrays are i-time, the values of the
102+
entries are read at k-rate when used. This means that by using
103+
global
104+
i-rate vectors, it is possible (with care) to change the specific
105+
values and other
106+
details at performance time.
91107
</para>
92108
</note>
93109
</refsect1>
94110

95-
<!-- <refsect1> -->
96-
<!-- <title>Example</title> -->
97-
<!-- <para> -->
98-
<!-- Here is an example of the sequ opcode. It uses the file <ulink url="examples/sequ.csd"><citetitle>sequ.csd</citetitle></ulink> -->
99-
<!-- <example> -->
100-
<!-- <title>Example of the sequ opcode.</title> -->
101-
<!-- <xi:include href="examples-xml/sequ.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> -->
102-
a <!-- </example> -->
103-
<!-- </para> -->
104-
<!-- </refsect1> -->
105-
111+
<refsect1>
112+
<title>Example</title>
113+
<para>
114+
Here is an example of the sequ opcode. It uses the file <ulink url="examples/sequ1.csd"><citetitle>sequ1.csd</citetitle></ulink>
115+
<example>
116+
<title>Example of the sequ opcode.</title>
117+
<xi:include href="examples-xml/sequ.csd.xml" xmlns:xi="
118+
https://us-west-2.protection.sophos.com?d=w3.org&u=aHR0cDovL3d3dy53My5vcmcvMjAwMS9YSW5jbHVkZSIv&i=NWYxNzBkMDNiNTVmZGEwZmIyNjczYmRm&t=Yk01Y2t6MmdSQUZjY3NsMkpBNDNPOHFnRzdtSEg2VXQ0NEhzSzBET0VGOD0=&h=383cb261e7354609a248f1d6b4767d0b>
119+
a </example>
120+
</para>
121+
</refsect1>
122+
106123
<!-- <refsect1> -->
107124
<!-- <title>See Also</title> -->
108125
<!-- <para> -->
109126
<!-- <link linkend="foobar"><citetitle>foobarmetro</citetitle></link>, -->
110127
<!-- </para> -->
111128
<!-- </refsect1> -->
112-
129+
113130
<refsect1>
114131
<title>Credits</title>
115132
<para>Written by &namejohn;</para>

0 commit comments

Comments
 (0)