[Csnd] Force limiting of out(s) signal to 0dbfs
Date | 2013-05-13 16:42 |
From | Jacob Joaquin |
Subject | [Csnd] Force limiting of out(s) signal to 0dbfs |
I know this issue has come up in the past about limiting the output of a signal to 0dbfs. I was hoping that in Csound6 that this would be the case, though my ears just discovered this isn't the case. Very recently I had a very, *very* loud sound come out of my computer's built-in speakers, which I didn't realize they were capable of:
Now that Csound6 is primed for realtime live-coding, potentially with audiences and giant speakers systems, it would be in the best interest to do everything possible to avoid causing long term hearing damage to everyone in the auditorium.
And I specifically mean building the limiter directly into the Csound "out" series of opcodes and are turned on by default. Requiring someone to invest into a physical limiter/compressor or requiring every single instrument isn't practical, nor the safest option.
Best, Jake |
Date | 2013-05-13 16:45 |
From | Michael Gogins |
Subject | Re: [Csnd] Force limiting of out(s) signal to 0dbfs |
I have no problem with this as long as the limiter can be turned off using a command line option. Regards, Mike
On Mon, May 13, 2013 at 11:42 AM, Jacob Joaquin <jacobjoaquin@gmail.com> wrote:
Michael Gogins Irreducible Productions http://www.michael-gogins.com Michael dot Gogins at gmail dot com |
Date | 2013-05-13 16:49 |
From | Justin Smith |
Subject | Re: [Csnd] Force limiting of out(s) signal to 0dbfs |
Wait, I don't understand? My impression was that when you set 0dbfs that would be the value that would translate to the largest magnitude possible to send to the sound card. How exactly would you output a value higher than the highest possible for the sound card? This seems absurd. If you don't want to use the full dynamic range of your sound card, then don't let your output reach the 0dbfs level, and frankly, if your speaker is too loud the right place to fix that is the amplification system, not the software outputting to it. For maximum audio quality you should be using the full available bit depth and adjusting on the amplifier end.On Mon, May 13, 2013 at 8:45 AM, Michael Gogins <michael.gogins@gmail.com> wrote:
|
Date | 2013-05-13 17:15 |
From | Steven Yi |
Subject | Re: [Csnd] Force limiting of out(s) signal to 0dbfs |
After being burned a few times too many on samples going way out of range, I've gotten in the habit of putting a limiter on the master out of my mixer instrument. I'd rather like to have a built-in limiter by default too, but set to some multiple of 0dbfs, perhaps +12db. I think having the extra space would be good so that you can hear if something blows up, but without it getting to damaging levels. Otherwise, I'm afraid someone might miss an out of range message or just keep going with a limit-distorted signal thinking that was a result of their instrument design, rather than the built-in limiter kicking in. Having this be adjustable by commandline-flag would be good, with options to set the limit level including an off option. On Mon, May 13, 2013 at 5:49 PM, Justin Smith |
Date | 2013-05-13 17:24 |
From | Justin Smith |
Subject | Re: [Csnd] Force limiting of out(s) signal to 0dbfs |
OK, this really makes no sense to me - how can a value larger than 0dbfs even come out of the sound card, when 0dbfs is by definition the csound value that translates to the largest sample the sound card can accept as a value. quoting the manual page for 0dbfs:anything over 0dbfs is larger than the output format the sound card accepts, and is clipped to 0dbfs by the sound card's driver (or maybe wrapped to a lower value modulo the data size?), if not by csound beforehand. On Mon, May 13, 2013 at 9:15 AM, Steven Yi <stevenyi@gmail.com> wrote: ... I'd rather like to have a built-in limiter by |
Date | 2013-05-13 17:29 |
From | Rory Walsh |
Subject | Re: [Csnd] Force limiting of out(s) signal to 0dbfs |
Like Justin, I also assumed that 0dbfs represented the maximum amplitude before clipping, regardless of your bit-depth. Does this mean that 0dbfs includes some built-in headroom or what? |
Date | 2013-05-13 17:29 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Force limiting of out(s) signal to 0dbfs |
This has to do with what the user sets the system volume to. Any signal generated above 0dbfs will be produced if the volume of the system isn't at maximum.
For example, on my computer I can have the volume set to one tick above mute, but can generate loud signals that go well beyond what should be the the 0dbfs boundary as if the volume was at 100%. If the same sound was generated as soundfile, it would have been clipped at 0dbfs.
So even though I work at reasonable sound levels, a typo can generate a hazardous signal so loud it reaches the maximum output of the soundcard. If it is even higher than the max output, it then starts clipping adding even more energy to the sound.
I'm just glad I wasn't wearing headphones at the time. On Mon, May 13, 2013 at 9:24 AM, Justin Smith <noisesmith@gmail.com> wrote:
codehop.com | #code #art #music |
Date | 2013-05-13 17:33 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Force limiting of out(s) signal to 0dbfs |
I personally would prefer if it was at 0db by default for a couple reason. It would be right in line with much of the literature I've read about how in digital systems, 0db is the highest value you can generate. Even as a practical matter, I've worked on pieces in the past where everything sounded great as I rendered them in realtime, and then rendered a soundfile to share only to have it clipped and distorted. Though having a command-line flag to optionally go beyond 0db would be a nice. On Mon, May 13, 2013 at 9:15 AM, Steven Yi <stevenyi@gmail.com> wrote: After being burned a few times too many on samples going way out of codehop.com | #code #art #music |
Date | 2013-05-13 17:37 |
From | Justin Smith |
Subject | Re: [Csnd] Force limiting of out(s) signal to 0dbfs |
So csound can generate values higher than 0dbfs, and when scaled down by OS mixers it is no longer beyond the sound card's range? Since we have no control about how software mixers on the OS behave, I suggest that csound should hard clip output to 0dbfs before sending it to an RT driver as the most reasonable behavior.On Mon, May 13, 2013 at 9:33 AM, Jacob Joaquin <jacobjoaquin@gmail.com> wrote:
|
Date | 2013-05-13 18:07 |
From | Justin Smith |
Subject | Re: [Csnd] Force limiting of out(s) signal to 0dbfs |
An analog to emphasize how ridiculous this software mixing behavior is: the brightness of the windows is being controlled in the software compositing layer, and the user has turned down the brightness of the compositor to a very low level, and left all inputs to the compositors at a very high brightness which becomes normal to dim after the compositing is appliedimagine a program that specifies color brightness as floating point, and some user input results in pixel values that are beyond the range of the pixels of the hardware a) the experimental graphics program sending arbitrary data to the compositor? b) the compositor which allows inputs beyond the range the hardware can accept but then scales them rather than clipping them? c) the user setting the hardware to such an extreme setting that it could cause injury? d) the hardware maker producing a device capable of causing injury? On Mon, May 13, 2013 at 9:37 AM, Justin Smith <noisesmith@gmail.com> wrote:
|
Date | 2013-05-13 18:20 |
From | Michael Gogins |
Subject | Re: [Csnd] Force limiting of out(s) signal to 0dbfs |
0dbfs represents the signal amplitude at 0 dB full scale, Neither more, nor less. In other words, if you set 0dbfs to 32000, then a signal with maximum amplitude +/- 32000 will show as 0 dBFS. A signal of amplitude 33000 will show some positive value of dBFS, and a signal of amplitude 31000 will show some negative value of dBFS. This is entirely in keeping with traditional studio practice, where the meters on the mixer bridge, tape decks, amplifiers, etc., all show 0 dB near the top of the range, but with red above 0 dB, representing "headroom." For analog gear, 0 dBFS could be set just at the point where distortion begins, or somewhat below that, to give the user no headroom, or some usable headroom. For digital gear, of course, if 0 dB is set at the point of clipping, there actually isn't any headroom at all.
But for Csound, which uses floating point numbers to represent signals, there is oodles and oodles of headroom. It makes sense to set 0dbfs either at the point where the IEEE floating point number representing the signal amplitude has to start using an exponent, or some very comfortable share of the 24 bit mantissa, such as 20 bits (a signal to noise ratio of roughly 105 dB, about the range of the human ear without too much pain, but less than the ear with any and all pain).
Keep in mind, repeat like a mantra, dB is a relative measure - relative to some fixed point, some 0. For dBFS, the 0 is set where the gear is starting to max out, and you count in negative steps down. For dBSPL (sound pressure level), the 0 is set where you can't tell the signal from the noise of the gear, and you count in positive steps up.
Hope this helps, Mike On Mon, May 13, 2013 at 12:37 PM, Justin Smith <noisesmith@gmail.com> wrote:
Michael Gogins Irreducible Productions http://www.michael-gogins.com Michael dot Gogins at gmail dot com |
Date | 2013-05-13 18:27 |
From | Michael Gogins |
Subject | Re: [Csnd] Force limiting of out(s) signal to 0dbfs |
Your analogy does not apply to traditional analog studio gear. There is not a hard and soft cutoff. There is a gradual introduction of overload and distortion. See my other post about this.
Regards, Mike On Mon, May 13, 2013 at 1:07 PM, Justin Smith <noisesmith@gmail.com> wrote:
Michael Gogins Irreducible Productions http://www.michael-gogins.com Michael dot Gogins at gmail dot com |
Date | 2013-05-13 18:31 |
From | Steven Yi |
Subject | Re: [Csnd] Force limiting of out(s) signal to 0dbfs |
Hi Justin, I haven't ever spent the time to figure out how these out of range values can get so loud, but I'll take a guess here. First, csound renders internally with floats or doubles. From here, it 0dbfs is used to scale the generated value to the range of the output format. The problem then is the assumption that the output is 16-bit short values. I think with Core Audio, the native rendering is 32-bit floats; the link at [1] mentions: "In OS X, Core Audio expects audio data to be in native-endian, 32-bit floating-point, linear PCM format." My guess is CoreAudio expects -/+1.0 range values, and that it itself does not enforce that. Also, the system volume control then would be just an additional multiply to signals. After that, any signal would finally get converted to the HW data format necessary, where your thoughts about 16-bit (or 24-bit, etc.) would apply. I imagine if we rendered to file with 16-bit audio, we'd automatically get clipped sound that in no way could go over the expected 0dbfs set in Csound. I also imagine this situation is specifically an issue when rendering in realtime, and may be an issue specific to OSX. This is all just a guess though, but seems a reasonable assumption to me at least. I'd welcome any corrections though. Thanks! steven [1] - http://developer.apple.com/library/ios/#documentation/MusicAudio/Conceptual/CoreAudioOverview/WhatisCoreAudio/WhatisCoreAudio.html On Mon, May 13, 2013 at 7:07 PM, Justin Smith |
Date | 2013-05-14 00:25 |
From | Andres Cabrera |
Subject | Re: [Csnd] Force limiting of out(s) signal to 0dbfs |
How about a new global variable called "clip": sr = 44100Cheers, Andrés On Mon, May 13, 2013 at 10:31 AM, Steven Yi <stevenyi@gmail.com> wrote: Hi Justin, |
Date | 2013-05-14 01:03 |
From | Michael Gogins |
Subject | Re: [Csnd] Force limiting of out(s) signal to 0dbfs |
By analogy with analog gear, clipping would occur at some amplitude above 0 dB, typically +6 to +12 dB. Regards, Mike
On Mon, May 13, 2013 at 7:25 PM, Andres Cabrera <mantaraya36@gmail.com> wrote:
Michael Gogins Irreducible Productions http://www.michael-gogins.com Michael dot Gogins at gmail dot com |
Date | 2013-05-14 01:09 |
From | Jacob Joaquin |
Subject | Re: [Csnd] Force limiting of out(s) signal to 0dbfs |
Except there's a chance it'd sound really good. :) On Mon, May 13, 2013 at 5:03 PM, Michael Gogins <michael.gogins@gmail.com> wrote:
codehop.com | #code #art #music |
Date | 2013-05-14 01:35 |
From | Andres Cabrera |
Subject | Re: [Csnd] Force limiting of out(s) signal to 0dbfs |
Yes, the clip global variable could do that too: 0dbfs = 1.0Andrés
On Mon, May 13, 2013 at 5:03 PM, Michael Gogins <michael.gogins@gmail.com> wrote:
|