Just to reinforce Kas's point: Recently, I had an experience using headphones with ChucK on my mac where I had an improperly set filter value, and it blew up in my ears. Before trying the code, I had set the volume on my mac to the lowest setting, but as Kas and others have explained, when you multiply 0.01 by 10^30, you get 10^28 (figures approximate...), so it's basically giving you the loudest possible sound on your computer, even if you've set your volume as low as possible. My ears seem to be fine, but I was pretty rattled by the experience. Talking to a friend about it, he mentioned that he knew someone who really destroyed her hearing in one ear playing with filters in MAX.
From now on, I'm going to be using this code, and inserting one of these before my DAC whenever I use chuck:
class HardLimit extends Chugen {
2 => float limit;
fun float tick(float in) {
return Math.min(Math.max(in, -limit), limit);
}
fun float setLimit(float limit) {
limit => this.limit;
}
}
I think this is a serious issue for mac users and that it should be
addressed in the next build. My suggestion is to have a parameter of the
dac ugen called dac.limit, which is automatically set to 2 or 3 or so, and
which acts as a hard limit applied to the audio data going into the dac. A
user could set their own limit or set it to -1 or something to indicate no
limit. But I think the default should be something that will not destroy
anyone's hearing. :-)
Marc
On Thu, Feb 26, 2015 at 5:33 AM, Kassen
Hey, Robert!
On 26 February 2015 at 06:50, Robert Poor
wrote: On Wed, Feb 25, 2015 at 11:18 AM, Kassen
wrote: [on windows] turning down the volume to a comfortable level won't help
against that explosion
Are you saying there's no way to turn down the *output* of the DACs?
Let me first clarify; where you wrote "[on Windows]" I meant in systems using a floating point internal sound router. In our case that is really only OSX.
Clearly you can turn the dac up or down using dac.gain( float).
What I meant is that we have some sort of issue in our code that sends a signal with a huge amplitude, let's assume some signal with 10 digits worth of amplitude, it is hard to turn that down in a meaningful way. If we set the dac's gain to 0.1 then there will still be 9 digits worth of amplitude left; still orders of magnitude louder than what our hardware can deal with.
Under normal conditions we would not make such a mistake, but runaway feedback, such as we might encounter in a unstable filter, will rapidly approach the max of what can be expressed in double-precission floats.
There ways to deal with that. We could use a limiter or clipper. You can also use a external hardware gain and leave your system volume at 100%.
I hope that clarifies how I believe it all works. If you are on Windows or Linux I don't believe this will matter to you, sorry if I was unclear there.
Yours, Kas.
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- Marc Evans PhD Student in Music Composition at UCSB Stanford BA '10, Music; MA '11, Music, Science and Technology www.marcevansmusic.com "We are here on Earth to do good to others. What the others are here for, I don't know." --W. H. Auden