-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (36 loc) · 1.32 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
SOUND_FONT := /usr/share/soundfonts/FluidR3_GM.sf2
DEVICE_NUMBER := 1
MP3_BITRATE := 192
.DEFAULT_GOAL := all
dist/song.mid: $(wildcard src/*.takt) $(wildcard src/*/*.takt)
mkdir -p dist
takt -o $@ src/song.takt
dist/song.wav: dist/song.mid
fluidsynth -F $@ -T wav $(SOUND_FONT) $^
dist/song.flac: dist/song.wav src/tags.txt
flac \
--tag=TITLE='$(shell grep -oP '(?<=^title ).*$$' $(lastword $^))'\
--tag=ARTIST='$(shell grep -oP '(?<=^artist ).*$$' $(lastword $^))'\
--tag=ALBUM='$(shell grep -oP '(?<=^album ).*$$' $(lastword $^))'\
-f -o $@ $(firstword $^)
touch $@ # flac
dist/song.opus: dist/song.wav src/tags.txt
opusenc \
--comment=TITLE='$(shell grep -oP '(?<=^title ).*$$' $(lastword $^))'\
--comment=ARTIST='$(shell grep -oP '(?<=^artist ).*$$' $(lastword $^))'\
--comment=ALBUM='$(shell grep -oP '(?<=^album ).*$$' $(lastword $^))'\
$(firstword $^) $@
dist/song.mp3: dist/song.wav src/tags.txt
lame \
--tt '$(shell grep -oP '(?<=^title ).*$$' $(lastword $^))'\
--ta '$(shell grep -oP '(?<=^artist ).*$$' $(lastword $^))'\
--tl '$(shell grep -oP '(?<=^album ).*$$' $(lastword $^))'\
-b $(MP3_BITRATE) $(firstword $^) $@
.PHONY: all
all: dist/song.flac dist/song.opus dist/song.mp3
.PHONY: play
play: src/song.takt
takt -m $(DEVICE_NUMBER) $^
.PHONY: interpret
interpret:
takt -m $(DEVICE_NUMBER)