sequencer.nv
· 2.5 KiB · Text
Ham
Playground
|:@math: $x :@math: $op $y| :@math: $op $x $y
|:note: C | :note number: 0
|:note: C#| :note number: 1
|:note: Db| :note number: 1
|:note: D | :note number: 2
|:note: D#| :note number: 3
|:note: Eb| :note number: 3
|:note: E | :note number: 4
|:note: F | :note number: 5
|:note: F#| :note number: 6
|:note: Gb| :note number: 6
|:note: G | :note number: 7
|:note: G#| :note number: 8
|:note: Ab| :note number: 8
|:note: A | :note number: 9
|:note: A#| :note number: 10
|:note: Bb| :note number: 10
|:note: B | :note number: 11
|:note: $x| :note number: $x
|:note number: _|
|:note number: $note :@math: $actual-note|
:note number: $actual-note
|:note number: $note? :octave: $octave|
:@math: multiply $octave 12
:@math: add $note
|:note number: $note? :note basis: $basis|
:@math: add $note $basis
|:BPM: $x :@math: $n|
:note delay: $n
|:BPM: $x? :note length: 1 / $y?|
:@math: divide 60000 $x
:@math: divide $y
|:: play a note on $channel :note number: $note|
:: play $note on $channel
|:: play a note on $channel|
|:: play $note on $channel|
:played notes: $note $channel
:: set $note on on $channel
|:: stop $note on $channel|
:: set $note off on $channel
|:: set $note $state on $channel :note velocity: $velocity?|
:@midi: note $state $note $velocity $channel
|:: turn off all played notes? :played notes: $note $channel|
:: set $note off on $channel
|:: turn off all played notes|
|:: sleep $duration $unit|
:@time: sleep $duration $unit
|:: using MIDI output $output|
:@midi: set-output $output
||:channel: 0
|:: play? ::# ::$octave :set octave: $old|
:set octave: $octave
|:: play? ::# ::$octave|
:set octave: $octave
|:: play ::; :note delay: $delay?|
:: sleep $delay milliseconds
:: turn off all played notes
:: go to the first channel
:: play
:<: ;
|:: play? :: $note :blank note symbol: $note?|
:<: $note
|:: play :: $note :channel: $channel? :set octave: $octave?|
:: play a note on $channel :note: $note :octave: $octave
:: go to the next channel
:: play
:<: $note
|:: play :loop:?|
:: replay
|:: replay :<: $note|
:: replay
:: $note
|:: replay|
:: play
|:: go to the next channel :@math: $x|
:channel: $x
|:: go to the next channel? :channel: $x|
:@math: add $x 1
|:: go to the first channel :channel: $x|
:channel: 0
|::|:: using MIDI output 0 :: play :loop: :: (
# 5
C C _ _ ;
D _ _ _ ;
G G _ _ ;
E _ _ _ ;
C C _ _ ;
)
:blank note symbol: _
:note velocity: 32
:BPM: 180
:note length: 1 / 1
1 | |:@math: $x :@math: $op $y| :@math: $op $x $y |
2 | |
3 | |:note: C | :note number: 0 |
4 | |:note: C#| :note number: 1 |
5 | |:note: Db| :note number: 1 |
6 | |:note: D | :note number: 2 |
7 | |:note: D#| :note number: 3 |
8 | |:note: Eb| :note number: 3 |
9 | |:note: E | :note number: 4 |
10 | |:note: F | :note number: 5 |
11 | |:note: F#| :note number: 6 |
12 | |:note: Gb| :note number: 6 |
13 | |:note: G | :note number: 7 |
14 | |:note: G#| :note number: 8 |
15 | |:note: Ab| :note number: 8 |
16 | |:note: A | :note number: 9 |
17 | |:note: A#| :note number: 10 |
18 | |:note: Bb| :note number: 10 |
19 | |:note: B | :note number: 11 |
20 | |:note: $x| :note number: $x |
21 | |
22 | |:note number: _| |
23 | |:note number: $note :@math: $actual-note| |
24 | :note number: $actual-note |
25 | |:note number: $note? :octave: $octave| |
26 | :@math: multiply $octave 12 |
27 | :@math: add $note |
28 | |:note number: $note? :note basis: $basis| |
29 | :@math: add $note $basis |
30 | |
31 | |:BPM: $x :@math: $n| |
32 | :note delay: $n |
33 | |:BPM: $x? :note length: 1 / $y?| |
34 | :@math: divide 60000 $x |
35 | :@math: divide $y |
36 | |
37 | |:: play a note on $channel :note number: $note| |
38 | :: play $note on $channel |
39 | |:: play a note on $channel| |
40 | |
41 | |:: play $note on $channel| |
42 | :played notes: $note $channel |
43 | :: set $note on on $channel |
44 | |:: stop $note on $channel| |
45 | :: set $note off on $channel |
46 | |
47 | |:: set $note $state on $channel :note velocity: $velocity?| |
48 | :@midi: note $state $note $velocity $channel |
49 | |
50 | |:: turn off all played notes? :played notes: $note $channel| |
51 | :: set $note off on $channel |
52 | |:: turn off all played notes| |
53 | |
54 | |:: sleep $duration $unit| |
55 | :@time: sleep $duration $unit |
56 | |
57 | |:: using MIDI output $output| |
58 | :@midi: set-output $output |
59 | |
60 | ||:channel: 0 |
61 | |:: play? ::# ::$octave :set octave: $old| |
62 | :set octave: $octave |
63 | |:: play? ::# ::$octave| |
64 | :set octave: $octave |
65 | |:: play ::; :note delay: $delay?| |
66 | :: sleep $delay milliseconds |
67 | :: turn off all played notes |
68 | :: go to the first channel |
69 | :: play |
70 | :<: ; |
71 | |:: play? :: $note :blank note symbol: $note?| |
72 | :<: $note |
73 | |:: play :: $note :channel: $channel? :set octave: $octave?| |
74 | :: play a note on $channel :note: $note :octave: $octave |
75 | :: go to the next channel |
76 | :: play |
77 | :<: $note |
78 | |:: play :loop:?| |
79 | :: replay |
80 | |
81 | |:: replay :<: $note| |
82 | :: replay |
83 | :: $note |
84 | |:: replay| |
85 | :: play |
86 | |
87 | |:: go to the next channel :@math: $x| |
88 | :channel: $x |
89 | |:: go to the next channel? :channel: $x| |
90 | :@math: add $x 1 |
91 | |
92 | |:: go to the first channel :channel: $x| |
93 | :channel: 0 |
94 | |
95 | |::|:: using MIDI output 0 :: play :loop: :: ( |
96 | # 5 |
97 | C C _ _ ; |
98 | D _ _ _ ; |
99 | G G _ _ ; |
100 | E _ _ _ ; |
101 | C C _ _ ; |
102 | ) |
103 | :blank note symbol: _ |
104 | :note velocity: 32 |
105 | :BPM: 180 |
106 | :note length: 1 / 1 |
107 |