-
Notifications
You must be signed in to change notification settings - Fork 1
/
csv.sh
39 lines (35 loc) · 633 Bytes
/
csv.sh
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
#!/bin/bash -e
# Copyright 2024 Michael Pozhidaev <[email protected]>
# The LUWRAIN Project, GPL v.3
cat <<EOF
0, 0, Header, 1, 2, 480
1, 0, Start_track
1, 0, Title_t, "Sound icon"
1, 0, Text_t, "LUWRAIN sound icon"
1, 0, Copyright_t, "The LUWRAIN Project"
1, 0, Time_signature, 4, 2, 24, 8
1, 0, Tempo, 500000
1, 0, End_track
2, 0, Start_track
2, 0, Instrument_name_t, "MIDI instrument $1"
2, 0, Program_c, 1, $1
EOF
VOL="$2"
shift
shift
p=0
while [ -n "$1" ]; do
n="$1"
d="$2"
((pp=p+d))
cat <<EOF
2, $p, Note_on_c, 1, $n, $VOL
2, $pp, Note_off_c, 1, $n, 0
EOF
p="$pp"
shift
done
cat <<EOF
2, $p, End_track
0, 0, End_of_file
EOF