Sets the value of 0 decibels using full scale amplitude.
Syntax
0dbfs=iarg0dbfs
Initialization
iarg -- the value of 0 decibels using full scale amplitude.
Performance
The default is 32768. Set 0dbfs = 1 in the orchestra header to use amplitudes from -1 to 1 for full-scale output.
When converting an older orchestra that uses the default, divide its absolute signal amplitudes by 32768 to keep a similar output level. For example, an oscillator amplitude of 10000 becomes about 0.3. Scale amplitude envelopes and thresholds too. Leave frequencies, times and relative gains unchanged. Values based on 0dbfs or ampdbfs() already follow the new scale.
Csound uses this value to scale audio for the output format. It does not limit internal signals to that range. Signals above full scale can clip at the audio device or when written to an integer sound file.
0dBFS can be defined in the header, to set the amplitude reference Csound will use, but it can also be used as a varible inside instruments like this:
ipeak0dbfs
asig0dbfs,freq,10dbfs
The purpose of the 0dbfs opcode is for people to start to code 0dbfs-relatively (and use the ampdbfs() opcodes a lot more!), rather than use explicit sample values. Using 0dbfs=1 is in accordance to industry practice, as ranges from -1 to 1 are used in most commercial plugin formats and in most other synthesis systems like Pure Data.
Floats written to a file, when 0dbfs = 1, will in effect go through no range translation at all. So the numbers in the file are exactly what the orc says they are.
<CsoundSynthesizer><CsOptions>; Select audio/midi flags here according to platform-odac ;;;realtime audio out-d ;;;no display;-iadc ;;;uncomment -iadc if realtime audio input is needed too; For Non-realtime ouput leave only the line below:; -o 0dbfs.wav -W ;;; for file output any platform</CsOptions><CsInstruments>; Initialize the global variables.sr=44100ksmps=10nchnls=2; Set the 0dbfs to 1.0dbfs=1instr1; from linear amplitude (0-1 range)print(p4)a1=poscil(p4,440)outs(a1,a1)endininstr2; from linear amplitude (0-32767 range)amp:i=p4/32767print(amp)a1=poscil(amp,440)outs(a1,a1)endininstr3; from dB FSamp:i=ampdbfs(p4)print(amp)a1=poscil(amp,440)outs(a1,a1)endin</CsInstruments><CsScore>; Table #1, a sine wave.i1011i1+10.5i1+10.1si20132767i2+1[32767/2]i2+1[3276.7]si3010i3+1-6i3+1-20e</CsScore></CsoundSynthesizer>
Here is an example of the 0dbfs opcode. It uses the file 0dbfs.csd.
<CsoundSynthesizer><CsOptions>; Select audio/midi flags here according to platform; Audio out Audio in No messages-odac -iadc -d ;;;RT audio I/O; For Non-realtime ouput leave only the line below:; -o 0dbfs.wav -W ;;; for file output any platform</CsOptions><CsInstruments>; Initialize the global variables.sr=44100ksmps=10nchnls=2; Set the 0dbfs to 1.0dbfs=1instr1; from linear amplitude (0-1 range)printp4a1oscilp4,440,1outsa1,a1endininstr2; from linear amplitude (0-32767 range)iamp=p4/32767printiampa1osciliamp,440,1outsa1,a1endininstr3; from dB FSiamp=ampdbfs(p4)printiampa1osciliamp,440,1outsa1,a1endin</CsInstruments><CsScore>; Table #1, a sine wave.f1016384101i1011i1+10.5i1+10.1si20132767i2+1[32767/2]i2+1[3276.7]si3010i3+1-6i3+1-20e</CsScore></CsoundSynthesizer>
See also
Sets the value of 0 decibels using full scale amplitude.