-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
96 lines (93 loc) · 2.94 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
rest = 14000;
in
with import ./sine.nix { inherit pkgs; lib = nixpkgs.lib; };
with frequencies;
with chords;
{
packages = rec {
melody = sequence [
(sine g3 1.0 50.0)
(sine a3 1.0 50.0)
(sine c4 1.0 50.0)
(sine a3 1.0 50.0)
(sine e4 2.0 50.0)
(sine rest 1.0 0.0)
(sine e4 2.0 50.0)
(sine rest 1.0 0.0)
(sine d4 2.0 50.0)
(sine rest 4.0 0.0)
(sine g3 1.0 50.0)
(sine a3 1.0 50.0)
(sine c4 1.0 50.0)
(sine a3 1.0 50.0)
(sine d4 2.0 50.0)
(sine rest 1.0 0.0)
(sine d4 2.0 50.0)
(sine rest 1.0 0.0)
(sine c4 2.0 50.0)
(sine rest 4.0 0.0)
(sine g3 1.0 50.0)
(sine a3 1.0 50.0)
(sine c4 1.0 50.0)
(sine a3 1.0 50.0)
(sine c4 2.0 50.0)
(sine rest 1.0 0.0)
(sine d4 2.0 50.0)
(sine rest 1.0 0.0)
(sine b3 2.0 50.0)
(sine rest 7.0 0.0)
(sine g3 1.0 50.0)
(sine d4 2.0 50.0)
(sine c4 2.0 50.0)
];
bass = sequence [
(square rest 4.0 0.0)
(cMajor 2.0 100.0)
(square rest 1.0 0.0)
(cMajor 2.0 100.0)
(square rest 1.0 0.0)
(gMajor 2.0 100.0)
(square rest 4.0 0.0)
(gMajor 4.0 100.0)
(gMajor 2.0 100.0)
(square rest 1.0 0.0)
(gMajor 2.0 100.0)
(square rest 1.0 0.0)
(aMinor 2.0 100.0)
(square rest 4.0 0.0)
(aMinor 3.0 100.0)
(square rest 1.0 0.0)
(aMinor 2.0 100.0)
(square rest 1.0 0.0)
(aMinor 2.0 100.0)
(square rest 1.0 0.0)
(gMajor 2.0 100.0)
(square rest 7.0 0.0)
(gMajor 1.0 100.0)
(gMajor 2.0 100.0)
(cMajor 2.0 100.0)
];
song = overlay [ melody bass ];
default =
pkgs.runCommand "garnix-music"
{
meta.mainProgram = "song";
nativeBuildInputs = [ pkgs.sox ];
} ''
mkdir -p $out/bin
echo "#!${pkgs.bash}/bin/bash" >> $out/bin/song
echo ${pkgs.sox}/bin/play ${song} >> $out/bin/song
chmod +x $out/bin/song
'';
};
formatter = pkgs.nixpkgs-fmt;
}
);
}