Professional Documents
Culture Documents
Lib Asco
Lib Asco
$channel12 := map {
(95, ["APIZZd-95-N.A.wav", -5.0, 1.]),
(92, ["APIZZd-92-N.A.wav", -5.0, 1.]),
(89, ["APIZZd-89-N.A.wav", -5.0, 1.]),
(86, ["APIZZd-86-N.A.wav", -5.0, 1.]),
(82, ["APIZZd-82-N.A.wav", -5.0, 1.]),
(79, ["APIZZd-79-N.A.wav", -5.0, 1.]),
(72, ["APIZZd-72-N.A.wav", -5.0, 1.]),
(66, ["APIZZd-66-N.A.wav", -5.0, 1.]),
(62, ["APIZZd-62-N.A.wav", -5.0, 1.]),
(59, ["APIZZd-59-N.A.wav", -5.0, 1.]),
(56, ["APIZZd-56-N.A.wav", -5.0, 1.])
}
; Function to use in @find for map that attempts to find the closest
key to input $a
@fun_def @geq($a, $key, $value) { $key >= $a }
/* Translate MIDI message to Samplor messages
Samplor arguments: <bang> <buffer-name> <offset/0> <dur/0>
<trans-inPitchScale> <amp> <pan>
Transposition: in semi-tones in MAP, translates to
2^(x/12).
Amplitude: Combine amp in MAP (db) & velocity. In
Linear.
*/
@MACRO_DEF Makenote($pitch, $velocity, $channel, $dur)
{
group Midi_$channel
{
;; Samplor value for $channel are in the inner
table $samplor($channel)
;; Now we need to calculate the needed
transposition from existing pitches.
;; NOTE: We will store calculations in @LOCAL
variables.
;; There will be certainly parallel
calls to this module and this will avoid values being mixed through
various calls. You need to explicitly tell Antescofo if variables
are local:
@local $ref_pitch, $trans, $amplitude, $panning,
$filename
; find closest pitch in samplor to requested pitch
$ref_pitch := @find($samplor($channel),
@geq($pitch)) ; retourne 67
; calculate the transposition value in pitch-scale
factor for pitch in $p
$trans := @pow(2.,($pitch - $ref_pitch)/12.0)
; amplitude is Db value stored in MAP (convert to
linear) times velocity value (linear)
$amplitude := (($velocity/
127.0)*(@pow(10.,$samplor($channel)($ref_pitch)[1]/20)))
; panning and filename are just inside the map
$panning := ($samplor($channel)($ref_pitch)[2])
$filename := ($samplor($channel)($ref_pitch)[0])
; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
; Spatialization definitions and initializations
; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%