Amplitudes in digital audio are limited by the numerical precision of the computer system at hand, what is commonly referred to as bit depth. For example, 16-bit audio means the numbers we use to represent each sample of audio have a precision of 16 bits, that is, we have at most numbers to represent any given sample’s amplitude. That may seem like a lot, but in fact is not at all! To worsen the situation, since we usually represent oscillations by alternating positive and negative phases, a 16-bit audio system’s dynamic range is effectively half of its maximum possible value, that is , as one of the bits is used to represent the sign.

If nothing is specified, Csound will work with raw amplitude values. If we are working with 16-bit precision, this means our amplitudes will range between zero and , since we have to subtract the bit that is used to represent the negative side of the phase. The problem with raw amplitudes is that they only apply to a particular bit depth. It is often convenient to represent amplitude values in such a way that changing our bit depth will not force us to rewrite our entire code.

A standardized way of dealing with this issue is to use a decibel scale. There are many types of decibel scales depending on the application. What is common to all of them is that they are not linear, but rather logarithmic, because they aim at modeling our preception of amplitudes, which is also not linear. The many decibel scales try to approximate how we actually perceive amplitude, and in digital audio applications, the dBFS (decibel relative to full scale) is most commonly employed. In this scale, zero is usually our loudest amplitude (in any bit depth), and all softer amplitudes have negative values. Considering that raw amplitude values double approximately every 6 decibels (or halve every -6 dB), the quietest we can get with 16-bit precision is roughly -90 dB.

To exemplify how to employ the dBFS scale in Csound, we first open both the synthesizer and the orchestra headings.


We then make use of the ‘0dbfs’ orchestra statement. By default, 0dbfs is set to 32768. We are now going to override this default setting and make our loudest amplitude value equal to 1.

0dbfs = 1

We are now able to express by the value 0.5 the raw amplitude corresponding to 32768*0.5=16384 in 16 bits.

instr 1
asig oscili 0.5, 440, 1
out asig

In many situations, however, it is more convenient to express amplitudes as values on an actual decibel scale. In spite of its name, the 0dbfs orchestra statement does not really give us a decibel scale, it only normalizes our maximum raw amplitude to the value we specify. We can, however, make use of opcodes to effectively write all our amplitudes as values on a logarithmic scale per se. One such opcode is the ampdbfs(), which converts proper dBFS values to raw amplitudes Csound can use. Note here that half of our full amplitude corresponds roughly to only -6 dBFS.

instr 2
asig oscili ampdbfs(-6), 440, 1
out asig

Translating dBFS values into raw amplitude values, although straightforward mathematically, can become cumbersome if many conversions are needed, and especially if changes in bit depth are considered. The opcode ‘dbfsamp’ does that conversion and its use is exemplified in instrument 3. In it, we use the ‘print’ opcode to later inspect the conversion value in the console output. Note that instruments in Csound do not need to produce any sounds, they may very well just do calculations for us. After compiling the piece, check the log to see the result of these calculations.

instr 3
iamp = ampdbfs(-6)
print iamp
idbfs = dbfsamp(iamp)
print idbfs


f 1 0 1024 10 1

i 1 0 2
i 2 2.5 2
i 3 5 0.1


News & Events

Subscribe at the bottom of the page to be informed of news as they arrive.

RunloopSound Released on the App Store

Aug 12, 2016

RunloopSound brings the world of Csound to iOS devices. With a gorgeous user interface and complete integration to all major cloud providers, RunloopSound allows you to keep designing incredible sounds wherever you go.

Read more

Unbalanced Connection 57

Feb 19, 2016

The Unbalanced Connection is a semiannual series of concerts hosted by the University of Florida and dedicated to electroacoustic music.

Read more

Society of Composers, Inc.

Mar 15, 2014

Read more

O Guri Takes Over Portugal!

Oct 8, 2012

Read more

Première of O Guri in Bagé

Jul 7, 2011

O Guri is a feature film directed by Zeca Brito whose original music was written by me.

Read more