Merge pull request #506 from andrewcsmith/patch-2
[supercollider.git] / HelpSource / Reference / playN.schelp
blobc55f23e61b8b5395a46be52c449e3a8d0244f0b3
1 title:: playN
2 summary:: distribute audio over multiple non-adjacent channels
3 categories:: Libraries>JITLib>NodeProxy
4 related:: Classes/Monitor, Classes/NodeProxy, Classes/Ndef, Classes/ProxySpace
6 method:: playN
8 playN is a multichannel play method for link::Classes/Monitor:: and link::Classes/NodeProxy:: (see also: link::Classes/ProxySpace::, link::Classes/Ndef::) that supports playing proxy outputs over strong::non-adjacent channels::; somewhat like a splitter/line mixer.
10 code::
11 // examples
13 Server.default = s = Server.internal;
14 s.boot;
16 p = ProxySpace.push;
17 s.scope(8);
19         // a 3 channel test sound
20 ~test3 = { SinOsc.ar([2, 3, 5] * 100) * 0.2 };
22         // compare: play out of 3 adjacent channels
23 ~test3.play(3);
24 ~test3.play(6);
26 ~test3.stop;
27 ~test3.play;    // play remembers old (series) output settings;
30         // outs
31 ~test3.playN([2, 4,7]) // playN to 3 non-adjacent channels
33         // set outs, amps and vol:
35 ~test3.playN(
36         outs: [2,3,5],
37         amps: [0.5, 0.25, 0.125],
38         vol: 1
41 ~test3.vol_(2);
43 ~test3.stop;
44 ~test3.playN;   // remembers last state.
46                 // if playN has been used, one can set outs while playing.
47                 // note: this does not work reliably with the .play method!
48 ~test3.monitor.outs_([3,2,1]);
50                 // set amps while playing.
51                 // note: this does not work with play method!
52 ~test3.monitor.amps_(1/[1, 2, 3]).vol_(1);
53 ~test3.playN;
54 ~test3.monitor.outs_([2, 4, 7]);
57         // one can also spread out one channel to several, with given amplitudes:
59 ~test3.playN(
60         outs: [1, 3, [5,6,7]],
61         amps: [0.5, 0.25, [0.125,0.25, 0.5]],
62         vol: 2
66 ~test3.stop;
67 ~test3.playN;
69                 // do changes while off:
70 ~test3.stop;
71 ~test3.monitor.outs_([2, 4, [5,6,3]]);
72 ~test3.monitor.amps_(1/[1, 2, [3,2,1]]);
73 ~test3.playN;
75                 // most comfortable way to edit - only tested on osx.
76 ~test3.playNDialog;
79         // output mapping can be prepared before playN is used:
80 ~test3.clear;
82 ~test3 = { SinOsc.ar([2, 3, 5] * 100) * 0.2 };
84 ~test3.vol_(0.5);               // vol can be set already
86         // outs and amps require making a monitor first;
87 ~test3.initMonitor;
89 ~test3.monitor.outs_([3, 5, 6]);
91 ~test3.monitor.amps_([1, 2, 3]);
93 ~test3.playN;
95 ~test3.end;
96 ~test3.clear;
98 p.clean;
99 p.pop;