File: midishrc

package info (click to toggle)
midish 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,344 kB
  • sloc: ansic: 22,502; sh: 268; makefile: 119
file content (132 lines) | stat: -rw-r--r-- 2,206 bytes parent folder | download
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
#
# midi devices config
#
#dnew 0 "/dev/rmidi4" rw
#dnew 1 "/dev/rmidi3" rw
#
#


#
# function to make the current filter drop controller number ``ictl''
# on the current input
#
proc ctldrop ctlno {
	for i in [ilist] {
		fmap {ctl $i $ctlno} {none}
	}
}


#
# function to make the current filter route controller number ``ictl''
# on the current input to controller ``octl'' on the current output
#
proc ctlmap ic oc {
	for i in [ilist] {
		fmap {ctl $i $ic} {ctl [getc] $oc}
	}
}

#
# unmute all tracks
#
proc nomute {
	for i in [tlist] {
		unmute $i
	}
}

#
# mute all tracks but current
#
proc solo {
	for i in [tlist] {
		mute $i
	}
	unmute [gett]
}

#
# function to add a sysex that turns on general midi
#
proc gmon devnum {
	xnew gmon
	xadd $devnum { 0xF0 0x7E 0x7F 0x09 0x01 0xF7 }
}

#
# function to set program number of the current output to th given
# general midi program number
#
proc gmp patch {
	oaddev { pc [geto] ($patch - 1) }
}

#
# set volume (controller number 7) of the current output
#
proc vol val {
	oaddev {ctl [geto] 7  $val}
}

#
# set pan (controller number 10) of the current output
#
proc pan val {
	oaddev {ctl [geto] 10 $val}
}

#
# set reverb (controller number 91) of the current output
#
proc reverb val {
	oaddev {ctl [geto] 91 $val};
}

#
# set chorus (controller number 93) of the current output
#
proc chorus val {
	oaddev {ctl [geto] 93 $val};
}

#
# set RPN to the given value for the current output
#
proc rpn addr val {
	oaddev {rpn [geto] $addr $val}
}

#
# set NRPN to the given value for the current output
#
proc nrpn addr val {
	oaddev {nrpn [geto] $addr $val}
}

#
# XV-2020 specific macros
#
# configures a instrument with the given bank/patch or bank rhythm
# bank 0,1,2,3 corresponds to preset A, B, C and D
# patches/rhythms are counted from 0 to 127
#
proc xvp bank patch {
	oaddev { xpc [geto] ($patch) (11200 + $bank) }
}
proc xvr bank patch { 
	oaddev { xpc [geto] ($patch) (11072 + $bank) }
}

#
# generate a sysex message that set parameter on 
# address (a0,a1,a2,a3) to val
#
proc xvparam a0 a1 a2 a3 val {
	return {  							\
		0xf0 0x41 0x7f 0x00 0x10 0x12 $a0 $a1 $a2 $a3 $val	\
		128 - ($a0 + $a1 + $a2 + $a3 + $val) % 128		\
		0xf7 }
}