| 1 | |
| 2 | <refentry id="Zerodbfs"> |
| 3 | <indexterm id="Index0dbfs"><primary>0dbfs</primary></indexterm> |
| 4 | <refentryinfo><title>Orchestra Syntax:Header</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>0dbfs</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>0dbfs</refname> |
| 11 | <refpurpose> |
| 12 | Sets the value of 0 decibels using full scale amplitude. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Sets the value of 0 decibels using full scale amplitude. |
| 20 | </para> |
| 21 | </refsect1> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis><command>0dbfs</command> = iarg</synopsis> |
| 26 | <synopsis><command>0dbfs</command> </synopsis> |
| 27 | </refsect1> |
| 28 | |
| 29 | <refsect1> |
| 30 | <title>Initialization</title> |
| 31 | <para> |
| 32 | <emphasis>iarg</emphasis> -- the value of 0 decibels using full scale amplitude. |
| 33 | </para> |
| 34 | </refsect1> |
| 35 | |
| 36 | <refsect1> |
| 37 | <title>Performance</title> |
| 38 | <para> |
| 39 | The default is 32767, so all existing orcs <emphasis>should</emphasis> work. |
| 40 | </para> |
| 41 | |
| 42 | <para> |
| 43 | Amplitude values in Csound are always relative to a "<link linkend="Zerodbfs"><citetitle>0dbfs</citetitle></link>" value representing the peak available amplitude before clipping. In the original Csound, this value was always 32767, corresponding to the bipolar range of a 16bit soundfile or 16bit AD/DA codec. This remains the <emphasis>default</emphasis> peak amplitude for Csound, for backward compatibility. The <link linkend="Zerodbfs"><citetitle>0dbfs</citetitle></link> value enables Csound to produce appropriately scaled values to whatever output format is being used, whether 16bit integer, 24bit integer, 32bit floats, or even 32bit integers. |
| 44 | </para> |
| 45 | <para> |
| 46 | OdBFS 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: |
| 47 | |
| 48 | <informalexample> |
| 49 | <programlisting>ipeak <emphasis role="op">=</emphasis> <emphasis role="ohdr">0dbfs</emphasis></programlisting> |
| 50 | </informalexample> |
| 51 | |
| 52 | <informalexample> |
| 53 | <programlisting> |
| 54 | asig <emphasis role="opc">oscil</emphasis> <emphasis role="ohdr">0dbfs</emphasis>, freq, 1 |
| 55 | <emphasis role="opc">out</emphasis> asig * 0.3 * <emphasis role="ohdr">0dbfs</emphasis></programlisting> |
| 56 | </informalexample> |
| 57 | |
| 58 | </para> |
| 59 | |
| 60 | <para> |
| 61 | The purpose of the <emphasis>0dbfs</emphasis> opcode is for people to start to code 0dbfs-relatively (and use the <link linkend="ampdbfs"><citetitle>ampdbfs()</citetitle></link> 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. |
| 62 | </para> |
| 63 | |
| 64 | <para> |
| 65 | Floats written to a file, when <emphasis>0dbfs = 1</emphasis>, will in effect go through no range translation at all. So the numbers in the file are exactly what the orc says they are. |
| 66 | </para> |
| 67 | <para>For more details on amplitude values in Csound, see the section <link linkend="AmplitudeCsound"><citetitle>Amplitude values in Csound</citetitle></link></para> |
| 68 | |
| 69 | </refsect1> |
| 70 | |
| 71 | <refsect1> |
| 72 | <title>Example</title> |
| 73 | <para> |
| 74 | Here is an example of the 0dbfs opcode. It uses the file <ulink url="examples/0dbfs.csd"><citetitle>0dbfs.csd</citetitle></ulink>. |
| 75 | |
| 76 | <example> |
| 77 | <title>Example of the 0dbfs opcode.</title> |
| 78 | |
| 79 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 80 | <xi:include href="examples-xml/0dbfs.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 81 | </example> |
| 82 | </para> |
| 83 | </refsect1> |
| 84 | |
| 85 | <refsect1> |
| 86 | <title>See also</title> |
| 87 | <para><link linkend="OrchHeader"><citetitle>Orchestra Header Statements</citetitle></link></para> |
| 88 | </refsect1> |
| 89 | |
| 90 | <refsect1> |
| 91 | <title>Credits</title> |
| 92 | <para> |
| 93 | <simplelist> |
| 94 | <member>Author: Richard Dobson</member> |
| 95 | <member>May 2002</member> |
| 96 | </simplelist> |
| 97 | </para> |
| 98 | <para>New in version 4.10</para> |
| 99 | </refsect1> |
| 100 | </refentry> |