| 1 | |
| 2 | <refentry id="hilbert"> |
| 3 | <indexterm id="IndexHilbert"><primary>hilbert</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Modifiers:Specialized Filters</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>hilbert</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>hilbert</refname> |
| 11 | <refpurpose> |
| 12 | A Hilbert transformer. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | An IIR implementation of a Hilbert transformer. |
| 20 | </para> |
| 21 | </refsect1> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis>ar1, ar2 <command>hilbert</command> asig</synopsis> |
| 26 | </refsect1> |
| 27 | |
| 28 | <refsect1> |
| 29 | <title>Performance</title> |
| 30 | <para> |
| 31 | <emphasis>asig</emphasis> -- input signal |
| 32 | </para> |
| 33 | |
| 34 | <para> |
| 35 | <emphasis>ar1</emphasis> -- sine output of <emphasis>asig</emphasis> |
| 36 | </para> |
| 37 | |
| 38 | <para> |
| 39 | <emphasis>ar2</emphasis> -- cosine output of <emphasis>asig</emphasis> |
| 40 | </para> |
| 41 | |
| 42 | <para> |
| 43 | <emphasis>hilbert</emphasis> is an IIR filter based implementation of a broad-band 90 degree phase difference network. The input to <emphasis>hilbert</emphasis> is an audio signal, with a frequency range from 15 Hz to 15 kHz. The outputs of <emphasis>hilbert</emphasis> have an identical frequency response to the input (i.e. they sound the same), but the two outputs have a constant phase difference of 90 degrees, plus or minus some small amount of error, throughout the entire frequency range. The outputs are in quadrature. |
| 44 | </para> |
| 45 | |
| 46 | <para> |
| 47 | <emphasis>hilbert</emphasis> is useful in the implementation of many digital signal processing techniques that require a signal in phase quadrature. <emphasis>ar1</emphasis> corresponds to the cosine output of <emphasis>hilbert</emphasis>, while <emphasis>ar2</emphasis> corresponds to the sine output. The two outputs have a constant phase difference throughout the audio range that corresponds to the phase relationship between cosine and sine waves. |
| 48 | </para> |
| 49 | |
| 50 | <para> |
| 51 | Internally, <emphasis>hilbert</emphasis> is based on two parallel 6th-order allpass filters. Each allpass filter implements a phase lag that increases with frequency; the difference between the phase lags of the parallel allpass filters at any given point is approximately 90 degrees. |
| 52 | </para> |
| 53 | |
| 54 | <para> |
| 55 | Unlike an FIR-based Hilbert transformer, the output of <emphasis>hilbert</emphasis> does not have a linear phase response. However, the IIR structure used in <emphasis>hilbert</emphasis> is far more efficient to compute, and the nonlinear phase response can be used in the creation of interesting audio effects, as in the second example below. |
| 56 | </para> |
| 57 | </refsect1> |
| 58 | |
| 59 | |
| 60 | <refsect1> |
| 61 | <title>Examples</title> |
| 62 | <para> |
| 63 | The first example implements frequency shifting, or single sideband amplitude modulation. Frequency shifting is similar to ring modulation, except the upper and lower sidebands are separated into individual outputs. By using only one of the outputs, the input signal can be "detuned," where the harmonic components of the signal are shifted out of harmonic alignment with each other, e.g. a signal with harmonics at 100, 200, 300, 400 and 500 Hz, shifted up by 50 Hz, will have harmonics at 150, 250, 350, 450, and 550 Hz. |
| 64 | </para> |
| 65 | |
| 66 | <para> |
| 67 | Here is the first example of the hilbert opcode. It uses the file <ulink url="examples/hilbert.csd"><citetitle>hilbert.csd</citetitle></ulink>, and <ulink url="examples/drumsMlp.wav"><citetitle>drumsMlp.wav</citetitle></ulink>. |
| 68 | |
| 69 | <example> |
| 70 | <title>Example of the hilbert opcode implementing frequency shifting.</title> |
| 71 | |
| 72 | <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> |
| 73 | <xi:include href="examples-xml/hilbert.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 74 | </example> |
| 75 | </para> |
| 76 | |
| 77 | <para> |
| 78 | The second example is a variation of the first, but with the output being fed back into the input. With very small shift amounts (i.e. between 0 and +-6 Hz), the result is a sound that has been described as a <quote>barberpole phaser</quote> or <quote>Shepard tone phase shifter.</quote> Several notches appear in the spectrum, and are constantly swept in the direction opposite that of the shift, producing a filtering effect that is reminiscent of Risset's <quote>endless glissando</quote>. |
| 79 | </para> |
| 80 | |
| 81 | <para> |
| 82 | Here is the second example of the hilbert opcode. It uses the file <ulink url="examples/hilbert_barberpole.csd"><citetitle>hilbert_barberpole.csd</citetitle></ulink>. |
| 83 | |
| 84 | <example> |
| 85 | <title>Example of the hilbert opcode sounding like a <quote>barberpole phaser</quote>.</title> |
| 86 | |
| 87 | <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> |
| 88 | <xi:include href="examples-xml/hilbert_barberpole.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 89 | </example> |
| 90 | </para> |
| 91 | </refsect1> |
| 92 | |
| 93 | <refsect1> |
| 94 | <title>See also</title> |
| 95 | <para><link linkend="SigmodSpeciali"><citetitle>Specialized Filters: Other filters</citetitle></link></para> |
| 96 | </refsect1> |
| 97 | |
| 98 | <refsect1> |
| 99 | <title>Technical History</title> |
| 100 | <para> |
| 101 | The use of phase-difference networks in frequency shifters was pioneered by Harald Bode<superscript>1</superscript>. Bode and Bob Moog provide an excellent description of the implementation and use of a frequency shifter in the analog realm in <superscript>2</superscript>; this would be an excellent first source for those that wish to explore the possibilities of single sideband modulation. Bernie Hutchins provides more applications of the frequency shifter, as well as a detailed technical analysis<superscript>3</superscript>. A recent paper by Scott Wardle<superscript>4</superscript> describes a digital implementation of a frequency shifter, as well as some unique applications. |
| 102 | </para> |
| 103 | </refsect1> |
| 104 | |
| 105 | <refsect1> |
| 106 | <title>References</title> |
| 107 | <para> |
| 108 | <orderedlist> |
| 109 | <listitem> |
| 110 | <para> |
| 111 | H. Bode, "Solid State Audio Frequency Spectrum Shifter." AES Preprint No. 395 (1965). |
| 112 | </para> |
| 113 | </listitem> |
| 114 | |
| 115 | <listitem> |
| 116 | <para> |
| 117 | H. Bode and R.A. Moog, "A High-Accuracy Frequency Shfiter for Professional Audio Applications." <emphasis>Journal of the Audio Engineering Society</emphasis>, July/August 1972, vol. 20, no. 6, p. 453. |
| 118 | </para> |
| 119 | </listitem> |
| 120 | |
| 121 | <listitem> |
| 122 | <para> |
| 123 | B. Hutchins. <emphasis>Musical Engineer's Handbook</emphasis> (Ithaca, NY: Electronotes, 1975), ch. 6a. |
| 124 | </para> |
| 125 | </listitem> |
| 126 | |
| 127 | <listitem> |
| 128 | <para> |
| 129 | S. Wardle, "A Hilbert-Transformer Frequency Shifter for Audio." Available online at <ulink url="http://www.iua.upf.es/dafx98/papers/"><citetitle>http://www.iua.upf.es/dafx98/papers/</citetitle></ulink>. |
| 130 | </para> |
| 131 | </listitem> |
| 132 | </orderedlist> |
| 133 | </para> |
| 134 | </refsect1> |
| 135 | |
| 136 | <refsect1> |
| 137 | <title>Credits</title> |
| 138 | <para> |
| 139 | <simplelist> |
| 140 | <member>Author: &namesean;</member> |
| 141 | <member>Seattle, Washington</member> |
| 142 | <member>1999</member> |
| 143 | </simplelist> |
| 144 | </para> |
| 145 | |
| 146 | <para>New in Csound version 3.55</para> |
| 147 | <para>The examples were updated April 2002. Thanks go to &namesean; for fixing the barberpole example.</para> |
| 148 | </refsect1> |
| 149 | </refentry> |