1 title:: audio_rate_mapping
2 summary:: audio mapping in ProxySpace
3 categories:: Libraries>JITLib>Tutorials
6 // todo. expand(numChannels) message
8 p = ProxySpace.push(s.boot);
11 ~f1 = { |a_in=#[0,0], freq=500, dt=0.01| Ringz.ar(a_in, freq, dt) };
12 ~f2 = { |a_in=#[0,0], dt=0.1| CombL.ar(a_in, 0.5, dt, 15 * dt) };
13 ~f3 = { |a_in=#[0,0], freq=30| a_in * LFSaw.ar(freq.neg).max(0) };
16 ~x1 = { LFPulse.kr(SinOsc.kr(0.2).exprange(2, 200)) * PinkNoise.ar(0.5.dup) };
17 ~x2 = { Dust.ar(SinOsc.kr(0.2, [0, pi]).exprange(2, 2000)) };
21 ~out = { |a_in=#[0,0]| a_in };
23 // some mappings by hand:
24 ~out.mapn(\a_in, ~x1);
25 ~out.xmapn(\a_in, ~x2);
27 ~out.xmapn(\a_in, ~f1); ~f1.xmapn(\a_in, ~x1);
28 ~out.xmapn(\a_in, ~f2); ~f2.xmapn(\a_in, ~x1);
29 ~out.xmapn(\a_in, ~f2); ~f2.xmapn(\a_in, ~x1);
32 ~mx1 = { MouseX.kr(0.0001, 1, 1) };
35 ~out.xmapn(\a_in, ~f3); ~f3.xmapn(\a_in, ~f2); ~f2.xmapn(\a_in, ~x1);
36 // this should maybe be:
37 // ~f2 --(\a_in)--> ~f3 --(\a_in)--> ~out
39 ~mx1 = { LFNoise1.kr(0.1).exprange(0.0001, 1) };
40 ~mF = { ~mx1.kr.linexp(0, 1, 1, 10000) };
44 ~f2.xmapn(\a_in, ~f1);
46 ~f1.xmapn(\freq, ~mF, \dt, ~mx1);
48 ~x2 = { Impulse.ar(SinOsc.kr(0.2, [0, pi]).exprange(2, 200)) };
49 ~x1 = { Saw.ar(20, 0.5.dup) * ~x2.ar };
56 px.map knows always already the number of channels of a proxy, so can decide whether
57 to use map or mapn. (map always would mean flat mapping).
59 px.mapn could do tricky things like:
60 px.mapn(\a_in2, [mono1, mono2])
61 px.mapn(\a_in2, stereo) would still work
62 px.mapn(\a_in2, [stereo, mono]) could use the first of the stereo chans and the mono
63 how to get at the second arg of the stereo in? or it could mix/wrap.
64 --> px.mapn([\a_inx, \a_iny], stereo)
66 px.mapn(\a_in, stereo) would take the first of the stereo channels
67 px.map(\a_in, stereo) would use the first of the stereo channels
68 px.mapn(\a_in, [mono, mono]) would use the first channel
70 mappings could be saved as is and if the proxy rebuilds with a different channel size, it would unfold?