-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
291 lines (226 loc) · 11.8 KB
/
Makefile
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# Makefile
export PICO_EXTRAS_PATH ?= $(CURDIR)/pico-extras
export PICO_SDK_PATH ?= $(CURDIR)/pico-sdk
NPROCS := $(shell grep -c 'processor' /proc/cpuinfo)
GOVERSION = go1.21.13
GOBIN = $(HOME)/go/bin
GOINSTALLPATH = $(GOBIN)/$(GOVERSION)
dobuild: pico-extras lib/fuzz.h lib/transfer_saturate2.h lib/sinewaves2.h lib/crossfade4.h lib/resonantfilter_data.h lib/cuedsounds.h build
make -C build -j$(NPROCS)
chowdsp:
sudo apt install -y lv2file
wget https://github.com/jatinchowdhury18/AnalogTapeModel/releases/download/v2.11.4/ChowTapeModel-Linux-x64-2.11.4.deb
sudo dpkg --install ChowTapeModel-Linux-x64-2.11.4.deb
install_go21:
@if [ -x "$(GOINSTALLPATH)" ]; then \
echo "$(GOVERSION) is already installed."; \
exit 0; \
else \
echo "$(GOVERSION) is not installed."; \
go install golang.org/dl/$(GOVERSION)@latest; \
$(GOINSTALLPATH) download; \
fi
zeptoboard: copyboard pico-extras lib/fuzz.h lib/transfer_saturate2.h lib/sinewaves2.h lib/crossfade4.h lib/resonantfilter_data.h lib/cuedsounds.h build
make -C build -j$(NPROCS)
mv build/_core.uf2 zeptoboard.uf2
zeptocore: copyzepto pico-extras lib/fuzz.h lib/transfer_saturate2.h lib/sinewaves2.h lib/crossfade4.h lib/resonantfilter_data.h lib/cuedsounds.h build
cp zeptocore_compile_definitions.cmake target_compile_definitions.cmake
make -C build -j$(NPROCS)
mv build/_core.uf2 zeptocore.uf2
zeptocore_nooverclock: copyzepto pico-extras lib/fuzz.h lib/transfer_saturate2.h lib/sinewaves2.h lib/crossfade4.h lib/resonantfilter_data.h lib/cuedsounds.h build
cp zeptocore_compile_definitions.cmake target_compile_definitions.cmake
sed -i 's/DO_OVERCLOCK=1/#DO_OVERCLOCK=1/g' target_compile_definitions.cmake
make -C build -j$(NPROCS)
mv build/_core.uf2 zeptocore_nooverclock.uf2
ectocore: copyecto pico-extras lib/fuzz.h lib/transfer_saturate2.h lib/sinewaves2.h lib/crossfade4.h lib/resonantfilter_data.h lib/cuedsounds.h build
make -C build -j$(NPROCS)
mv build/_core.uf2 ectocore.uf2
ectocore_v0.3: pico-extras lib/fuzz.h lib/transfer_saturate2.h lib/sinewaves2.h lib/crossfade4.h lib/resonantfilter_data.h lib/cuedsounds.h build
cp ectocore_compile_definitions_v0.3.cmake target_compile_definitions.cmake
make -C build -j$(NPROCS)
mv build/_core.uf2 ectocore_v0.3.uf2
copyzepto:
cp zeptocore_compile_definitions.cmake target_compile_definitions.cmake
copyecto:
cp ectocore_compile_definitions.cmake target_compile_definitions.cmake
copyboard:
cp zeptoboard_compile_definitions.cmake target_compile_definitions.cmake
envs:
export PICO_EXTRAS_PATH=/home/zns/pico/pico-extras
export PICO_SDK_PATH=/home/zns/pico/pico-sdk
wavetable: .venv
cd lib && ../.venv/bin/python wavetable.py > wavetable_data.h
clang-format -i --style=google lib/wavetable_data.h
lib/biquad.h: .venv
cd lib && ../.venv/bin/python biquad.py > biquad.h
lib/fuzz.h: .venv
cd lib && ../.venv/bin/python fuzz.py > fuzz.h
clang-format -i --style=google lib/fuzz.h
lib/transfer_doublesine.h: .venv
cd lib && ../.venv/bin/python transfer_doublesine.py > transfer_doublesine.h
clang-format -i --style=google lib/transfer_doublesine.h
lib/sinewaves.h: .venv
.venv/bin/python lib/sinewaves.py > lib/sinewaves.h
clang-format -i lib/sinewaves.h
lib/sinewaves2.h: .venv
.venv/bin/python lib/sinewaves2.py > lib/sinewaves2.h
clang-format -i lib/sinewaves2.h
lib/crossfade4.h: .venv
# set block size to 441
cd lib && ../.venv/bin/python crossfade4.py 441 > crossfade4.h
clang-format -i --style=google lib/crossfade4.h
lib/selectx2.h: .venv
cd lib && ../.venv/bin/python selectx2.py > selectx2.h
clang-format -i --style=google lib/selectx2.h
lib/crossfade.h: .venv lib/crossfade4.h
cd lib && ../.venv/bin/python transfer_saturate.py > transfer_saturate.h
clang-format -i --style=google lib/transfer_saturate.h
cd lib && ../.venv/bin/python transfer_distortion.py > transfer_distortion.h
clang-format -i --style=google lib/transfer_distortion.h
cd lib && ../.venv/bin/python selectx.py > selectx.h
clang-format -i --style=google lib/selectx.h
cd lib && ../.venv/bin/python biquad.py > biquad.h
clang-format -i --style=google lib/biquad.h
cd lib && ../.venv/bin/python crossfade.py > crossfade.h
clang-format -i --style=google lib/crossfade.h
cd lib && ../.venv/bin/python crossfade2.py > crossfade2.h
clang-format -i --style=google lib/crossfade2.h
lib/transfer_saturate2.h: .venv
cd lib && ../.venv/bin/python transfer_saturate2.py > transfer_saturate2.h
clang-format -i --style=google lib/transfer_saturate2.h
lib/resonantfilter_data.h: .venv
cd lib && ../.venv/bin/python resonantfilter.py > resonantfilter_data.h
clang-format -i --style=google lib/resonantfilter_data.h
lib/cuedsounds.h: lib/cuedsounds_zeptocore.h lib/cuedsounds_ectocore.h
lib/cuedsounds_zeptocore.h:
cd dev/audio2flash && go build -v && ./audio2flash -name cuedsounds -in cuedsounds-zeptocore -out ../../lib/cuedsounds_zeptocore.h
lib/cuedsounds_ectocore.h:
cd dev/audio2flash && go build -v && ./audio2flash -name cuedsounds -in cuedsounds-ectocore -out ../../lib/cuedsounds_ectocore.h
pico-extras:
git clone https://github.com/raspberrypi/pico-extras.git pico-extras
cd pico-extras && git checkout sdk-1.5.1
cd pico-extras && git submodule update -i
copysamples:
cd dev/copysamples && go build -v
# sudo XDG_RUNTIME_DIR=/run/user/1000 ./dev/copysamples/copysamples -src dev/starting_samples2
# sudo XDG_RUNTIME_DIR=/run/user/1000 ./dev/copysamples/copysamples -src dev/starting_samples_kero
#sudo XDG_RUNTIME_DIR=/run/user/1000 ./dev/copysamples/copysamples -src dev/pikocore-starting
sudo XDG_RUNTIME_DIR=/run/user/1000 ./dev/copysamples/copysamples -src dev/starting_samples_v4
minicom:
cd dev/minicom && go build -v
./dev/minicom/minicom
midicom:
cd dev/midicom && go build -v
./dev/midicom/midicom
changebaud:
-curl localhost:7083
resetpico2:
-amidi -p $$(amidi -l | grep 'zeptocore\|zeptoboard\|ectocore' | awk '{print $$2}') -S "B00000"
sleep 0.1
-amidi -p $$(amidi -l | grep 'zeptocore\|zeptoboard\|ectocore' | awk '{print $$2}') -S "B00000"
sleep 0.1
-amidi -p $$(amidi -l | grep 'zeptocore\|zeptoboard\|ectocore' | awk '{print $$2}') -S "B00000"
sleep 0.1
upload: resetpico2 changebaud dobuild
./dev/upload.sh
bootreset: .venv dobuild
.venv/bin/python dev/reset_pico.py /dev/ttyACM0
autoload: dobuild bootreset upload
build:
rm -rf build
mkdir build
cd build && cmake ..
make -C build -j$(NPROCS)
echo "build success"
audio:
sox lib/audio/amen_5c2d11c8_beats16_bpm170.flac -c 1 --bits 16 --encoding signed-integer --endian little amen_bpm170_beats16_mono.wav
sox lib/audio/amen_0efedaab_beats8_bpm165.flac -c 1 --bits 16 --encoding signed-integer --endian little amen_bpm165_beats8_mono.wav
audio2:
sox lib/audio/amen_5c2d11c8_beats16_bpm170.flac -c 2 --bits 16 --encoding signed-integer --endian little amen_bpm170_beats16_stereo.wav
sox lib/audio/amen_0efedaab_beats8_bpm165.flac -c 2 --bits 16 --encoding signed-integer --endian little amen_bpm165_beats8_stereo.wav
bass: .venv
cd lib && ../.venv/bin/python bass_raw.py audio/bass_e.wav bass_sample.h
clean:
rm -rf build
rm -rf *.wav
rm -rf lib/biquad.h
rm -rf *.uf2
debug:
sudo minicom -b 115200 -o -D /dev/ttyACM
cloc:
cloc --exclude-list-file=dev/.clocignore --exclude-lang="make,CMake,D,Markdown,JSON,INI,Bourne Shell,TOML,TypeScript,YAML,Assembly" *
ignore:
git status --porcelain | grep '^??' | cut -c4- >> .gitignore
git commit -am "update gitignore"
release:
cd core && goreleaser release -p 32 --clean --snapshot
server:
cd core && air
resetpico: .venv
.venv/bin/python dev/reset_pico.py
versions.md:
cd dev/gitread && go build -v && ./gitread ../../docs/content/versions/versions.md
docsbuild: versions.md
cd docs && hugo --minify
rm -rf core/src/server/docs
cp -r docs/public core/src/server/docs
.PHONY: core_windows.exe
core_windows.exe: docsbuild
cd core && CGO_ENABLED=1 CC="zig cc -target x86_64-windows-gnu" GOOS=windows GOARCH=amd64 go build -v -ldflags "-s -w" -o ../core_windows.exe
core/MacOSX11.3.sdk:
cd core && wget -q https://github.com/joseluisq/macosx-sdks/releases/download/11.3/MacOSX11.3.sdk.tar.xz
cd core && tar -xf MacOSX11.3.sdk.tar.xz
.PHONY: core_macos_aarch64
core_macos_aarch64: install_go21 docsbuild core/MacOSX11.3.sdk
# https://web.archive.org/web/20230330180803/https://lucor.dev/post/cross-compile-golang-fyne-project-using-zig/
cd core && MACOS_MIN_VER=11.3 MACOS_SDK_PATH=$(PWD)/core/MacOSX11.3.sdk CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 \
CGO_LDFLAGS="-mmacosx-version-min=$${MACOS_MIN_VER} --sysroot $${MACOS_SDK_PATH} -F/System/Library/Frameworks -L/usr/lib" \
CC="zig cc -target aarch64-macos -isysroot $${MACOS_SDK_PATH} -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks" \
go1.21.13 build -ldflags "-s -w" -buildmode=pie -o ../core_macos_aarch64
.PHONY: core_macos_amd64
core_macos_amd64: install_go21 docsbuild core/MacOSX11.3.sdk
# https://web.archive.org/web/20230330180803/https://lucor.dev/post/cross-compile-golang-fyne-project-using-zig/
cd core && MACOS_MIN_VER=11.3 MACOS_SDK_PATH=$(PWD)/core/MacOSX11.3.sdk CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 \
CGO_LDFLAGS="-mmacosx-version-min=$${MACOS_MIN_VER} --sysroot $${MACOS_SDK_PATH} -F/System/Library/Frameworks -L/usr/lib" \
CC="zig cc -target x86_64-macos -isysroot $${MACOS_SDK_PATH} -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks" \
go1.21.13 build -ldflags "-s -w" -buildmode=pie -o ../core_macos_amd64
.PHONY: core_macos_amd642
core_macos_amd642: docsbuild
cd core && CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 \
go build -ldflags "-s -w" -buildmode=pie -o ../core_macos_amd642
.PHONY: core_linux_amd64
core_linux_amd64: docsbuild
cd core && CGO_ENABLED=1 CC="zig cc -target x86_64-linux-gnu" GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -v -o ../core_linux_amd64
.PHONY: core_server
core_server: docsbuild
cd core && go build -v -o ../core_server
# ectocore builds
.PHONY: ectocore_windows.exe
ectocore_windows.exe: docsbuild
cd core && CGO_ENABLED=1 CC="zig cc -target x86_64-windows-gnu" GOOS=windows GOARCH=amd64 go build -v -ldflags "-s -w -X main.EctocoreDefault=yes" -o ../ectocore_windows.exe
.PHONY: ectocore_macos_aarch64
ectocore_macos_aarch64: install_go21 docsbuild core/MacOSX11.3.sdk
# https://web.archive.org/web/20230330180803/https://lucor.dev/post/cross-compile-golang-fyne-project-using-zig/
cd core && MACOS_MIN_VER=11.3 MACOS_SDK_PATH=$(PWD)/core/MacOSX11.3.sdk CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 \
CGO_LDFLAGS="-mmacosx-version-min=$${MACOS_MIN_VER} --sysroot $${MACOS_SDK_PATH} -F/System/Library/Frameworks -L/usr/lib" \
CC="zig cc -target aarch64-macos -isysroot $${MACOS_SDK_PATH} -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks" \
go1.21.13 build -ldflags "-s -w -X main.EctocoreDefault=yes" -buildmode=pie -o ../ectocore_macos_aarch64
.PHONY: ectocore_macos_amd64
ectocore_macos_amd64: install_go21 docsbuild core/MacOSX11.3.sdk
# https://web.archive.org/web/20230330180803/https://lucor.dev/post/cross-compile-golang-fyne-project-using-zig/
cd core && MACOS_MIN_VER=11.3 MACOS_SDK_PATH=$(PWD)/core/MacOSX11.3.sdk CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 \
CGO_LDFLAGS="-mmacosx-version-min=$${MACOS_MIN_VER} --sysroot $${MACOS_SDK_PATH} -F/System/Library/Frameworks -L/usr/lib" \
CC="zig cc -target x86_64-macos -isysroot $${MACOS_SDK_PATH} -iwithsysroot /usr/include -iframeworkwithsysroot /System/Library/Frameworks" \
go1.21.13 build -ldflags "-s -w -X main.EctocoreDefault=yes" -buildmode=pie -o ../ectocore_macos_amd64
.PHONY: ectocore_linux_amd64
ectocore_linux_amd64: docsbuild
cd core && CGO_ENABLED=1 CC="zig cc -target x86_64-linux-gnu" GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X main.EctocoreDefault=yes" -v -o ../ectocore_linux_amd64
.PHONY: docs
docs: versions.md
cd docs && hugo serve -D --bind 0.0.0.0
.venv:
uv venv
uv pip install -r requirements.txt
dev/madmom/.venv:
cd dev/madmom && uv venv
cd dev/madmom && . .venv/bin/activate && uv pip install -r requirements.txt