amundsen
2011-07-28 19:26:07 UTC
Hello,
The very basic program below is just intended to load a sound when pressing
one button and to play it when pressing a second one. I cannot hear any
sound however.
What's wrong ?
Roald Baudoux
(
var but1;
var but2;
var soundChosen;
var buf1;
var soundPlayer;
//Buffer creation to store a sound
buf1 = Buffer.new(s);
//sound playback synthDef and Synth creation
SynthDef(\simpleReader, {| out = 0, bufnum = 0 |
Out.ar(out, Pan2.ar(PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum),
doneAction:2), 0.0, 1.0));
}).send(s);
soundPlayer = Synth.new(\simpleReader);
//draw main window
w = Window.new("Sound playback");
w.bounds = Rect(50, 300, 200, 200);
w.front;
// remembers if a sound has been chosen
soundChosen = 0;
//button to choose a sound
but1 = Button(w, Rect(40,20,120,30))
.states_([
["Choose a sound", Color.black, Color.red]
])
.action_({
CocoaDialog.getPaths({ arg paths;
paths.do({ arg p;
p.postln;
buf1.read(s, p);
soundChosen = 1;
})
},{
"No file chosen !".postln;
});
});
//button to play sound
but2 = Button(w, Rect(40,80,120,30))
.states_([
["Play chosen sound", Color.black, Color.red]
])
.action_({
if (soundChosen == 1,
{
"Sound playback".postln;
"buf1 :".post;
buf1.postln;
soundPlayer.postln;
soundPlayer.play(s, [\bufnum, buf1]);
},{"Choose a sound first !".postln;
}
);
});
)
-----
----------------------------------------------------------------------------
If it sounds good, it's probably good music.
If it sounds bad, whatever is behind - algorithms, recordings, microphones, software, computer, or even huge work - it's bad music.
--
View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/Basic-program-won-t-play-sound-loaded-in-buffer-tp6631010p6631010.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
The very basic program below is just intended to load a sound when pressing
one button and to play it when pressing a second one. I cannot hear any
sound however.
What's wrong ?
Roald Baudoux
(
var but1;
var but2;
var soundChosen;
var buf1;
var soundPlayer;
//Buffer creation to store a sound
buf1 = Buffer.new(s);
//sound playback synthDef and Synth creation
SynthDef(\simpleReader, {| out = 0, bufnum = 0 |
Out.ar(out, Pan2.ar(PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum),
doneAction:2), 0.0, 1.0));
}).send(s);
soundPlayer = Synth.new(\simpleReader);
//draw main window
w = Window.new("Sound playback");
w.bounds = Rect(50, 300, 200, 200);
w.front;
// remembers if a sound has been chosen
soundChosen = 0;
//button to choose a sound
but1 = Button(w, Rect(40,20,120,30))
.states_([
["Choose a sound", Color.black, Color.red]
])
.action_({
CocoaDialog.getPaths({ arg paths;
paths.do({ arg p;
p.postln;
buf1.read(s, p);
soundChosen = 1;
})
},{
"No file chosen !".postln;
});
});
//button to play sound
but2 = Button(w, Rect(40,80,120,30))
.states_([
["Play chosen sound", Color.black, Color.red]
])
.action_({
if (soundChosen == 1,
{
"Sound playback".postln;
"buf1 :".post;
buf1.postln;
soundPlayer.postln;
soundPlayer.play(s, [\bufnum, buf1]);
},{"Choose a sound first !".postln;
}
);
});
)
-----
----------------------------------------------------------------------------
If it sounds good, it's probably good music.
If it sounds bad, whatever is behind - algorithms, recordings, microphones, software, computer, or even huge work - it's bad music.
--
View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/Basic-program-won-t-play-sound-loaded-in-buffer-tp6631010p6631010.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/