Back to "random and silly" pages

## Composing with Mathematica

Mathematica Notebook
And here is it as text.
```s = Sound[{"Flute", SoundNote[{1, 3, 5, 8}, {0, 1}]}]
```
```A = Table[SoundNote[k, 0.1], {k, 12}];
s = Sound[{"Guitar", A}]
```
```A = Table[u = Mod[Fibonacci[k], 40] - 30;
u + {RandomChoice[{3, 5}], RandomChoice[{5, 8}]}, {k, 10}];
s = Sound[{"Bird", Map[SoundNote, A]}, {0, 8}]
```
```f = {1, 1, 3, 3, 5, 5, 1, 1, 1, 1, 3, 3, 5, 5, 1, 1, 5, 5, 6, 6, 8, 8,
8, 8, 5, 5, 6, 6, 8, 8, 8, 8, 8, 10, 8, 6, 5, 5, 1, 1, 8, 10, 8,
6, 5, 5, 1, 1, 3, 3, -4, -4, 1, 1, 1, 1};
A = Map[SoundNote, f];
s1 = Sound[{"Piano",              A},     {0, 24}];
s2 = Sound[{"Flute",  RotateRight[A, 8]}, {0, 24}];
s3 = Sound[{"Guitar", RotateRight[A, 16]},{0, 24}];
s = Sound[{s1, s2, s3}, {0, 12}]
```
```Sound[Table[
SoundNote[{k, k + 5, k + 8}, 0.1 {k, k + 1}, k,
SoundVolume -> Random[]], {k, 15}],7]
```
```n = 40;
T[x_] := x + RandomChoice[{-1, 0, 1}]; t = NestList[T, 0, n];
a1 = Table[
SoundNote[{t[[k]], 5 + t[[k]]}, {k, k + 1}, "Piano",
SoundVolume -> Sin[k/3]], {k, n}];
a2 = Table[
SoundNote[{12 + t[[k]], 17 + t[[k]]}, {k, k + 1}, "Flute",
SoundVolume -> Sin[k/2]], {k, n}];
Sound[Union[a1, a2], {0, 6}]
```
```A1 = Table[{k, k + 2 + RandomChoice[{1, 2}]}, {k, -40, 40}];
A2 = Table[{k, k + 2 + RandomChoice[{1, 2}]}, {k, 40, -40, -1}];
s1 = Sound[{"Flute", Map[SoundNote, A1]}, {0, 1}];
s2 = Sound[{"Flute", Map[SoundNote, A2]}, {0, 1}];
Sound[{s1, s2}, {0, 8}]
```
```A = Table[RandomChoice[Range[80] - 40], {30}, {6}]; Clear[f];
f[x_] := SoundNote[x, RandomChoice[{1, 2}]];
Sound[{"Piano", Map[f, A]}, {0, 6}]
```
```p = 3 RealDigits[Pi - 3, 10, 40][[1]];
A = Table[{p[[k]], p[[k + 1]], p[[k + 2]]}, {k, Length[p] - 2}];
s = Sound[{"Viola", Map[SoundNote, A]}, {0, 6}]
```
```n = 30; A = Table[Mod[k^2, 80] - 40, {k, n}];
L = Table[Sin[k Sqrt[2]], {k, n}];
V = Table[Random[], {k, n}];
f[k_] := SoundNote[A[[k]], L[[k]], SoundVolume -> V[[k]]];
g[k_] := SoundNote[{A[[k]], A[[k]] + 5}, L[[k]],
SoundVolume -> V[[k]]];
s1 = Sound[{"Flute", Table[f[k], {k, n}]}, {0, 2}];
s2 = Sound[{"Piano", Table[g[k], {k, n}]}, {0, 2}];
Sound[{s1, s2}]
```