Last active
December 19, 2015 03:29
-
-
Save iani/5890882 to your computer and use it in GitHub Desktop.
A very simple buffer player for sound file playback in SuperCollider. This one is for a live diffusion of a stereo file to an 8 channel setup, where the left track of the sound file goes to the first 4 output busses and the right track goes to the last 4 output busses. Amplitude of each channel is controllable by setting parameters \amp1, \amp2,…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Prep | |
| Server.default.boot; | |
| Server.default.scope(8); | |
| ( | |
| ~play = { | path, out = 0 | | |
| if (~buffer.notNil) { ~buffer.free }; | |
| Buffer.read( | |
| Server.default, path, action: { | buffer, out = 0 | | |
| ~buffer = buffer; | |
| ~synth = { | out = 0, amp1 = 1, amp2 = 1, amp3 = 1, amp4 = 1, amp5 = 1, amp6 = 1, amp7 = 1, amp8 = 1 | | |
| var left, right; | |
| "===================== STARTED ===================== ".postln; | |
| #left, right = PlayBuf.ar(2, buffer, BufRateScale.kr(buffer), doneAction: 2); | |
| // Out.ar(out, [left, left, left, left, right, right, right, right]) | |
| Out.ar(0, [left, left, left, left, right, right, right, right] | |
| * [amp1, amp2, amp3, amp4, amp5, amp6, amp7, amp8] | |
| ) | |
| }.play(args: [\out, out]); | |
| }) | |
| } | |
| ) | |
| // example of usage | |
| ~synth = ~play.("/path/to/my/audiofile.wav"); | |
| ~synth.set(\amp1, 0.1); // lower the amplitude of channel 1 output | |
| ~synth.set(\out, 8); // Set the output busses to busses 8-16 (= internal busses) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment