WAV playback gets louder with each iteration
Hi, ChucK users! I'm having a problem that seems like it should have a simple solution, but I can't figure it out. Here's a program which plays a WAV (which is about 1.5 seconds long) every two seconds, several times: SndBuf buf; "d3-fa.wav" => buf.read; 0.2 => buf.gain; 2000 => int notelen; for (0 => int i; i < 20; i++) { 0 => buf.pos; buf => dac; notelen::ms => now; } Each time (using ChucK 1.4), it gets louder, and I can't figure out why. What am I getting wrong? Thanks! Brian PS. you can find my d3-fa.wav here: https://drive.google.com/file/d/1B0ZNnGNcF5BKGzmYpdMYdZOO5SbC_4FQ/view
You are adding a new connection from your SndBuf to the dac on every
iteration of the for loop. Either only do this once, near the top of the
file where you set the gain, or also break the connection within the body
of the for loop (i.e. buf =< dac; once you are done with it).
~Jack
On Sat, Jan 4, 2020 at 9:07 PM Brian Robison
Hi, ChucK users! I'm having a problem that seems like it should have a simple solution, but I can't figure it out.
Here's a program which plays a WAV (which is about 1.5 seconds long) every two seconds, several times:
SndBuf buf; "d3-fa.wav" => buf.read; 0.2 => buf.gain;
2000 => int notelen;
for (0 => int i; i < 20; i++) { 0 => buf.pos; buf => dac; notelen::ms => now; }
Each time (using ChucK 1.4), it gets louder, and I can't figure out why. What am I getting wrong?
Thanks! Brian
PS. you can find my d3-fa.wav here:
https://drive.google.com/file/d/1B0ZNnGNcF5BKGzmYpdMYdZOO5SbC_4FQ/view _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
That fixes it! I assumed "buf => dac" requested a copy of data rather than
a connection. Thanks for the enlightenment.
Brian
On Sat, Jan 4, 2020 at 9:20 PM Jack Atherton
You are adding a new connection from your SndBuf to the dac on every iteration of the for loop. Either only do this once, near the top of the file where you set the gain, or also break the connection within the body of the for loop (i.e. buf =< dac; once you are done with it).
~Jack
On Sat, Jan 4, 2020 at 9:07 PM Brian Robison
wrote: Hi, ChucK users! I'm having a problem that seems like it should have a simple solution, but I can't figure it out.
Here's a program which plays a WAV (which is about 1.5 seconds long) every two seconds, several times:
SndBuf buf; "d3-fa.wav" => buf.read; 0.2 => buf.gain;
2000 => int notelen;
for (0 => int i; i < 20; i++) { 0 => buf.pos; buf => dac; notelen::ms => now; }
Each time (using ChucK 1.4), it gets louder, and I can't figure out why. What am I getting wrong?
Thanks! Brian
PS. you can find my d3-fa.wav here:
https://drive.google.com/file/d/1B0ZNnGNcF5BKGzmYpdMYdZOO5SbC_4FQ/view _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Hi, Brian!
I think it's not necessary to chuck the buf to dac in every iteration. So
maybe just try to put this line before the for loop:
buf => dac;
Cheers,
Szilveszter
Brian Robison
Hi, ChucK users! I'm having a problem that seems like it should have a simple solution, but I can't figure it out.
Here's a program which plays a WAV (which is about 1.5 seconds long) every two seconds, several times:
SndBuf buf; "d3-fa.wav" => buf.read; 0.2 => buf.gain;
2000 => int notelen;
for (0 => int i; i < 20; i++) { 0 => buf.pos; buf => dac; notelen::ms => now; }
Each time (using ChucK 1.4), it gets louder, and I can't figure out why. What am I getting wrong?
Thanks! Brian
PS. you can find my d3-fa.wav here:
https://drive.google.com/file/d/1B0ZNnGNcF5BKGzmYpdMYdZOO5SbC_4FQ/view _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Now I saw it was already answered :)
Szilveszter Tóth
Hi, Brian!
I think it's not necessary to chuck the buf to dac in every iteration. So maybe just try to put this line before the for loop: buf => dac;
Cheers, Szilveszter
Brian Robison
ezt írta (időpont: 2020. jan. 5., V, 6:07): Hi, ChucK users! I'm having a problem that seems like it should have a simple solution, but I can't figure it out.
Here's a program which plays a WAV (which is about 1.5 seconds long) every two seconds, several times:
SndBuf buf; "d3-fa.wav" => buf.read; 0.2 => buf.gain;
2000 => int notelen;
for (0 => int i; i < 20; i++) { 0 => buf.pos; buf => dac; notelen::ms => now; }
Each time (using ChucK 1.4), it gets louder, and I can't figure out why. What am I getting wrong?
Thanks! Brian
PS. you can find my d3-fa.wav here:
https://drive.google.com/file/d/1B0ZNnGNcF5BKGzmYpdMYdZOO5SbC_4FQ/view _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Yup, but thank you too! I ended up using the disconnect approach because
it fits my main goal (playing one of eight different samples each
iteration) better, but both solutions helped my understanding.
Brian
On Sun, Jan 5, 2020 at 6:51 AM Szilveszter Tóth
Now I saw it was already answered :)
Szilveszter Tóth
ezt írta (időpont: 2020. jan. 5., V, 15:49): Hi, Brian!
I think it's not necessary to chuck the buf to dac in every iteration. So maybe just try to put this line before the for loop: buf => dac;
Cheers, Szilveszter
Brian Robison
ezt írta (időpont: 2020. jan. 5., V, 6:07): Hi, ChucK users! I'm having a problem that seems like it should have a simple solution, but I can't figure it out.
Here's a program which plays a WAV (which is about 1.5 seconds long) every two seconds, several times:
SndBuf buf; "d3-fa.wav" => buf.read; 0.2 => buf.gain;
2000 => int notelen;
for (0 => int i; i < 20; i++) { 0 => buf.pos; buf => dac; notelen::ms => now; }
Each time (using ChucK 1.4), it gets louder, and I can't figure out why. What am I getting wrong?
Thanks! Brian
PS. you can find my d3-fa.wav here:
https://drive.google.com/file/d/1B0ZNnGNcF5BKGzmYpdMYdZOO5SbC_4FQ/view _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
participants (3)
-
Brian Robison
-
Jack Atherton
-
Szilveszter Tóth