Panning and Stereo stuff

View: New views
2 Messages — Rating Filter:   Alert me  

Panning and Stereo stuff

by Felix Barry :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Right, so I've managed to create a lovely new GUI for an instrument. Here is the code with a simple Sine Oscilator creating the sound (To keep things simple).

(

SynthDef("SineWave",{arg freq = 100, amp = 0.1, pan = 0;
Out.ar([0, 1], Pan2.ar(SinOsc.ar(freq, mul: amp), pan))}).writeDefFile;

w = SCWindow ("Test Window 3", Rect(500, 500, 500, 500));
w.front;

w.view.decorator = FlowLayout(w.view.bounds);

s = SCButton(w, 493 @ 50);
s.states = [["Start", Color.black, Color.green], ["Stop", Color.black, Color.red]];
s.action = { arg state;
        if (state.value == 0, {a.free});
        if (state.value == 1, {a = Synth("SineWave")})};
       
w.view.decorator.nextLine;

EZSlider(w, 453 @ 100, "Frequency", ControlSpec(100, 1000, \exponential, 1),
{arg slider;
a.set(\freq, slider.value)});

w.view.decorator.nextLine;

EZSlider(w, 453 @ 100, "Volume", ControlSpec(0.01, 0.5, \exponential, 0.001),
{arg slider;
a.set(\amp, slider.value)});

w.view.decorator.nextLine;

EZSlider(w, 453 @ 100, "Panning", ControlSpec(-1, 1, \exponential, 0.01),
{arg slider;
a.set(\pan, slider.value)});

)

It's working great, not a bother at all, but I can't seem to get the EZSlider command to control the panning. Any suggestions? Even if you can help me make it appear in both channels at least would be of great help!

Re: Panning and Stereo stuff

by ffff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Do not post here: http://www.nabble.com/Attention-Nabble-Users-and-Digest-Fans%2C-new-forums%21%21%21%21-td23197837.html

Felix Barry wrote:
Right, so I've managed to create a lovely new GUI for an instrument. Here is the code with a simple Sine Oscilator creating the sound (To keep things simple).

(

SynthDef("SineWave",{arg freq = 100, amp = 0.1, pan = 0;
Out.ar([0, 1], Pan2.ar(SinOsc.ar(freq, mul: amp), pan))}).writeDefFile;

w = SCWindow ("Test Window 3", Rect(500, 500, 500, 500));
w.front;

w.view.decorator = FlowLayout(w.view.bounds);

s = SCButton(w, 493 @ 50);
s.states = [["Start", Color.black, Color.green], ["Stop", Color.black, Color.red]];
s.action = { arg state;
        if (state.value == 0, {a.free});
        if (state.value == 1, {a = Synth("SineWave")})};
       
w.view.decorator.nextLine;

EZSlider(w, 453 @ 100, "Frequency", ControlSpec(100, 1000, \exponential, 1),
{arg slider;
a.set(\freq, slider.value)});

w.view.decorator.nextLine;

EZSlider(w, 453 @ 100, "Volume", ControlSpec(0.01, 0.5, \exponential, 0.001),
{arg slider;
a.set(\amp, slider.value)});

w.view.decorator.nextLine;

EZSlider(w, 453 @ 100, "Panning", ControlSpec(-1, 1, \exponential, 0.01),
{arg slider;
a.set(\pan, slider.value)});

)

It's working great, not a bother at all, but I can't seem to get the EZSlider command to control the panning. Any suggestions? Even if you can help me make it appear in both channels at least would be of great help!