There are several ways you can do this. The current issue is that the metro only sends a value of 1 at the instant it triggers, not long enough to pass audio thru. And also you might want an envelope to avoid clicks (or not?). You could use a seperate trigger instr. or use something like triglinseg:
instr 1
kTrig = gausstrig(1, 1, .6)
iAmp = .7
aEnv = triglinseg(kTrig, 0, .004, iAmp, .3, iAmp, .004, 0)
aSig diskin2 "fox.wav", 1, 0, 1
out aSig * aEnv
endin
It can be difficult to control the envelope to not get clicks though. You could also try using metrobpm which has a gate (the trigger can stay open at 1) that can be randomized.
instr 1
kFreq = randomh(20, 120, 2)
kGate = randomh(.1, .7, 2)
kTrig = metrobpm(kFreq, 0, kGate)
kEnv = portk(kTrig, .004)
aSig diskin2 "fox.wav", 1, 0, 1
out aSig * kEnv
endin
Another slightly more esoteric approach is to use random noise as an envelope . In this ex. passing the noise thru a lpf & then multiplying it by itself creates a random unipolar signal. That is multiplied by a larger value (10^3) then limited from .3 to 1 to leave just the peaks, then .3 is subtracted to bring the lower parts of the signal back to 0. That creates a random envelope. You can play with various values (the rspline, lpf cutoff freq, power of [^] etc.) to get different results.
At the moment when the slider is 0 you only hear the gated signal (wet) & at 1 there’s no gating (dry). If you reverse the aSig * aEnv to:
aOut = ntrpol(aSig, aSig * aEnv, kMix)
then 0 will be fully dry.
instr 1
kMix chnget "slider1"
kMod = rspline(4, 8, .3, 1)
aNoiz = noise(kMod, 0)
aNoiz = butlp(aNoiz, 2)
aNoiz *= aNoiz * 10^3
aMult = aNoiz
aEnv = limit:a(aNoiz, .3, 1) - .3
aSig diskin2 "fox.wav", 1, 0, 1
aOut = ntrpol(aSig * aEnv, aSig, kMix)
out aOut
endin