Add examples
This commit is contained in:
34
examples/adeste.midi.mus
Normal file
34
examples/adeste.midi.mus
Normal file
@@ -0,0 +1,34 @@
|
||||
import smnp.io;
|
||||
import smnp.audio.midi;
|
||||
import smnp.music;
|
||||
|
||||
println("Adeste Fideles");
|
||||
println("by John Francis Wade");
|
||||
|
||||
instrument = 91;
|
||||
|
||||
S = [@g] + $ 4/4 @g:2 @d @g | @a:2 @d:2 | @h @a @h @c5 | @h:2 @a @g |
|
||||
@g:2 @f# @e | @f# @g @a @h | @f#:2 @e:4d @d:8 | @d:2d 4 |
|
||||
@d5:2 @c5 @h | @c5:2 @h:2 | @a @h @g @a | @f#:4d @e:8 @d @g |
|
||||
@g @f# @g @a | @g:2 @d @h | @h @a @h @c5 | @h:2 @a @h |
|
||||
@c5 @h @a @g | @f#:2 @g @c5 | @h:2 @a:4d @g:8 | @g:1 ||;
|
||||
|
||||
A = [@d] + $ 4/4 @d:2 @d @d | @e:2 @d:2 | @d @d @d @e | @d:2 @d @h3 |
|
||||
@h3 @c# @d @c# | @d @d @d @d | @d:2 @c#:4d @d:8 | @d:2d 4 |
|
||||
@d:2 @e:8 @f#:8 @g | @g @f# @g:2 | @d @d @e @e | @d:2 @d @d |
|
||||
@d:1 | @d:2d @d | @d:1 | @d:2d @g |
|
||||
@f# @g @d @d:8 @c#:8 | @d:2 @d @e | @d:2 @d:4d @h3:8 | @h3:1 ||;
|
||||
|
||||
T = [@h3] + $ 4/4 @h3:2 @h3 @h3 | @c:2 @a3:2 | @g3 @a3 @g3 @g3 | @g3:2 @f#3 @g3 |
|
||||
@g3:2 @a3 @a3 | @a3 @g3 @f#3 @d3 | @a3:2 @g3:4d @f#3:8 | @f#3:2d 4 |
|
||||
@h3:2 @c @d | @c:2 @d:2 | @d @g3 @h3 @c | @a3:2 @f#3 @h3 |
|
||||
@h3 @a3 @h3 @c | @h3:2d @g3 | @g3 @f#3 @g3 @a3 | @g3:2 @f#3 @d |
|
||||
@d @d @a3 @a3 | @a3:2 @g3:2 | @g3:2 @f#3:4d @g3:8 | @g3:1 ||;
|
||||
|
||||
B = [@g3] + $ 4/4 @g3:2 @h3 @g3 | @g3:2 @f#3:2 | @g3 @f#3 @g3 @c3 | @d3:2 @d3 @e3 |
|
||||
@e3:2 @d3 @a2 | @d3 @h2 @f#2 @g2 | @a2:2 @a2:4d @d3:8 | @d2:2d 4 |
|
||||
@h3:2 @a3 @g3 | @a3:2 @g3:2 | @f#3 @g3 @e3 @c3 | @d3:2 @d3 4 |
|
||||
1 | 1 | 1 | 2 4 @g3 |
|
||||
@a3 @g3 @f#3 @e3 | @d3 @c3 @h2 @c3 | @d3:2 @d3:4d @g2:8 | @g2:1 ||;
|
||||
|
||||
midi({ instrument -> instrument }, S, A, T, transpose(-12, B));
|
||||
32
examples/adeste.synth.mus
Normal file
32
examples/adeste.synth.mus
Normal file
@@ -0,0 +1,32 @@
|
||||
import smnp.io;
|
||||
import smnp.audio.synth;
|
||||
import smnp.music;
|
||||
|
||||
println("Adeste Fideles");
|
||||
println("by John Francis Wade");
|
||||
|
||||
S = [@g] + $ 4/4 @g:2 @d @g | @a:2 @d:2 | @h @a @h @c5 | @h:2 @a @g |
|
||||
@g:2 @f# @e | @f# @g @a @h | @f#:2 @e:4d @d:8 | @d:2d 4 |
|
||||
@d5:2 @c5 @h | @c5:2 @h:2 | @a @h @g @a | @f#:4d @e:8 @d @g |
|
||||
@g @f# @g @a | @g:2 @d @h | @h @a @h @c5 | @h:2 @a @h |
|
||||
@c5 @h @a @g | @f#:2 @g @c5 | @h:2 @a:4d @g:8 | @g:1 ||;
|
||||
|
||||
A = [@d] + $ 4/4 @d:2 @d @d | @e:2 @d:2 | @d @d @d @e | @d:2 @d @h3 |
|
||||
@h3 @c# @d @c# | @d @d @d @d | @d:2 @c#:4d @d:8 | @d:2d 4 |
|
||||
@d:2 @e:8 @f#:8 @g | @g @f# @g:2 | @d @d @e @e | @d:2 @d @d |
|
||||
@d:1 | @d:2d @d | @d:1 | @d:2d @g |
|
||||
@f# @g @d @d:8 @c#:8 | @d:2 @d @e | @d:2 @d:4d @h3:8 | @h3:1 ||;
|
||||
|
||||
T = [@h3] + $ 4/4 @h3:2 @h3 @h3 | @c:2 @a3:2 | @g3 @a3 @g3 @g3 | @g3:2 @f#3 @g3 |
|
||||
@g3:2 @a3 @a3 | @a3 @g3 @f#3 @d3 | @a3:2 @g3:4d @f#3:8 | @f#3:2d 4 |
|
||||
@h3:2 @c @d | @c:2 @d:2 | @d @g3 @h3 @c | @a3:2 @f#3 @h3 |
|
||||
@h3 @a3 @h3 @c | @h3:2d @g3 | @g3 @f#3 @g3 @a3 | @g3:2 @f#3 @d |
|
||||
@d @d @a3 @a3 | @a3:2 @g3:2 | @g3:2 @f#3:4d @g3:8 | @g3:1 ||;
|
||||
|
||||
B = [@g3] + $ 4/4 @g3:2 @h3 @g3 | @g3:2 @f#3:2 | @g3 @f#3 @g3 @c3 | @d3:2 @d3 @e3 |
|
||||
@e3:2 @d3 @a2 | @d3 @h2 @f#2 @g2 | @a2:2 @a2:4d @d3:8 | @d2:2d 4 |
|
||||
@h3:2 @a3 @g3 | @a3:2 @g3:2 | @f#3 @g3 @e3 @c3 | @d3:2 @d3 4 |
|
||||
1 | 1 | 1 | 2 4 @g3 |
|
||||
@a3 @g3 @f#3 @e3 | @d3 @c3 @h2 @c3 | @d3:2 @d3:4d @g2:8 | @g2:1 ||;
|
||||
|
||||
synth({}, S, A, T, transpose(-12, B));
|
||||
68
examples/bohemian_rhapsody.mus
Normal file
68
examples/bohemian_rhapsody.mus
Normal file
@@ -0,0 +1,68 @@
|
||||
import smnp.io;
|
||||
import smnp.audio.midi;
|
||||
import smnp.music;
|
||||
import smnp.collection;
|
||||
|
||||
println("Bohemian Rhapsody :: part");
|
||||
println("by Queen");
|
||||
|
||||
#B
|
||||
## Melody
|
||||
M1 = (2 ^ 1) + $ 4/4 @d:8 @d:8 + 2 8 @b3:8 | @c:8 @d:16 @d:16 + 4 4 8 @d:16 @d:16 |
|
||||
@eb:8 @f:8 @eb:8 @d:8 @c @c:8 @d:8 | @eb:16 @f:8 @eb:8d @d:8 @c 4 |
|
||||
@d:8 @d:8 + 2 @d:8 @f:8 | @a:8d @g:16 @g:2 8 @g:8 |
|
||||
@b:8 @b:8 @b:8 @b:8 @b:8d @g:16 @d:8d @c:16 | @c:2 2 ||;
|
||||
|
||||
## Piano measures
|
||||
p_B = $ 4/4 @d:8 @f3:8 @b3:8 @d:8 @g:8 @f3:8 @f:8 + 8 ||;
|
||||
p_g = $ 4/4 @d:8 @g3:8 @b3:8 @d:8 @a:8 @g3:8 @g:8 @b3:8 ||;
|
||||
p_c = $ 4/4 @g:8 @c:8 @eb:8 @g:8 @d5:8 @c:8 @c5:8 @c:8 ||;
|
||||
p_cF = $ 4/4 @b:8 @c:8 @eb:8 @g:8 @a:8 @eb:8 @f:8 @c:8 ||;
|
||||
p1 = $ 4/4 @eb:8 @c:8 @eb:8 @g:8 @eb:8 @g:8 @eb:8 @g:8 | @eb:8 @a3:8 @eb:8 @g:8 @eb:8 @g:8 @eb:8 @g:8 ||;
|
||||
|
||||
## Piano
|
||||
P1 = p_B + p_B + p_B + p_g + p_c + p_cF + p_B + p_g + p1;
|
||||
|
||||
## Bass
|
||||
B1 = $ 4/4 @b3:1 | @b3:1 | @b3:1 | @g3:1 | @c3:1 | @c3:2 @f3:2 | @b3:2d @a3 | @g3:1 | @c3:2 @h2 @b2 | @a2:2 @ab2 @g2 ||;
|
||||
|
||||
# Eb
|
||||
## Melody
|
||||
M2 = $ 4/4 @g:16 @g:16 + 2 8 @f:8 @g:16 @ab:16 | @g:2 4 8 @g:16 @g:16 |
|
||||
@ab:8d @g:16 @g:8 @f:16 @f:2 @b3:16 | @b3:8 @f:8 @f:8 @g:16 @g:8d @ab:8 @ab:8 @b:16 @ab:16 |
|
||||
@ab:8 @g:8 8 @f:16 @g:16 @b:4d @f:16 @g:16 | @eb:4d @b3:16 @b3:16 @h3:8 @db:8 @h3:16 @db:16 @h3:8 |
|
||||
@b3:2 2 ||;
|
||||
|
||||
|
||||
## Piano measures
|
||||
p_Eb = $ 4/4 @b:8 @eb:8 @eb5:8 @eb:8 @b:8 @eb:8 @f:8 @b:8 ||;
|
||||
p_f = $ 4/4 @ab:8 @f:8 @ab:8 @ab:8 @ab:8 @eb:8 @ab:8 @d:8 ||;
|
||||
p_B = $ 4/4 @d @f @g @ab ||;
|
||||
p_EbB = $ 4/4 @b:8 @eb:8 @eb5:8 @eb:8 @b:8 @d:8 @b:8 @d:8 ||;
|
||||
p_cf = $ 4/4 @g:8 @c:8 @g:8 @c:8 @h3:2 ||;
|
||||
|
||||
## Piano
|
||||
P2 = p_Eb + p_c + p_f + p_B + p_EbB + p_cf;
|
||||
|
||||
## Bass
|
||||
B2 = $ 4/4 @eb3:2d @d3 | @c3:1 | @f3:4d @e3:8 @eb3 @d3 | @b2 @b2 @b2 @b2 | @eb3:2 @d3:2 |@c2:2 @f2:2 | @eb2:2 2 ||;
|
||||
|
||||
# Combine part 1 and part 2
|
||||
M = M1 + M2;
|
||||
P = P1 + P2;
|
||||
B = B1 + B2;
|
||||
|
||||
# Drums
|
||||
D = [
|
||||
(10 ^ 1) + (6 ^ $ 4/4 @C2:8 8 8 16 @C2:16 @C2:8 @C2:8 4 ||).flatten(),
|
||||
(10 ^ 1) + (6 ^ $ 4/4 4 @E2 4 @E2 ||).flatten(),
|
||||
(10 ^ 1) + (6 ^ $ 4/4 @F#2:8 @F#2:8 @F#2:8 @F#2:8 @F#2:8 @F#2:8 @F#2:8 @F#2:8 ||).flatten()
|
||||
|
||||
];
|
||||
|
||||
midi({ bpm -> 72 }, {
|
||||
1 -> [transpose(12, M)],
|
||||
2 -> [P],
|
||||
3 -> [B],
|
||||
10 -> D
|
||||
});
|
||||
21
examples/bubble_sort.mus
Executable file
21
examples/bubble_sort.mus
Executable file
@@ -0,0 +1,21 @@
|
||||
import smnp.io;
|
||||
import smnp.collection;
|
||||
import smnp.math;
|
||||
|
||||
function bubbleSort(numbers: list<int, float>) {
|
||||
sorted = numbers;
|
||||
-range(0, numbers.size) as i ^ {
|
||||
i as j ^ {
|
||||
if (sorted.get(j) > sorted.get(j+1)) {
|
||||
sorted = sorted.swap(j, j+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sorted;
|
||||
}
|
||||
|
||||
randList = range(1, 20).shuffle();
|
||||
|
||||
println(randList);
|
||||
println(bubbleSort(randList));
|
||||
124
examples/cantina.mus
Normal file
124
examples/cantina.mus
Normal file
@@ -0,0 +1,124 @@
|
||||
import smnp.io;
|
||||
import smnp.collection;
|
||||
import smnp.audio.midi;
|
||||
|
||||
println("Star Wars :: Cantina Band");
|
||||
println("by John Williams");
|
||||
|
||||
cb1 = [@a, @d5, @a, @d5] + [@a:8, @d5, @a:8, 8, @g#:8, @a];
|
||||
cb2 = [@a:8, @g#:8, @a:8, @g:8, 8, @f#:8, @g:8, @gb:8];
|
||||
cb3 = [@f:4d, @d:2, 8];
|
||||
cb4 = [@g:8, 8, @g:4d, @f#:8, @g];
|
||||
cb5 = [@c5:8, @b, @a, @g:4d];
|
||||
cb6 = [@c5:8, 8, @c5:4d, @a:8, @g];
|
||||
cb7 = [@f:4d, @d:2, 8];
|
||||
cb8 = [@d:2, @f:2, @a:2, @c5:2];
|
||||
cb9 = [@eb5, @d5, @g#:8, @a, @f:8];
|
||||
|
||||
CB1 = cb1 + cb2 + cb3 + cb1 + cb4 + cb5 + cb1 + cb6 + cb7 + cb8 + cb9 + [1];
|
||||
|
||||
cb11 = 2 ^ [8, @a5, @f5:8, @a5:8, 8, 4];
|
||||
cb12 = [8, @a5, @f5:8, @g#5:8, @a5, @f5:8];
|
||||
cb13 = [@f5:4d, @d5:2, 8];
|
||||
cb14 = [8, @a5, @f5:8, @g#5:8, @a5, @g5:8];
|
||||
cb15 = [@g5:2, @c5:2];
|
||||
cb16 = [@b:8, @d5:8, @f5, @h:8, @d5:8, @f5];
|
||||
cb17 = [@g#:8, @a5, @d5:2, 8];
|
||||
cb18 = [@d:8, @f:8, @h:8, @d5:8, @g#:8, @a, @f:8];
|
||||
cb19 = [@f:2d, 4];
|
||||
|
||||
CB2 = cb11 + cb12 + cb13 + cb11 + cb14 + cb15 + cb11 + cb12 + cb13 + cb16 + cb17 + cb18 + cb19;
|
||||
|
||||
cb20 = [@f, 8, @ab, @f:8, @g];
|
||||
cb21 = [8, @f:8, @ab:8, @f:8, @g:8, @f:8, @ab:8, @d:8];
|
||||
cb22 = [@f, 8, @ab, @f:8, @g];
|
||||
cb23 = [@f:8, @f:8, @ab:8, @f:8, @g:8, @f:8, @ab:8, @f:8];
|
||||
cb24 = [@g:8, @f:8, @ab:8, @f:8, @g:8, @f:8, @ab:8, @d:8];
|
||||
cb25 = [@f:8, @f:8, @ab:8, @f:8, @ab:8, @f, @f:8, @f:2d, 4];
|
||||
|
||||
CB3 = cb20 + cb21 + cb22 + cb21 + cb22 + cb21 + cb23 + cb24 + cb22 + cb21 + cb22 + cb21 + cb22 + cb21 + cb25;
|
||||
|
||||
cb26 = [@c5, 8, @e5:8, 4, @g5];
|
||||
cb27 = [@g5:8, @g5, @g5:8, @g5, @e5:8, @c5:8];
|
||||
cb28 = [@f5, @f5:8, @f5:8, @f5:8, @g5, @a5:8, @a5:1];
|
||||
cb29 = [@e5, @e5, @g5:8, @g5, @c5:8];
|
||||
cb30 = [@c5:8, @e5, @c5:8, @e5, @g5];
|
||||
cb31 = [@f5, @f5:8, @f5, @g5, @a5:8, @a5:1];
|
||||
cb32 = [@b5, @b5, @d6, @b5:8, @db6:8];
|
||||
cb33 = [@db6:8, @db6:8, @b5, @db6, @b5];
|
||||
cb34 = [@f5, @f5, @f5:8, @ab5, @d6:8, @d6:1];
|
||||
cb35 = [8, @b, @d5:8, @g5, @g5];
|
||||
cb36 = [8, @e5, 8, @e5, @e5];
|
||||
cb37 = [8, @f5, @f5:8, @f5, @f5:8, @f5:8];
|
||||
cb38 = [@f5:8, @f5, @f5:8, @f5:8, @f5:8, @f5];
|
||||
|
||||
CB4 = cb26 + cb27 + cb28 + cb29 + cb30 + cb31 + cb32 + cb33 + cb34 + cb35 + cb36 + cb37 + cb38;
|
||||
|
||||
cb39 = [@ab:8, @gb:8, @ab:8, @gb:8, @ab:8, @gb:8, @ab:8, @gb:8];
|
||||
cb40 = [@ab:8, @db5, @ab:8, @db5, @ab:8, @db5:8];
|
||||
cb41 = [8, @ab:8, @b:8, @h:8, @c5:8, @h:8, @b:8, 8];
|
||||
cb42 = [@ab:8, @db5, @ab:8, @db5, @ab:8, @a:8];
|
||||
cb43 = [@b:8, @a:8, @b:4d, @a:8, @b:8, @a:8];
|
||||
cb44 = [@b:8, @a:8, @b:8, @h:8, @c5:8, 8, @gb:8, @g:8];
|
||||
cb45 = [@b:8, @a:8, @b:4d, @a:8, @b:8, @h:8];
|
||||
cb46 = [@c5:8, @g:8, @e:8, @c:8, 8, @c:8, @db:8, @c:8];
|
||||
cb47 = [@db:8, @b3, @db:8, @fb:8, @db, @fb:8];
|
||||
cb48 = [@f:8, @e:8, @f:8, @gb:8, @g:8, @c, @g:8];
|
||||
cb49 = [@ab:8, @g:8, @ab:8, @a:8, @b:8, @a:8, @b:8, @h:8];
|
||||
cb50 = [@c5:8, @c5:8, 4, @c5:8, @c5:8, 4];
|
||||
cb51 = [@c5, @e5:2, @f5:8, @db5:8];
|
||||
cb52 = [@ab:8, @f:8, @fb:8, @eb:8, @d:8, 4, @gb:8];
|
||||
cb53 = [@c5:8, @c5, @gb:8, @c5:8, @c5, @h:8];
|
||||
cb54 = [@c5:8, @c5, @h:8, @c5:8, @c5, @c5:8];
|
||||
cb55 = [@db5:8, @fb:8, @db5:4d, @fb:8, @db5:8, @fb:8];
|
||||
cb56 = [@db5:8, @fb:8, @db5:8, @fb:8, @eb:8, @c5, @c5:8];
|
||||
cb57 = [@db5:8, @fb:8, @db5:8, @fb:8, @eb:8, @c5, @h3:8];
|
||||
cb58 = [@b3:8, @db:8, @gb:8, @b:8, @c:8, @e:8, @g:8, @c5:8];
|
||||
cb59 = [@db5:8, @db, @c:8, @db, 4];
|
||||
cb60 = [4, @a3, @b3, @a3, @b3, @a3, @gb3:8, @f3:8, @d3:8, 8];
|
||||
cb61 = [8, @a3, @a3, @a3, @a3, @a3, @a3:8, @a3:8, @a3];
|
||||
|
||||
CB5 = cb39 + cb40 + cb41 + cb39 + cb42 + cb43 + cb44 + cb39 + cb42 + cb45 + cb46 + cb47 + cb48 + cb49 + cb50 + cb50 + cb51 + cb52 + cb53 + cb54 + cb55 + cb56 + cb55 + cb56 + cb55 + cb57 + cb58 + cb59 + cb60 + cb60 + cb60;
|
||||
|
||||
CB = CB1 + CB2 + CB3 + (2 ^ CB4) + CB5;
|
||||
|
||||
b1 = (3 ^ [@d3, 4, @a2, 4]) + [@f3, 4, @c3, 4, @d3, 4, @a2, 4, @d3, 4, @a2, 4, @g2, 4, @g2, 4];
|
||||
b2 = [@c3, @d3, @d#3, @e3, @d3, 4, @a2, 4, @d3, 4, @a2, 4, @c3, 4, @c3, 4];
|
||||
b3 = [@f3, 4, @c3, 4, @b2, 4, @b2, 4, @f3, 4, @d3, 4, @g3, 4, @c3, 4, @f3, @e3, @d3, @c3];
|
||||
|
||||
B1 = b1 + b2 + b3;
|
||||
|
||||
b4 = (3 ^ [@d3, 4, @a2, 4]) + [@d3:4d, @g#2:4d, @a2];
|
||||
b5 = (3 ^ [@d3, 4, @a2, 4]) + [@eb3:2, @c3, @c3];
|
||||
b6 = (4 ^ [@d3, 4, @a2, 4]);
|
||||
b7 = [@b2:8, @b2:8, 4, @h2:8, @h2:8, 4, @c3:4d, @d3:8, 8, @d3:8, @d3, @g2, 4, @c3:4d, @f3:4d, @e3, @d3, @c3];
|
||||
|
||||
B2 = b4 + b5 + b6 + b7;
|
||||
|
||||
b8 = 3 ^ [@d3, @c3, @b2, @a2, @g2, @f2, @e2, @d2];
|
||||
b9 = [@d3, 4, 2, 2, 4, @a2];
|
||||
b10 = [@d3, @b2, @a2, @a2, @d3:8, 8, 4, 2];
|
||||
|
||||
B3 = b8 + b9 + b8 + b10;
|
||||
|
||||
b11 = [@c3, 4, @g2, 4, @c3, 8, @b2:4d, @g2, @f2, 4, @c3, 4, @f3, 8, @e3:4d, @d3];
|
||||
b12 = [@c3, 4, @g3, 4, @c3, 8, @b2:4d, @g2, @f2, 4, @c3, 4, @d3, 8, @f#2:4d, @a2];
|
||||
b13 = [@b2, 4, @b2, 4, @h2, 4, @h2, 4, @c3, 4, @c3, 4, @d3, 8, @d3:4d, @f#2];
|
||||
b14 = [@g2, 4, @d3, 4, @c3, 8, @c3:4d, @g3, @f3, 4, @db3, 4, @f3, @f3, @e3, @d3];
|
||||
|
||||
B4 = b11 + b12 + b13 + b14;
|
||||
|
||||
b15 = [@db3, @c3, @b2, @ab2, @gb2, @f2, @eb2, @db2, @db3, @b2, @a2, @ab2];
|
||||
b16 = [@db3, @c3, @b2, @ab2, @gb2, @f2, @eb2, @db2, @eb2, @e2, @f2, @gb2];
|
||||
b17 = [@e2, @d2, @h2, @ab2, @h2, @ab2, @f2, @eb2, @db2, @c2, @b1, @ab1];
|
||||
# ^ or B?
|
||||
b18 = [@gb2, @gb2, @gb2, @db3, @c3, @c3, @e3, @g3, @gb3, @gb3, @g3, @g3];
|
||||
b19 = [@ab3, @db3, @c3, @c3, @f3, @c3, @gb3, @gb3, @c3, 4, @c3, 4];
|
||||
b20 = [@f3, 4, @f3, 4, @c3, @c3, 4, @db3:8, @f3:8, @ab3:8, @a3:8, @b3:8, @h3:8, @c:8, 8, 8, 16, @g3:16];
|
||||
b21 = [@c3, 4, @c3, 4, @f3, 4, @f3, 4, @gb2, 4, @ab2, 4, @a2, 4, @db3, 4, @gb2, 4, @ab2, 4, @a2, 4, @db3, 4, @d, 4, @eb, 4];
|
||||
b22 = [@e3, 4, @f3, 4, @gb3, 4, @g3, 4, @db3, 4, @db3, 4];
|
||||
B5 = b15 + b16 + b17 + b18 + b19 + b20 + b21 + b22;
|
||||
|
||||
B = B1 + B2 + B3 + (2 ^ B4) + B5;
|
||||
|
||||
midi({ bpm -> 270 }, [instrument(9)] + CB.flatten(), [instrument(34)] + B.flatten());
|
||||
23
examples/per_crucem.mus
Normal file
23
examples/per_crucem.mus
Normal file
@@ -0,0 +1,23 @@
|
||||
import smnp.io;
|
||||
import smnp.audio.midi;
|
||||
import smnp.music;
|
||||
|
||||
println("Per Crucem - the canon");
|
||||
|
||||
instrument = 11;
|
||||
|
||||
d1 = [@d:2, @d:2, @c:2, @f:4d, @f:8, @f, @f, @e, @d, @e:2, @d:2];
|
||||
d2 = [@d:8, @f:8, @a:8, @d5:8, @b:8, @a:8, @g, @c:8, @e:8, @g:8, @c5:8, @a:8, @g:8, @f, @b3:8, @d:8, @f:8, @b:8, @g:8, @f:8, @e, @a, @e, @f:2];
|
||||
d3 = [@a:2, @b:2, @c5:2, @a:4d, @a:8, @b, @f, @g, @g, @a, @e, @f:2];
|
||||
d4 = [@d5:8, @c5:8, @b:8, @a:8, @g:8, @a:8, @b, @c5:8, @b:8, @a:8, @g:8, @f:8, @g:8, @a, @b:8, @a:8, @g:8, @f:8, @e:8, @f:8, @g, @a, @e, @f:2];
|
||||
d5 = [@d5:2, @d5:2, @c5:2, @c5:2, @d5:8, @c5:8, @b:8, @a:8, @b, @b, @a:2, @a:2];
|
||||
d6 = [@d:8, @d:8, @d:8, @d:8, @g:8, @g:8, @g, @c:8, @c:8, @c:8, @c:8, @f:8, @f:8, @f, @b3:8, @b3:8, @b3:8, @b3:8, @e:8, @e:8, @e, @a3, @a3, @d:2];
|
||||
|
||||
p = [1, 1, 1, 1];
|
||||
|
||||
S = d1 + d2 + d3 + d4 + d5 + d6 + d1 + d2 + d3;
|
||||
A = p + d1 + d2 + d3 + d4 + d5 + d6 + d1 + d2;
|
||||
T = p + p + d1 + d2 + d3 + d4 + d5 + d6 + d1;
|
||||
B = p + p + p + d1 + d2 + d3 + d4 + d5 + d6;
|
||||
|
||||
midi({ instrument -> instrument }, S, A, transpose(-12, T), transpose(-12, B));
|
||||
196
examples/prelude_c.midi.mus
Normal file
196
examples/prelude_c.midi.mus
Normal file
@@ -0,0 +1,196 @@
|
||||
import smnp.io;
|
||||
import smnp.collection;
|
||||
import smnp.audio.midi;
|
||||
import smnp.music;
|
||||
|
||||
println("Praeludium C Major");
|
||||
println("Acht kleine Praeludien und Fugen");
|
||||
println("by Johann Sebastian Bach");
|
||||
|
||||
instrument = 16;
|
||||
|
||||
s1 = [16, @c5:16, @h:16, @c5:16, @g:16, @c5:16, @h:16, @c5:16, @e, 4];
|
||||
s2 = [16, @c5:16, @h:16, @c5:16, @g:16, @c5:16, @h:16, @c5:16, @a:16, @f:16, @e:16, @f:16, @c:16, @f:16, @e:16, @f:16];
|
||||
s3 = [@d:16, @d5:16, @c5:16, @d5:16, @a:16, @d5:16, @c5:16, @d5:16, @h:16, @g:16, @f#:16, @g:16, @d:16, @g:16, @f#:16, @g:16];
|
||||
s4 = [@e:16, @e5:16, @d5:16, @e5:16, @h:16, @e5:16, @d5:16, @e5:16, @c5:16, @a:16, @g#:16, @a:16, @e:16, @a:16, @g#:16, @a:16];
|
||||
|
||||
s5 = flatten(2 ^ [@c5, @f#, @e, @f#], 2 ^ [@h, @g, @f#, @g]) as n ^ n.withDuration(16);
|
||||
s6 = flatten(2 ^ [@h, @e, @d, @e], 2 ^ [@a, @f#, @e, @f#]) as n ^ n.withDuration(16);
|
||||
s7 = flatten(2 ^ [@a, @d, @c, @d], 2 ^ [@g, @e, @d, @e]) as n ^ n.withDuration(16);
|
||||
s8 = flatten(2 ^ [@g, @c#, @h3, @c#], 2 ^ [@f#, @d, @c#, @d]) as n ^ n.withDuration(16);
|
||||
|
||||
s9 = [@g, @f#, @g, @d, @a, @g, @a, @d, @h, @a, @h, @d, @c5, @h, @c5, @d] as n ^ n.withDuration(16);
|
||||
s10 = [@d5:4d, @d5:8, @e5:16, @g5:16, @d5:16, @g5:16, @c5:16, @g5:16, @h:16, @g5:16];
|
||||
s11 = [@a, 8, @h:8, @c5:16, @d5:16, @h:16, @c5:16, @a:8d, @g:16];
|
||||
s12 = [@g, 4, 2];
|
||||
|
||||
S1 = s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12
|
||||
|
||||
#
|
||||
a1 = [2, 16, @c5:16, @h:16, @c5:16, @g:16, @c5:16, @h:16, @c5:16];
|
||||
a2 = [@g, 8, @c5:8, @c5, 4];
|
||||
a3 = [@a, 8, @d5:8, @d5, 4];
|
||||
a4 = [@h, 8, @e5:8, @e5, 4];
|
||||
|
||||
a5 = 8 ^ @d5:8;
|
||||
a6 = 8 ^ @c5:8;
|
||||
a7 = 8 ^ @h:8;
|
||||
a8 = 8 ^ @a:8;
|
||||
a9 = [@h, @a, @g, @a];
|
||||
a10 = [@h:16, @d5:16, @e5:16, @f#5:16, @h5:8, @g5:8, @g5:2];
|
||||
a11 = [@g5:8, @f#5:16, @e5:16, @f#5:8, @g5:8, @a5:8, @g5:8, @d5];
|
||||
a12 = [@d5, 4, 2];
|
||||
|
||||
A1 = transpose(-12, a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 + a10 + a11 + a12);
|
||||
|
||||
#
|
||||
t1 = [1];
|
||||
t2 = [@e, 8, @g:8, @a, 4];
|
||||
t3 = [@f#, 8, @a:8, @h, 4];
|
||||
t4 = [@g#, 8, @h:8, @c5, 4];
|
||||
t5 = (4 ^ @a:8) + (4 ^ @h:8);
|
||||
t6 = (4 ^ @g:8) + (4 ^ @a:8);
|
||||
t7 = (4 ^ @f#:8) + (4 ^ @g:8);
|
||||
t8 = (4 ^ @e:8) + (4 ^ @f#:8);
|
||||
t9 = [@e, @f#, @g, @f#];
|
||||
t10 = [@g, @g5:8, @h:8, @c5:8, @h:8, @a:8, @g:8];
|
||||
t11 = [@d5, 8, @d5:8, @d5:8, @d5:8, @d5];
|
||||
t12 = [@h, 4, 2];
|
||||
|
||||
T1 = transpose(-12, t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 + t12);
|
||||
|
||||
#
|
||||
b_ = 10 ^ 1;
|
||||
b11 = [2, 8, @g3, @f#3:8];
|
||||
b12 = [16, @g3:16, @f#3:16, @g3:16, @d3:16, @g3:16, @f#3:16, @g3:16, @g2, 4];
|
||||
|
||||
B1 = b_ + b11 + b12;
|
||||
|
||||
#
|
||||
p1 = [@c:1];
|
||||
p2 = [@c, 8, @e:8, @f, 4];
|
||||
p3 = [@f#, 8, @f#:8, @g, 4];
|
||||
p4 = [@g#, 8, @g#:8, @a, 4];
|
||||
p5 = (4 ^ @d:8) + (4 ^ @g:8);
|
||||
p6 = (4 ^ @c:8) + (4 ^ @f#:8);
|
||||
p7 = (4 ^ @h3:8) + (4 ^ @e:8);
|
||||
p8 = (4 ^ @a3:8) + (4 ^ @d:8);
|
||||
p9 = [@d:1];
|
||||
p10 = [@d, 4, 2];
|
||||
p11 = [4, 8, @g:8, @f#:8, @g:8, @d];
|
||||
p12 = [@g3, 4, 16, @g:16, @f:16, @g:16, @e:16, @g:16, @d:16, @g:16];
|
||||
|
||||
P1 = transpose(-12, p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10 + p11 + p12);
|
||||
|
||||
#######
|
||||
|
||||
s1 = [16, @c5:16, @h:16, @c5:16, @g:16, @c5:16, @h:16, @c5:16, @a, 4];
|
||||
s2 = [16, @h:16, @a:16, @h:16, @f:16, @h:16, @a:16, @h:16, @g#, 4];
|
||||
s3 = flatten([(2 ^ [@a, @e, @d, @e]), (2 ^ [@g#, @d, @c, @d])]) as n ^ n.withDuration(16);
|
||||
s4 = flatten([(2 ^ [@a, @e, @d, @e]), (2 ^ [@h, @g#, @f#, @g#])]) as n ^ n.withDuration(16);
|
||||
|
||||
s5 = [@c5, @h, @c5, @d5, @h, @a, @h, @c5] as n ^ n.withDuration(8);
|
||||
s6 = [@a:8, @g#:8, @a:8, @h:8, @g#:8, @e:8, @c5];
|
||||
s7 = [@h:8, @a:8, @g#:8d, @a:16, @a, 4];
|
||||
s8 = [16, @e5:16, @d5:16, @e5:16, @h:16, @e5:16, @d5:16, @e5:16, @c5, 4];
|
||||
s9 = [16, @g5:16, @f5:16, @g5:16, @d5:16, @g5:16, @f5:16, @g5:16, @e5:16, @c5:16, @h:16, @c5:16, @g:16, @c5:16, @h:16, @c5:16];
|
||||
|
||||
s10 = [@e, 4, 16, @c5:16, @h:16, @c5:16, @g:16, @c5:16, @h:16, @c5:16];
|
||||
s11 = flatten(2 ^ [@a:16, @f:16, @e:16, @f:16], [16, @d5:16, @c5:16, @d5:16, @a:16, @d5:16, @c5:16, @d5:16]);
|
||||
s12 = flatten(2 ^ [@h:16, @g:16, @f#:16, @g:16], [16, @e5:16, @d5:16, @e5:16, @h:16, @e5:16, @d5:16, @e5:16]);
|
||||
s13 = flatten(2 ^ [@c5:16, @a:16, @g#:16, @a:16], [16, @g5:16, @f5:16, @g5:16, @d5:16, @g5:16, @f5:16, @g5:16]);
|
||||
|
||||
s14 = [@e, @g, @e, @g, @f, @a, @f, @a, @d, @f, @d, @f, @e, @g, @e, @g] as n ^ n.withDuration(16).withOctave(5);
|
||||
s15 = [@c5:16, @e5:16, @c5:16, @e5:16, @d5:16, @f5:16, @d5:16, @f5:16, @h:16, @g:16, @a:16, @h:16, @c5];
|
||||
s16a = [@c5, @h, @c5, 4];
|
||||
s16b = [@c5, @h, @c5:2];
|
||||
|
||||
S2 = s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12 + s13 + s14 + s15;
|
||||
|
||||
#
|
||||
a1 = [@g, 4, @f5, 4];
|
||||
a2 = [@f, 4, @e5, 4];
|
||||
a3 = flatten(2 ^ [@c, @c5, @h, @c5], 2 ^ [@e, @e5, @d5, @e5]) as n ^ n.withDuration(16);
|
||||
a4 = flatten(2 ^ [@c, @c5, @h, @c5], 2 ^ [@e, @e5, @d5, @e5]) as n ^ n.withDuration(16);
|
||||
|
||||
a5 = [@a, @c5, @g#, @c5, @a, @c5, @f#, @d5, @g, @d5, @f#, @d5, @g, @d5, @e, @e5] as n ^ n.withDuration(16);
|
||||
a6 = [@f:16, @c5:16, @e:16, @c5:16, @f:16, @c5:16, @d:16, @h:16, @h, 8, @a5:8];
|
||||
a7 = [@f5, @e, @e, 4];
|
||||
a8 = (4 ^ @e5:8) + [@e5, 4];
|
||||
a9 = (4 ^ @d5:8) + [@c5, 4];
|
||||
|
||||
a10 = [16, @c5:16, @h:16, @c5:16, @g:16, @c5:16, @h:16, @c5:16, @c5, 8, @c5:8];
|
||||
a11 = (4 ^ @c5:8) + [@d, 8, @d:8];
|
||||
a12 = (4 ^ @d5:8) + [@e, 8, @e:8];
|
||||
a13 = (4 ^ @e5:8) + [@g5, 8, @g5:8];
|
||||
a14 = [@c, @e, @c, @e, @c, @f, @c, @f, @h3, @d, @h3, @d, @h3, @e, @h3, @e] as n ^ n.withDuration(16).withOctave(5);
|
||||
a15 = [@a:16, @c5:16, @a:16, @c5:16, @a:16, @d5:16, @a:16, @d5:16, @g:2];
|
||||
a16a = [@g:2, @c, 4];
|
||||
a16b = [@g:2, @g:2];
|
||||
|
||||
A2 = transpose(-12, a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 + a10 + a11 + a12 + a13 + a14 + a15);
|
||||
|
||||
#
|
||||
t1 = [@e, 4, 16, @f:16, @e:16, @f:16, @c:16, @f:16, @e:16, @f:16];
|
||||
t2 = [@d, 4, 16, @e:16, @d:16, @e:16, @h3:16, @e:16, @d:16, @e:16];
|
||||
t3 = [1];
|
||||
t4 = [1];
|
||||
|
||||
t5 = [1];
|
||||
t6 = [2, @e, 8, @e5:8];
|
||||
t7 = [2, 16, @a:16, @g#:16, @a:16, @e:16, @a:16, @g#:16, @a:16];
|
||||
t8 = (4 ^ @h:8) + [16, @h:16, @g#:16, @a:16, @e:16, @a:16, @g#:16, @a:16];
|
||||
t9 = (4 ^ @h:8) + [@g, 4];
|
||||
|
||||
t10 = [2, @g, 8, @g:8];
|
||||
t11 = (4 ^ @a:8) + [@a, 8, @a:8];
|
||||
t12 = (4 ^ @h:8) + [@h, 8, @h:8];
|
||||
t13 = (4 ^ @c5:8) + [@d5, 8, @d5:8];
|
||||
|
||||
t14 = [1];
|
||||
t15 = [2, @d5, 16, @e5:16, @d5:16, @c5:16];
|
||||
t16a = [@g5:4d, @f:8, @g ,4];
|
||||
t16b = [@g5:4d, @f:8, @e:2];
|
||||
|
||||
T2 = transpose(-12, t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 + t12 + t13 + t14 + t15);
|
||||
|
||||
#
|
||||
b_1 = 6 ^ 1;
|
||||
b7 = [@d5:8, @c5:8, @h, @c5, 4];
|
||||
b_2 = 8 ^ 1;
|
||||
b16a = [@d:2, @e, 4];
|
||||
b16b = [@d:2, @e:2];
|
||||
|
||||
B2 = transpose(-12, b_1 + b7 + b_2);
|
||||
|
||||
#
|
||||
p1 = [@c, 4, @f, 4];
|
||||
p2 = [@h3, 4, @e, 4];
|
||||
p3 = [@c, 4, @h3, 4];
|
||||
p4 = [@c, 4, @e, 4];
|
||||
|
||||
p5 = [@a, 4, 2];
|
||||
p6 = [2, 4, 8, @a:8];
|
||||
p7 = [@d, @e, @a3, 4];
|
||||
p8 = (4 ^ @g#3:8) + [@a3, 4];
|
||||
p9 = (4 ^ @h3:8) + [@c, 4];
|
||||
|
||||
p10 = [2, @c, 8, @e:8];
|
||||
p11 = (4 ^ @f:8) + [@f#, 8, @f#:8];
|
||||
p12 = (4 ^ @g:8) + [@g#, 8, @g#:8];
|
||||
p13 = (4 ^ @a:8) + [@h, 8, @h:8];
|
||||
|
||||
p14 = [@c5, @a, @h, @g];
|
||||
p15 = [@a, @f, @g:2];
|
||||
p16a = [@g:2, 16, @c5:16, @h:16, @c5:16, @g:16, @c5:16, @e:16, @g:16];
|
||||
p16b = [@g:2, @c:2];
|
||||
|
||||
P2 = transpose(-12, p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10 + p11 + p12 + p13 + p14 + p15);
|
||||
|
||||
midi({ bpm -> 100, instrument -> instrument },
|
||||
S1 + S1 + S2 + s16a + S2 + s16b,
|
||||
A1 + A1 + A2 + a16a + A2 + a16b,
|
||||
T1 + T1 + T2 + t16a + T2 + t16b,
|
||||
B1 + B1 + B2 + b16a + B2 + b16b,
|
||||
P1 + P1 + P2 + p16a + P2 + p16b
|
||||
);
|
||||
203
examples/prelude_c.synth.mus
Normal file
203
examples/prelude_c.synth.mus
Normal file
@@ -0,0 +1,203 @@
|
||||
import smnp.io;
|
||||
import smnp.music;
|
||||
import smnp.audio.synth;
|
||||
import smnp.collection;
|
||||
|
||||
println("Praeludium C Major");
|
||||
println("Acht kleine Praeludien und Fugen");
|
||||
println("by Johann Sebastian Bach");
|
||||
|
||||
config = {
|
||||
overtones -> flatten([0.5, 0.3, 5^0.0, 0.1, 3^0.0, 0.05, 0.0, 0.03, 0.0, 0.0, 0.01, 5^0.0, 0.005, 3^0.0, 0.002, 0.0, 0.001]),
|
||||
decay -> 2,
|
||||
attack -> 0,
|
||||
tuning -> 432
|
||||
};
|
||||
|
||||
s1 = [16, @c5:16, @h:16, @c5:16, @g:16, @c5:16, @h:16, @c5:16, @e, 4];
|
||||
s2 = [16, @c5:16, @h:16, @c5:16, @g:16, @c5:16, @h:16, @c5:16, @a:16, @f:16, @e:16, @f:16, @c:16, @f:16, @e:16, @f:16];
|
||||
s3 = [@d:16, @d5:16, @c5:16, @d5:16, @a:16, @d5:16, @c5:16, @d5:16, @h:16, @g:16, @f#:16, @g:16, @d:16, @g:16, @f#:16, @g:16];
|
||||
s4 = [@e:16, @e5:16, @d5:16, @e5:16, @h:16, @e5:16, @d5:16, @e5:16, @c5:16, @a:16, @g#:16, @a:16, @e:16, @a:16, @g#:16, @a:16];
|
||||
|
||||
s5 = flatten(2 ^ [@c5, @f#, @e, @f#], 2 ^ [@h, @g, @f#, @g]) as n ^ n.withDuration(16);
|
||||
s6 = flatten(2 ^ [@h, @e, @d, @e], 2 ^ [@a, @f#, @e, @f#]) as n ^ n.withDuration(16);
|
||||
s7 = flatten(2 ^ [@a, @d, @c, @d], 2 ^ [@g, @e, @d, @e]) as n ^ n.withDuration(16);
|
||||
s8 = flatten(2 ^ [@g, @c#, @h3, @c#], 2 ^ [@f#, @d, @c#, @d]) as n ^ n.withDuration(16);
|
||||
|
||||
s9 = [@g, @f#, @g, @d, @a, @g, @a, @d, @h, @a, @h, @d, @c5, @h, @c5, @d] as n ^ n.withDuration(16);
|
||||
s10 = [@d5:4d, @d5:8, @e5:16, @g5:16, @d5:16, @g5:16, @c5:16, @g5:16, @h:16, @g5:16];
|
||||
s11 = [@a, 8, @h:8, @c5:16, @d5:16, @h:16, @c5:16, @a:8d, @g:16];
|
||||
s12 = [@g, 4, 2];
|
||||
|
||||
S1 = s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12
|
||||
|
||||
#
|
||||
a1 = [2, 16, @c5:16, @h:16, @c5:16, @g:16, @c5:16, @h:16, @c5:16];
|
||||
a2 = [@g, 8, @c5:8, @c5, 4];
|
||||
a3 = [@a, 8, @d5:8, @d5, 4];
|
||||
a4 = [@h, 8, @e5:8, @e5, 4];
|
||||
|
||||
a5 = 8 ^ @d5:8;
|
||||
a6 = 8 ^ @c5:8;
|
||||
a7 = 8 ^ @h:8;
|
||||
a8 = 8 ^ @a:8;
|
||||
a9 = [@h, @a, @g, @a];
|
||||
a10 = [@h:16, @d5:16, @e5:16, @f#5:16, @h5:8, @g5:8, @g5:2];
|
||||
a11 = [@g5:8, @f#5:16, @e5:16, @f#5:8, @g5:8, @a5:8, @g5:8, @d5];
|
||||
a12 = [@d5, 4, 2];
|
||||
|
||||
A1 = transpose(-12, a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 + a10 + a11 + a12);
|
||||
|
||||
#
|
||||
t1 = [1];
|
||||
t2 = [@e, 8, @g:8, @a, 4];
|
||||
t3 = [@f#, 8, @a:8, @h, 4];
|
||||
t4 = [@g#, 8, @h:8, @c5, 4];
|
||||
t5 = (4 ^ @a:8) + (4 ^ @h:8);
|
||||
t6 = (4 ^ @g:8) + (4 ^ @a:8);
|
||||
t7 = (4 ^ @f#:8) + (4 ^ @g:8);
|
||||
t8 = (4 ^ @e:8) + (4 ^ @f#:8);
|
||||
t9 = [@e, @f#, @g, @f#];
|
||||
t10 = [@g, @g5:8, @h:8, @c5:8, @h:8, @a:8, @g:8];
|
||||
t11 = [@d5, 8, @d5:8, @d5:8, @d5:8, @d5];
|
||||
t12 = [@h, 4, 2];
|
||||
|
||||
T1 = transpose(-12, t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 + t12);
|
||||
|
||||
#
|
||||
b_ = 10 ^ 1;
|
||||
b11 = [2, 8, @g3, @f#3:8];
|
||||
b12 = [16, @g3:16, @f#3:16, @g3:16, @d3:16, @g3:16, @f#3:16, @g3:16, @g2, 4];
|
||||
|
||||
B1 = b_ + b11 + b12;
|
||||
|
||||
#
|
||||
p1 = [@c:1];
|
||||
p2 = [@c, 8, @e:8, @f, 4];
|
||||
p3 = [@f#, 8, @f#:8, @g, 4];
|
||||
p4 = [@g#, 8, @g#:8, @a, 4];
|
||||
p5 = (4 ^ @d:8) + (4 ^ @g:8);
|
||||
p6 = (4 ^ @c:8) + (4 ^ @f#:8);
|
||||
p7 = (4 ^ @h3:8) + (4 ^ @e:8);
|
||||
p8 = (4 ^ @a3:8) + (4 ^ @d:8);
|
||||
p9 = [@d:1];
|
||||
p10 = [@d, 4, 2];
|
||||
p11 = [4, 8, @g:8, @f#:8, @g:8, @d];
|
||||
p12 = [@g3, 4, 16, @g:16, @f:16, @g:16, @e:16, @g:16, @d:16, @g:16];
|
||||
|
||||
P1 = transpose(-12, p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10 + p11 + p12);
|
||||
|
||||
PART1 = wave(S1, A1, T1, B1, P1);
|
||||
|
||||
#######
|
||||
|
||||
s1 = [16, @c5:16, @h:16, @c5:16, @g:16, @c5:16, @h:16, @c5:16, @a, 4];
|
||||
s2 = [16, @h:16, @a:16, @h:16, @f:16, @h:16, @a:16, @h:16, @g#, 4];
|
||||
s3 = flatten([2 ^ [@a, @e, @d, @e], 2 ^ [@g#, @d, @c, @d]]) as n ^ n.withDuration(16);
|
||||
s4 = flatten([2 ^ [@a, @e, @d, @e], 2 ^ [@h, @g#, @f#, @g#]]) as n ^ n.withDuration(16);
|
||||
|
||||
s5 = [@c5, @h, @c5, @d5, @h, @a, @h, @c5] as n ^ n.withDuration(8);
|
||||
s6 = [@a:8, @g#:8, @a:8, @h:8, @g#:8, @e:8, @c5];
|
||||
s7 = [@h:8, @a:8, @g#:8d, @a:16, @a, 4];
|
||||
s8 = [16, @e5:16, @d5:16, @e5:16, @h:16, @e5:16, @d5:16, @e5:16, @c5, 4];
|
||||
s9 = [16, @g5:16, @f5:16, @g5:16, @d5:16, @g5:16, @f5:16, @g5:16, @e5:16, @c5:16, @h:16, @c5:16, @g:16, @c5:16, @h:16, @c5:16];
|
||||
|
||||
s10 = [@e, 4, 16, @c5:16, @h:16, @c5:16, @g:16, @c5:16, @h:16, @c5:16];
|
||||
s11 = flatten(2 ^ [@a:16, @f:16, @e:16, @f:16], [16, @d5:16, @c5:16, @d5:16, @a:16, @d5:16, @c5:16, @d5:16]);
|
||||
s12 = flatten(2 ^ [@h:16, @g:16, @f#:16, @g:16], [16, @e5:16, @d5:16, @e5:16, @h:16, @e5:16, @d5:16, @e5:16]);
|
||||
s13 = flatten(2 ^ [@c5:16, @a:16, @g#:16, @a:16], [16, @g5:16, @f5:16, @g5:16, @d5:16, @g5:16, @f5:16, @g5:16]);
|
||||
|
||||
s14 = [@e, @g, @e, @g, @f, @a, @f, @a, @d, @f, @d, @f, @e, @g, @e, @g] as n ^ n.withDuration(16).withOctave(5);
|
||||
s15 = [@c5:16, @e5:16, @c5:16, @e5:16, @d5:16, @f5:16, @d5:16, @f5:16, @h:16, @g:16, @a:16, @h:16, @c5];
|
||||
s16a = [@c5, @h, @c5, 4];
|
||||
s16b = [@c5, @h, @c5:2];
|
||||
|
||||
S2 = s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12 + s13 + s14 + s15;
|
||||
|
||||
#
|
||||
a1 = [@g, 4, @f5, 4];
|
||||
a2 = [@f, 4, @e5, 4];
|
||||
a3 = flatten(2 ^ [@c, @c5, @h, @c5], 2 ^ [@e, @e5, @d5, @e5]) as n ^ n.withDuration(16);
|
||||
a4 = flatten(2 ^ [@c, @c5, @h, @c5], 2 ^ [@e, @e5, @d5, @e5]) as n ^ n.withDuration(16);
|
||||
|
||||
a5 = [@a, @c5, @g#, @c5, @a, @c5, @f#, @d5, @g, @d5, @f#, @d5, @g, @d5, @e, @e5] as n ^ n.withDuration(16);
|
||||
a6 = [@f:16, @c5:16, @e:16, @c5:16, @f:16, @c5:16, @d:16, @h:16, @h, 8, @a5:8];
|
||||
a7 = [@f5, @e, @e, 4];
|
||||
a8 = (4 ^ @e5:8) + [@e5, 4];
|
||||
a9 = (4 ^ @d5:8) + [@c5, 4];
|
||||
|
||||
a10 = [16, @c5:16, @h:16, @c5:16, @g:16, @c5:16, @h:16, @c5:16, @c5, 8, @c5:8];
|
||||
a11 = (4 ^ @c5:8) + [@d, 8, @d:8];
|
||||
a12 = (4 ^ @d5:8) + [@e, 8, @e:8];
|
||||
a13 = (4 ^ @e5:8) + [@g5, 8, @g5:8];
|
||||
a14 = [@c, @e, @c, @e, @c, @f, @c, @f, @h3, @d, @h3, @d, @h3, @e, @h3, @e] as n ^ n.withDuration(16).withOctave(5);
|
||||
a15 = [@a:16, @c5:16, @a:16, @c5:16, @a:16, @d5:16, @a:16, @d5:16, @g:2];
|
||||
a16a = [@g:2, @c, 4];
|
||||
a16b = [@g:2, @g:2];
|
||||
|
||||
A2 = transpose(-12, a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 + a10 + a11 + a12 + a13 + a14 + a15);
|
||||
|
||||
#
|
||||
t1 = [@e, 4, 16, @f:16, @e:16, @f:16, @c:16, @f:16, @e:16, @f:16];
|
||||
t2 = [@d, 4, 16, @e:16, @d:16, @e:16, @h3:16, @e:16, @d:16, @e:16];
|
||||
t3 = [1];
|
||||
t4 = [1];
|
||||
|
||||
t5 = [1];
|
||||
t6 = [2, @e, 8, @e5:8];
|
||||
t7 = [2, 16, @a:16, @g#:16, @a:16, @e:16, @a:16, @g#:16, @a:16];
|
||||
t8 = (4 ^ @h:8) + [16, @h:16, @g#:16, @a:16, @e:16, @a:16, @g#:16, @a:16];
|
||||
t9 = (4 ^ @h:8) + [@g, 4];
|
||||
|
||||
t10 = [2, @g, 8, @g:8];
|
||||
t11 = (4 ^ @a:8) + [@a, 8, @a:8];
|
||||
t12 = (4 ^ @h:8) + [@h, 8, @h:8];
|
||||
t13 = (4 ^ @c5:8) + [@d5, 8, @d5:8];
|
||||
|
||||
t14 = [1];
|
||||
t15 = [2, @d5, 16, @e5:16, @d5:16, @c5:16];
|
||||
t16a = [@g5:4d, @f:8, @g ,4];
|
||||
t16b = [@g5:4d, @f:8, @e:2];
|
||||
|
||||
T2 = transpose(-12, t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 + t12 + t13 + t14 + t15);
|
||||
|
||||
#
|
||||
b_1 = 6 ^ 1;
|
||||
b7 = [@d5:8, @c5:8, @h, @c5, 4];
|
||||
b_2 = 8 ^ 1;
|
||||
b16a = [@d:2, @e, 4];
|
||||
b16b = [@d:2, @e:2];
|
||||
|
||||
B2 = transpose(-12, b_1 + b7 + b_2);
|
||||
|
||||
#
|
||||
p1 = [@c, 4, @f, 4];
|
||||
p2 = [@h3, 4, @e, 4];
|
||||
p3 = [@c, 4, @h3, 4];
|
||||
p4 = [@c, 4, @e, 4];
|
||||
|
||||
p5 = [@a, 4, 2];
|
||||
p6 = [2, 4, 8, @a:8];
|
||||
p7 = [@d, @e, @a3, 4];
|
||||
p8 = (4 ^ @g#3:8) + [@a3, 4];
|
||||
p9 = (4 ^ @h3:8) + [@c, 4];
|
||||
|
||||
p10 = [2, @c, 8, @e:8];
|
||||
p11 = (4 ^ @f:8) + [@f#, 8, @f#:8];
|
||||
p12 = (4 ^ @g:8) + [@g#, 8, @g#:8];
|
||||
p13 = (4 ^ @a:8) + [@h, 8, @h:8];
|
||||
|
||||
p14 = [@c5, @a, @h, @g];
|
||||
p15 = [@a, @f, @g:2];
|
||||
p16a = [@g:2, 16, @c5:16, @h:16, @c5:16, @g:16, @c5:16, @e:16, @g:16];
|
||||
p16b = [@g:2, @c:2];
|
||||
|
||||
P2 = transpose(-12, p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10 + p11 + p12 + p13 + p14 + p15);
|
||||
|
||||
PART2 = wave(S2, A2, T2, B2, P2);
|
||||
PART2a = PART2 + wave(s16a, a16a, t16a, b16a, p16a);
|
||||
PART2b = PART2 + wave(s16b, a16b, t16b, b16b, p16b);
|
||||
|
||||
MUSIC = PART1 + PART1 + PART2a + PART2b;
|
||||
|
||||
synth(MUSIC);
|
||||
17
examples/przasniczka.mus
Executable file
17
examples/przasniczka.mus
Executable file
@@ -0,0 +1,17 @@
|
||||
import smnp.io;
|
||||
import smnp.audio.synth;
|
||||
|
||||
println("Prząśniczka");
|
||||
println("by S. Moniuszko");
|
||||
|
||||
S = $ 4/4 @a:4d @a:8 @c5 @d5 | @e5:2 @a @a | @f5:2 @e5 @d5 | @e5:2d @e5 |
|
||||
@e5:4d @h:8 @e5 @h | @c5:2 @a @c5 | @e5:2 @h @h | @c5:2d @e5 |
|
||||
@g5:4d @f5:8 @e5:4d @d5:8 | @c5:2d @c5 | @d5:4d @d5:8 @h @g | @e5:2d 4 |
|
||||
@e5:4d @f5:8 @e5:4d @d#5:8 | @e5:2 @a5:2 | @f5:4d @d5:8 @h @e5 | @a:2d 4 ||;
|
||||
|
||||
A = $ 4/4 1 | @a:2 2 | @a:2 2 | @a:2d 4 |
|
||||
@g#:4d @g#:8 @g# @g# | @a:2 2 | @g#:2 @g# @g# | @a:2d 4 |
|
||||
1 | 1 | @h:4d @h:8 @g 4 | @c5:2d 4 |
|
||||
1 | 1 | 1 | 1 ||;
|
||||
|
||||
synth({ bpm -> 284 }, S, A);
|
||||
29
examples/quem_pastores.mus
Normal file
29
examples/quem_pastores.mus
Normal file
@@ -0,0 +1,29 @@
|
||||
import smnp.io;
|
||||
import smnp.audio.midi;
|
||||
import smnp.music;
|
||||
|
||||
println("Narodził się nam Zbawiciel / Quem pastores laudavere");
|
||||
|
||||
instrument = 7;
|
||||
|
||||
S = $ 3/4 @f:2 @a | @c5:2 @a | @c5:2 @d5 | @c5 @g:2 |
|
||||
@a:2 @c5 | @b:2 @g | @f:2 @d | @e @c:2 |
|
||||
@a:2 @b | @c5:2 @d5 | @c5:2 @g | @a @f:2 |
|
||||
@b:2 @b | @a @g @a | @f @d @e | @f:2d ||;
|
||||
|
||||
A = $ 3/4 @c:2 @f | @g:2 @f | @f @g @f | @f @f @e |
|
||||
@f @e @eb | @d:2 @c | @d:2 @d | @c @c @b3 |
|
||||
@c:2 @c | @f @d @g | @g:2 @e | @e @d:2 |
|
||||
@f:2 @f | @f @e @f | @c:2 @c | @c:2d ||;
|
||||
|
||||
T = transpose(-12, $ 3/4 @a @b @c5 | @c5 @b @c5 | @a:2 @b | @a @c5:2 |
|
||||
@c5:2 @a | @b:2 @c5 | @d5 @c @b | @g @g:2 |
|
||||
@f @a @g | @a:2 @b | @b:2 @g | @g @a:2 |
|
||||
@d5 @db5 @db5 | @c5 @b @a | @g:2 @b | @a:2d ||);
|
||||
|
||||
B = transpose(-12, $ 3/4 @f:2 @f | @e:2 @f | @f:2 @f | @c @c:2 |
|
||||
@f:2 @f# | @g @f @e | @d @f @g | @c @e:2 |
|
||||
@f:2 @e | @f @f# @g | @e @d @c | @c# @d @c |
|
||||
@b3:2 @b | @c:2 @c | @c:2 @c | @f:2d ||);
|
||||
|
||||
midi({ bpm -> 150, instrument -> instrument }, S, A, T, B);
|
||||
89
examples/stabat_mater_fugue.mus
Executable file
89
examples/stabat_mater_fugue.mus
Executable file
@@ -0,0 +1,89 @@
|
||||
import smnp.audio.midi;
|
||||
import smnp.music;
|
||||
import smnp.collection;
|
||||
import smnp.io;
|
||||
|
||||
|
||||
println("Stabat Mater :: Fugue");
|
||||
println("by Jos. Rheinberger");
|
||||
|
||||
# 19 - 20
|
||||
S = (12 ^ [2, 4]) +
|
||||
# 21
|
||||
$ 3/4 4 4 @g:8d @g:16 | @b:4d @a:8 @b:8 @c5:8 | @a @f @f5:8d @f5:16 | @e5:8d @a:16 @a @d5 | 0/4 @c5 @f @eb5 + 8 @d5:8 @f5:8 @eb5:8 @d5:8 @c5:8 |
|
||||
3/4 @h @c5:4d @b:8 | 0/4 @a:8 @g:8 @f @f5 + 8 @eb5:8 @d5:8 @c5:8 @b:8 @c5:8 |
|
||||
# 22
|
||||
@d5:4d @a:8 @b + 4 + 8 @f:8 @g + 8 @b:8 @eb5:8 @d5:8 @f5:8 @eb5:8 | 3/4 @d5 @d5:8 @c5:8 @b:8 @a:8 | @g @eb5:8 @d5:8 @c5:8 @b:8 | # 10/22
|
||||
@a @c5:8 @b:8 @a:8 @g:8 | @f# @d5:8 @c5:8 @b:8 @a:8 | 0/4 @g @eb5:2 + 8 @a:8 @d5:8 @c5:8 @b:8 @a:8 | 3/4 @b @g5 @c#5 |
|
||||
# 23
|
||||
@d5:2 4 | 2 4 | 4 @d5 @d5 | @eb5:4d @d5:8 @eb5:8 @f5:8 |
|
||||
0/4 @d5 @b @g5 + 4 @f5 @eb5 + 4 @d5 @c5 + 4 + 8 @h:8 @c5:8 @d5:8 | 3/4 @eb5 @eb5 @eb5 |
|
||||
# 24
|
||||
@eb5:2 @d5 | @f5:4d @eb5:8 @d5:8 @c5:8 | 0/4 @b @a @g + 4 | @f#:8 @e:8 @f# | 3/4 @g @g5 @f5 |
|
||||
@eb5:2 @d5 | @c5:2 @h | @c5:2 @d5 | 0/4 @eb5:2d + 4 @d5 @c5 | @d5:1d ||;
|
||||
|
||||
|
||||
# 19 - 20
|
||||
A = (8 ^ [2, 4]) +
|
||||
# 20
|
||||
$ 3/4 4 4 @d:8d @d:16 |
|
||||
@eb:4d @d:8 @eb:8 @f:8 | @d @b3 @b:8d @b:16 | @a:8d @d:16 @d @g | @f @b3 @eb:8d @eb:16 |
|
||||
# 21
|
||||
0/4 @e:8 @d:8 @e:8 @f:8 @g + 8 @e:8 @f:8 @g:8 @a | @g @f @b + 8 @g:8 @a:8 @b:8 @c5 |
|
||||
3/4 @b @f @ab | @g @c:8 @d:8 @eb | @f:2 @f | @f:2d |
|
||||
# 22
|
||||
@f#:4d @f#:8 @g:8 @f:8 | @eb:8 @d:8 @c:8 @d:8 @eb:8 @f:8 | @g:2d | @f# 4 4 | 2 4 |
|
||||
2 4 | 4 4 @f#:8d @f#:16 | @g:4d @f#:8 @g:8 @a:8 | @f# @d @d:8 @a:8 | 0/4 @g:8 @a:8 @b @a + 8 @g:8 @f# 4 |
|
||||
# 23
|
||||
2 4 | 4 4 @b + 4 @a @c5 + 8 @b:8 @d5:8 @c5:8 @b |
|
||||
3/4 @a:2 @g | @f:2 @eb | @d:8d @d:16 @g @f | @eb:2 4 |
|
||||
# 24
|
||||
4 @f# @g | @ab:4d @g:8 @f:8 @eb:8 | @d:2 @d | @a3:2 @d | @d:2 4 |
|
||||
4 @g @f | @eb:2 @d | @g:2 @ab | @g:2 @g | @g:2 @g | 0/4 @g:1d ||;
|
||||
|
||||
|
||||
# 19
|
||||
T = (4 ^ [2, 4]) +
|
||||
$ 3/4 4 4 @g:8d @g:16 |
|
||||
# 20
|
||||
@b:4d @a:8 @b:8 @c5:8 | @a @f @f5:8d @f5:16 | @e5:8d @a:16 @a @d5 | 0/4 @c5 @f @b + 8 @g:8 @a:8 @b:8 @c5 + 8 @a:8 @b:8 @c5:8 @d5 |
|
||||
3/4 @c5 @b @eb5 | @d5 @b:4d @b:8 |
|
||||
# 21
|
||||
0/4 @c5:2d + 4 @c5 8 @h:8 | 3/4 @c5:8 @c#5:8 @d5:8 @c#5:8 @d5:8 @e5:8 | @f5:2 + 8 @a:8 |
|
||||
0/4 @b @d5 @f + 8 @g:8 @eb @c5 + 4 @a:4d @a:8 | 3/4 @b @b:8 @c5:8 @d5:8 @eb5:8 |
|
||||
# 22
|
||||
@c5:4d @d5:8 @b | @ab:2 @g:8 @b:8 | @eb5:2 @c5 | @a 4 @d5:8 @c5:8 | @b:8 @a:8 @g @eb5:8 @d5:8 |
|
||||
@c5:8 @b:8 @a @c5:8 @b:8 | @a:8 @g:8 @f# @d5:8 @c5:8 | @b:8 @a:8 @g @c5 | @a @f# @d5:8 @c5:8 | @b:8 @c5:8 @d5 @e5 |
|
||||
# 23
|
||||
@a @d5 @d5 | @eb5:4d @d5:8 @eb5:8 @f5:8 | @d5 @b @g:8d @g:16 | @c5:4d @b:8 @c5:8 @d5:8 |
|
||||
0/4 @b @f5:8 @eb5:8 @d5 + 4 @d5 @b + 4 @b @g + 8 + 16 @g:16 @g @a:8 @h:8 | 3/4 @c5 @c5 @c5 |
|
||||
# 24
|
||||
@c5:2 @d5 | @d5 @eb5 @g | @g @f#:8 @g:8 @a:8 @b:8 | @c5 @d5 @c5 | @h:2 4 |
|
||||
2 4 | 4 @g5 @f5 | @eb5:2 @h | 0/4 @c5:2d + 4 @h @c5 | @h:1d ||;
|
||||
|
||||
|
||||
# 19
|
||||
B = $ 3/4 4 4 @d:8d @d:16 | @eb:4d @d:8 @eb:8 @f:8 | @d @b3 @b:8d @b:16 | @a:8d @d:16 @d @g | @f @b3 @eb:8d @eb:16 |
|
||||
# 20
|
||||
@d:8d @d:16 @g @e | 0/4 @f 4 @d5 + 4 @c5 @b + 4 @a @g:8d @g:16 |
|
||||
3/4 @c @f @a3 | @b3 @g 8 @e:8 | @f:8 @f#:8 @g:8 @f#:8 @g:8 @a:8 | @b:8 @a:8 @g:8 @f:8 @eb:8 @db:8 |
|
||||
# 21
|
||||
@c @g @e | @f:8d @f:16 @a 4 | 2 4 | 2 4 |
|
||||
2 4 | 4 4 @c:8d @c:16 | @eb:4d @d:8 @eb:8 @f:8 | @d @b3 @b:8d @b:16 |
|
||||
# 22
|
||||
@a:8d @d:16 @d @g | 0/4 @f @b3 @eb + 8 @d:8 @c @c | @d:8d @d:16 @d:2 + 4 4 4 |
|
||||
3/4 2 4 | 2 4 | 2 4 | 4 4 @f#:8d @f#:16 | @g:4d @f#:8 @g:8 @a:8 |
|
||||
# 23
|
||||
@f# @d 4 | 4 @c5 @a | @b:8 @a:8 @g:8 @f:8 @eb:8 @d:8 | @c @f @a3 |
|
||||
@b3 4 @b:8 @c5:8 | @d5:8 @d:8 @eb:8 @f:8 @g:8 @a:8 | @b:8 @b3:8 @c:8 @d:8 @eb:8 @f:8 | @g:8 @f#:8 @g:8 @f:8 @eb:8 @d:8 | @c:2 4 |
|
||||
# 24
|
||||
4 @a @b | @h @c5 @c | 0/4 @d:2d + 2 @d | 3/4 @g3:2 4 |
|
||||
2 4 | 2 4 | 4 @g @f | @eb @c @eb | @g:2 @c | 0/4 @g3:1d ||;
|
||||
|
||||
|
||||
S = S.flatten();
|
||||
A = A.flatten();
|
||||
T = transpose(-12, T.flatten());
|
||||
B = transpose(-24, B.flatten());
|
||||
|
||||
midi({ bpm -> 100 }, S, A, T, B);
|
||||
Reference in New Issue
Block a user