| </script> | </script> | ||||
| <script type="text/javascript"> | |||||
| RED.nodes.registerType('AudioInputI2Sslave',{ | |||||
| shortName: "i2ss", | |||||
| inputs:0, | |||||
| outputs:2, | |||||
| category: 'input-function', | |||||
| color:"#E6E0F8", | |||||
| icon: "arrow-in.png" | |||||
| }); | |||||
| </script> | |||||
| <script type="text/x-red" data-help-name="AudioInputI2Sslave"> | |||||
| <h3>Summary</h3> | |||||
| <p>Receive 16 bit stereo audio from an I2S device using I2S slave mode.</p> | |||||
| <h3>Audio Connections</h3> | |||||
| <table class=doc align=center cellpadding=3> | |||||
| <tr class=top><th>Port</th><th>Purpose</th></tr> | |||||
| <tr class=odd><td align=center>Out 0</td><td>Left Channel</td></tr> | |||||
| <tr class=odd><td align=center>Out 1</td><td>Right Channel</td></tr> | |||||
| </table> | |||||
| <h3>Functions</h3> | |||||
| <p>This object has no functions to call from the Arduino sketch. It | |||||
| simply streams data from the I2S hardware to its 2 output ports.</p> | |||||
| <h3>Hardware</h3> | |||||
| <p>The I2S signals are used in "slave" mode, where the I2S device controls | |||||
| data timing.</p> | |||||
| <table class=doc align=center cellpadding=3> | |||||
| <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr> | |||||
| <tr class=odd><td align=center>9</td><td>BCLK</td><td>Input</td></tr> | |||||
| <tr class=odd><td align=center>13</td><td>RX</td><td>Input</td></tr> | |||||
| <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Input</td></tr> | |||||
| </table> | |||||
| <!--<h3>Examples</h3> | |||||
| <p class=exam>File > Examples > Audio > | |||||
| </p>--> | |||||
| <h3>Notes</h3> | |||||
| <p>Slave mode I2S <b>should not used in the same project as ADC, DAC and | |||||
| PWM</b> signals. Differences in timing between the I2S device and | |||||
| Teensy's clock can cause occasional audio glitches when I2S slave mode | |||||
| is used together with other input or output objects based on Teensy's | |||||
| timing.</p> | |||||
| <p>Only one I2S input and one I2S output object may be used. Master | |||||
| and slave modes may not be mixed (both must be of the same type). | |||||
| </p> | |||||
| </script> | |||||
| <script type="text/x-red" data-template-name="AudioInputI2Sslave"> | |||||
| <div class="form-row"> | |||||
| <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> | |||||
| <input type="text" id="node-input-name" placeholder="Name"> | |||||
| </div> | |||||
| </script> | |||||
| <script type="text/javascript"> | <script type="text/javascript"> | ||||
| RED.nodes.registerType('AudioInputAnalog',{ | RED.nodes.registerType('AudioInputAnalog',{ | ||||
| shortName: "adc", | shortName: "adc", | ||||
| </script> | </script> | ||||
| <script type="text/javascript"> | |||||
| RED.nodes.registerType('AudioInputI2Sslave',{ | |||||
| shortName: "i2ss", | |||||
| inputs:0, | |||||
| outputs:2, | |||||
| category: 'input-function', | |||||
| color:"#E6E0F8", | |||||
| icon: "arrow-in.png" | |||||
| }); | |||||
| </script> | |||||
| <script type="text/x-red" data-help-name="AudioInputI2Sslave"> | |||||
| <h3>Summary</h3> | |||||
| <p>Receive 16 bit stereo audio from an I2S device using I2S slave mode.</p> | |||||
| <h3>Audio Connections</h3> | |||||
| <table class=doc align=center cellpadding=3> | |||||
| <tr class=top><th>Port</th><th>Purpose</th></tr> | |||||
| <tr class=odd><td align=center>Out 0</td><td>Left Channel</td></tr> | |||||
| <tr class=odd><td align=center>Out 1</td><td>Right Channel</td></tr> | |||||
| </table> | |||||
| <h3>Functions</h3> | |||||
| <p>This object has no functions to call from the Arduino sketch. It | |||||
| simply streams data from the I2S hardware to its 2 output ports.</p> | |||||
| <h3>Hardware</h3> | |||||
| <p>The I2S signals are used in "slave" mode, where the I2S device controls | |||||
| data timing.</p> | |||||
| <table class=doc align=center cellpadding=3> | |||||
| <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr> | |||||
| <tr class=odd><td align=center>9</td><td>BCLK</td><td>Input</td></tr> | |||||
| <tr class=odd><td align=center>13</td><td>RX</td><td>Input</td></tr> | |||||
| <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Input</td></tr> | |||||
| </table> | |||||
| <!--<h3>Examples</h3> | |||||
| <p class=exam>File > Examples > Audio > | |||||
| </p>--> | |||||
| <h3>Notes</h3> | |||||
| <p>Slave mode I2S <b>should not used in the same project as ADC, DAC and | |||||
| PWM</b> signals. Differences in timing between the I2S device and | |||||
| Teensy's clock can cause occasional audio glitches when I2S slave mode | |||||
| is used together with other input or output objects based on Teensy's | |||||
| timing.</p> | |||||
| <p>Only one I2S input and one I2S output object may be used. Master | |||||
| and slave modes may not be mixed (both must be of the same type). | |||||
| </p> | |||||
| </script> | |||||
| <script type="text/x-red" data-template-name="AudioInputI2Sslave"> | |||||
| <div class="form-row"> | |||||
| <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> | |||||
| <input type="text" id="node-input-name" placeholder="Name"> | |||||
| </div> | |||||
| </script> | |||||
| <script type="text/javascript"> | <script type="text/javascript"> | ||||
| RED.nodes.registerType('AudioOutputI2S',{ | RED.nodes.registerType('AudioOutputI2S',{ | ||||
| </script> | </script> | ||||
| <script type="text/javascript"> | <script type="text/javascript"> | ||||
| RED.nodes.registerType('AudioOutputI2Sslave',{ | |||||
| shortName: "i2ss", | |||||
| RED.nodes.registerType('AudioOutputSPDIF',{ | |||||
| shortName: "spdif", | |||||
| inputs:2, | inputs:2, | ||||
| outputs:0, | outputs:0, | ||||
| category: 'output-function', | category: 'output-function', | ||||
| icon: "arrow-in.png" | icon: "arrow-in.png" | ||||
| }); | }); | ||||
| </script> | </script> | ||||
| <script type="text/x-red" data-help-name="AudioOutputI2Sslave"> | |||||
| <script type="text/x-red" data-help-name="AudioOutputSPDIF"> | |||||
| <h3>Summary</h3> | <h3>Summary</h3> | ||||
| <p>Transmit 16 bit stereo audio to an I2S device using I2S slave mode.</p> | |||||
| <p>Transmit 16 bit stereo audio as Digital S/PDIF.</p> | |||||
| <p align=center><img src="spdif_proto.jpg"></p> | |||||
| <h3>Audio Connections</h3> | <h3>Audio Connections</h3> | ||||
| <table class=doc align=center cellpadding=3> | <table class=doc align=center cellpadding=3> | ||||
| <tr class=top><th>Port</th><th>Purpose</th></tr> | <tr class=top><th>Port</th><th>Purpose</th></tr> | ||||
| </table> | </table> | ||||
| <h3>Functions</h3> | <h3>Functions</h3> | ||||
| <p>This object has no functions to call from the Arduino sketch. It | <p>This object has no functions to call from the Arduino sketch. It | ||||
| simply streams data from its 2 input ports to the I2S hardware.</p> | |||||
| simply streams data from its 2 input ports S/PDIF encoded digital | |||||
| audio on pin 22.</p> | |||||
| <h3>Hardware</h3> | <h3>Hardware</h3> | ||||
| <p>The I2S signals are used in "slave" mode, where the I2S device controls | |||||
| data timing.</p> | |||||
| <p>The S/PDIF output signal can be used to drive an optical TOSLINK | |||||
| cable, or a standard (usually orange) RCA jack.</p> | |||||
| <table class=doc align=center cellpadding=3> | <table class=doc align=center cellpadding=3> | ||||
| <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr> | <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr> | ||||
| <tr class=odd><td align=center>9</td><td>BCLK</td><td>Input</td></tr> | |||||
| <tr class=odd><td align=center>22</td><td>TX</td><td>Output</td></tr> | |||||
| <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Input</td></tr> | |||||
| <tr class=odd><td align=center>22</td><td>S/PDIF</td><td>Output</td></tr> | |||||
| </table> | </table> | ||||
| <p>For optical TOSLINK output, this | |||||
| <a href="https://www.oshpark.com/shared_projects/KcDBKHta" target="_blank">OSH Park board</a> | |||||
| can be used with the inexpensive Everlight PLT133/T6A connector, available | |||||
| at Digikey, 1080-1434-ND. | |||||
| </p> | |||||
| <h3>Examples</h3> | <h3>Examples</h3> | ||||
| <p class=exam>File > Examples > Audio > HardwareTesting > WM8731MikroSine | |||||
| <p>The AudioOutputSPDIF object can be used in place of the AudioOutputI2S object, | |||||
| <p>used in nearly all the examples. The WavFilePlayer shows how to substitute | |||||
| output objects for different hardware types. | |||||
| </p> | |||||
| <p class=exam>File > Examples > Audio > WavFilePlayer | |||||
| </p> | </p> | ||||
| <h3>Credits</h3> | |||||
| <p><a href="https://github.com/FrankBoesing" target="_blank">Frank Boesing</a> | |||||
| developed the AudioOutputSPDIF code. The original | |||||
| <a href="https://forum.pjrc.com/threads/28639-S-pdif" target="_blank">forum disussion</a> | |||||
| included valuable input and code from "kpc". | |||||
| <h3>Notes</h3> | <h3>Notes</h3> | ||||
| <p>Slave mode I2S <b>should not used in the same project as ADC, DAC and | |||||
| PWM</b> signals. Differences in timing between the I2S device and | |||||
| Teensy's clock can cause occasional audio glitches when I2S slave mode | |||||
| is used together with other input or output objects based on Teensy's | |||||
| timing.</p> | |||||
| <p>Only one I2S input and one I2S output object may be used. Master | |||||
| and slave modes may not be mixed (both must be of the same type). | |||||
| <p>S/PDIF output uses the I2S hardware. This object can not be used | |||||
| together with any of the I2S objects, because it requires the I2S | |||||
| hardware with different internal settings.</p> | |||||
| </p> | </p> | ||||
| </script> | </script> | ||||
| <script type="text/x-red" data-template-name="AudioOutputI2Sslave"> | |||||
| <script type="text/x-red" data-template-name="AudioOutputI2S"> | |||||
| <div class="form-row"> | <div class="form-row"> | ||||
| <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> | <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> | ||||
| <input type="text" id="node-input-name" placeholder="Name"> | <input type="text" id="node-input-name" placeholder="Name"> | ||||
| </script> | </script> | ||||
| <script type="text/javascript"> | <script type="text/javascript"> | ||||
| RED.nodes.registerType('AudioOutputAnalog',{ | RED.nodes.registerType('AudioOutputAnalog',{ | ||||
| shortName: "dac", | shortName: "dac", | ||||
| </script> | </script> | ||||
| <script type="text/javascript"> | |||||
| RED.nodes.registerType('AudioOutputI2Sslave',{ | |||||
| shortName: "i2ss", | |||||
| inputs:2, | |||||
| outputs:0, | |||||
| category: 'output-function', | |||||
| color:"#E6E0F8", | |||||
| icon: "arrow-in.png" | |||||
| }); | |||||
| </script> | |||||
| <script type="text/x-red" data-help-name="AudioOutputI2Sslave"> | |||||
| <h3>Summary</h3> | |||||
| <p>Transmit 16 bit stereo audio to an I2S device using I2S slave mode.</p> | |||||
| <h3>Audio Connections</h3> | |||||
| <table class=doc align=center cellpadding=3> | |||||
| <tr class=top><th>Port</th><th>Purpose</th></tr> | |||||
| <tr class=odd><td align=center>In 0</td><td>Left Channel</td></tr> | |||||
| <tr class=odd><td align=center>In 1</td><td>Right Channel</td></tr> | |||||
| </table> | |||||
| <h3>Functions</h3> | |||||
| <p>This object has no functions to call from the Arduino sketch. It | |||||
| simply streams data from its 2 input ports to the I2S hardware.</p> | |||||
| <h3>Hardware</h3> | |||||
| <p>The I2S signals are used in "slave" mode, where the I2S device controls | |||||
| data timing.</p> | |||||
| <table class=doc align=center cellpadding=3> | |||||
| <tr class=top><th>Pin</th><th>Signal</th><th>Direction</th></tr> | |||||
| <tr class=odd><td align=center>9</td><td>BCLK</td><td>Input</td></tr> | |||||
| <tr class=odd><td align=center>22</td><td>TX</td><td>Output</td></tr> | |||||
| <tr class=odd><td align=center>23</td><td>LRCLK</td><td>Input</td></tr> | |||||
| </table> | |||||
| <h3>Examples</h3> | |||||
| <p class=exam>File > Examples > Audio > HardwareTesting > WM8731MikroSine | |||||
| </p> | |||||
| <h3>Notes</h3> | |||||
| <p>Slave mode I2S <b>should not used in the same project as ADC, DAC and | |||||
| PWM</b> signals. Differences in timing between the I2S device and | |||||
| Teensy's clock can cause occasional audio glitches when I2S slave mode | |||||
| is used together with other input or output objects based on Teensy's | |||||
| timing.</p> | |||||
| <p>Only one I2S input and one I2S output object may be used. Master | |||||
| and slave modes may not be mixed (both must be of the same type). | |||||
| </p> | |||||
| </script> | |||||
| <script type="text/x-red" data-template-name="AudioOutputI2Sslave"> | |||||
| <div class="form-row"> | |||||
| <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> | |||||
| <input type="text" id="node-input-name" placeholder="Name"> | |||||
| </div> | |||||
| </script> | |||||
| <script type="text/javascript"> | <script type="text/javascript"> | ||||
| RED.nodes.registerType('AudioMixer4',{ | RED.nodes.registerType('AudioMixer4',{ | ||||
| shortName: "mixer", | shortName: "mixer", | ||||
| It does this by sampling from a delay line, so each voice is actually | It does this by sampling from a delay line, so each voice is actually | ||||
| the same but at a slightly different point in time. This is a type of | the same but at a slightly different point in time. This is a type of | ||||
| comb filtering.</p> | comb filtering.</p> | ||||
| <p>Chorus combines one or more samples ranging from the most recent | |||||
| sample back to about 50ms ago. The additional samples are evenly spread | |||||
| <p>Chorus combines one or more samples ranging from the most recent | |||||
| sample back to about 50ms ago. The additional samples are evenly spread | |||||
| through the supplied delay line, and there is no modulation.</p> | through the supplied delay line, and there is no modulation.</p> | ||||
| <p>If the number of voices is specified as 2, then the | |||||
| effect combines the current sample and the oldest sample (the last one | |||||
| in the delay line). If the number of voices is 3 then the effect combines | |||||
| the most recent sample, the oldest sample and the sample in the middle of | |||||
| <p>If the number of voices is specified as 2, then the | |||||
| effect combines the current sample and the oldest sample (the last one | |||||
| in the delay line). If the number of voices is 3 then the effect combines | |||||
| the most recent sample, the oldest sample and the sample in the middle of | |||||
| the delay line.</p> | the delay line.</p> | ||||
| <p>For two voices the effect can be represented as:<br/> | <p>For two voices the effect can be represented as:<br/> | ||||
| result = (sample(0) + sample(dt))/2<br/> | result = (sample(0) + sample(dt))/2<br/> | ||||
| where sample(0) represents the current sample and sample(dt) | |||||
| where sample(0) represents the current sample and sample(dt) | |||||
| is the sample in the delay line from dt milliseconds ago.</p> | is the sample in the delay line from dt milliseconds ago.</p> | ||||
| <h3>Audio Connections</h3> | <h3>Audio Connections</h3> | ||||
| <table class=doc align=center cellpadding=3> | <table class=doc align=center cellpadding=3> | ||||
| <h3>Functions</h3> | <h3>Functions</h3> | ||||
| <p class=func><span class=keyword>begin</span>(delayBuffer, length, n_chorus);</p> | <p class=func><span class=keyword>begin</span>(delayBuffer, length, n_chorus);</p> | ||||
| <p class=desc>Create a chorus by specifying the address of the delayline, the | <p class=desc>Create a chorus by specifying the address of the delayline, the | ||||
| total number of samples in the delay line (often done as an integer multiple of | |||||
| total number of samples in the delay line (often done as an integer multiple of | |||||
| AUDIO_BLOCK_SAMPLES) and the number of voices in the chorus <em>including</em> | AUDIO_BLOCK_SAMPLES) and the number of voices in the chorus <em>including</em> | ||||
| the original voice (so, 2 and up to get a chorus effect, although you can | |||||
| the original voice (so, 2 and up to get a chorus effect, although you can | |||||
| specify 1 if you want). | specify 1 if you want). | ||||
| </p> | </p> | ||||
| <p class=func><span class=keyword>modify</span>(n_chorus);</p> | <p class=func><span class=keyword>modify</span>(n_chorus);</p> | ||||
| </script> | </script> | ||||
| <script type="text/x-red" data-help-name="AudioEffectFlange"> | <script type="text/x-red" data-help-name="AudioEffectFlange"> | ||||
| <h3>Summary</h3> | <h3>Summary</h3> | ||||
| <p>Originally, flanging was produced by playing the same signal on two synchronized | |||||
| <p>Originally, flanging was produced by playing the same signal on two synchronized | |||||
| reel-to-reel tape recorders and making one of the reels slow down and speed up by | reel-to-reel tape recorders and making one of the reels slow down and speed up by | ||||
| pressing on the flange of the reel (hence the name). This is a type of | pressing on the flange of the reel (hence the name). This is a type of | ||||
| comb filtering, and produces a harmonically-related series of peaks and notches | |||||
| comb filtering, and produces a harmonically-related series of peaks and notches | |||||
| in the audio spectrum.</p> | in the audio spectrum.</p> | ||||
| <p>This flanger uses a delay line, combining the original voice with only one sample from the delay | |||||
| <p>This flanger uses a delay line, combining the original voice with only one sample from the delay | |||||
| line, but the position of that sample varies sinusoidally.</p> | line, but the position of that sample varies sinusoidally.</p> | ||||
| <p>The effect can be represented as:<br> | <p>The effect can be represented as:<br> | ||||
| result = sample(0) + sample(dt + depth*sin(2*PI*Fe))</p> | result = sample(0) + sample(dt + depth*sin(2*PI*Fe))</p> | ||||
| <p>The value of the sine function is always a number from -1 to +1 and | |||||
| so the result of depth*(sin(Fe)) is always a number from -depth to +depth. | |||||
| Thus, the delayed sample will be selected from the range (dt-depth) to | |||||
| (dt+depth). This selection will vary at whatever rate is specified as the | |||||
| <p>The value of the sine function is always a number from -1 to +1 and | |||||
| so the result of depth*(sin(Fe)) is always a number from -depth to +depth. | |||||
| Thus, the delayed sample will be selected from the range (dt-depth) to | |||||
| (dt+depth). This selection will vary at whatever rate is specified as the | |||||
| frequency of the effect, Fe. Typically a low frequency (a few Hertz) is used. | frequency of the effect, Fe. Typically a low frequency (a few Hertz) is used. | ||||
| <h3>Audio Connections</h3> | <h3>Audio Connections</h3> | ||||
| <table class=doc align=center cellpadding=3> | <table class=doc align=center cellpadding=3> | ||||
| <h3>Functions</h3> | <h3>Functions</h3> | ||||
| <p class=func><span class=keyword>begin</span>(delayBuffer, length, offset, depth, delayRate);</p> | <p class=func><span class=keyword>begin</span>(delayBuffer, length, offset, depth, delayRate);</p> | ||||
| <p class=desc>Create a flanger by specifying the address of the delayline, the | <p class=desc>Create a flanger by specifying the address of the delayline, the | ||||
| total number of samples in the delay line (often done as an integer multiple of | |||||
| total number of samples in the delay line (often done as an integer multiple of | |||||
| AUDIO_BLOCK_SAMPLES), the offset (how far back the flanged sample is from the original voice), | AUDIO_BLOCK_SAMPLES), the offset (how far back the flanged sample is from the original voice), | ||||
| the modulation depth (larger values give a greater variation) and the modulation | the modulation depth (larger values give a greater variation) and the modulation | ||||
| frequency, in Hertz. | frequency, in Hertz. | ||||
| changes the analog gain in the headphone amplifier. This function | changes the analog gain in the headphone amplifier. This function | ||||
| on the other hand controls digital attenuation before conversion to analog, which | on the other hand controls digital attenuation before conversion to analog, which | ||||
| reduces resolution, but allows another fine control of output | reduces resolution, but allows another fine control of output | ||||
| signal level. The ranges is 0 to 1.0, with the default (no digital attenuation) | |||||
| signal level. The ranges is 0 to 1.0, with the default (no digital attenuation) | |||||
| at 1.0. | at 1.0. | ||||
| </p> | </p> | ||||
| <p class=desc>dacVolume uses zero-crossing detect to avoid clicks, and ramping is handled by | |||||
| <p class=desc>dacVolume uses zero-crossing detect to avoid clicks, and ramping is handled by | |||||
| the chip so that a new volume may be set directly in a single call. | the chip so that a new volume may be set directly in a single call. | ||||
| </p> | </p> | ||||
| <p class=func><span class=keyword>dacVolume</span>(left, right);</p> | <p class=func><span class=keyword>dacVolume</span>(left, right);</p> | ||||
| <h3>Audio Processor</h3> | <h3>Audio Processor</h3> | ||||
| <p>The optional digital audio processor is capable of implementing | |||||
| <p>The optional digital audio processor is capable of implementing | |||||
| one or more of: automatic volume control, surround sound control, | one or more of: automatic volume control, surround sound control, | ||||
| bass enhancement, and tonal adjustments (either a | bass enhancement, and tonal adjustments (either a | ||||
| simple tone control, or a parametric equalizer, or a graphic equalizer), | simple tone control, or a parametric equalizer, or a graphic equalizer), | ||||
| in that order. | in that order. | ||||
| </p> | </p> | ||||
| <p>These signal processing features are implemented in the SGTL5000 chip, | <p>These signal processing features are implemented in the SGTL5000 chip, | ||||
| so they do not consume CPU time on Teensy. However, the order of | |||||
| so they do not consume CPU time on Teensy. However, the order of | |||||
| these processes is fixed in the hardware. | these processes is fixed in the hardware. | ||||
| </p> | </p> | ||||
| <p>It is good practice to mute the outputs before enabling or disabling | |||||
| <p>It is good practice to mute the outputs before enabling or disabling | |||||
| the Audio Processor, to avoid clicks or thumps. | the Audio Processor, to avoid clicks or thumps. | ||||
| </p> | </p> | ||||
| four values: 0 (0ms), 1 (25ms), 2 (50ms) or 3 (100ms). Larger values average the volume | four values: 0 (0ms), 1 (25ms), 2 (50ms) or 3 (100ms). Larger values average the volume | ||||
| over a longer time, allowing short-term peaks through. | over a longer time, allowing short-term peaks through. | ||||
| </p> | </p> | ||||
| <p class=desc>If <em>hardLimit</em> is 0, a 'soft | |||||
| knee' compressor is used to progressively compress louder values which are near to or above the | |||||
| threashold (the louder they are, the greater the compression). If it is 1, a hard compressor | |||||
| <p class=desc>If <em>hardLimit</em> is 0, a 'soft | |||||
| knee' compressor is used to progressively compress louder values which are near to or above the | |||||
| threashold (the louder they are, the greater the compression). If it is 1, a hard compressor | |||||
| is used (all values above the threashold are the same loudness). The <em>threashold</em> is specified | is used (all values above the threashold are the same loudness). The <em>threashold</em> is specified | ||||
| as a float in the range 0dBFS to -96dBFS, where -18dBFS is a typical value. | |||||
| <em>attack</em> is a float controlling the rate of decrease in gain when the signal is over | |||||
| as a float in the range 0dBFS to -96dBFS, where -18dBFS is a typical value. | |||||
| <em>attack</em> is a float controlling the rate of decrease in gain when the signal is over | |||||
| threashold, in dB/s. <em>decay</em> controls how fast gain is restored once the level | threashold, in dB/s. <em>decay</em> controls how fast gain is restored once the level | ||||
| drops below threashold, again in dB/s. It is typically set to a longer value than attack. | drops below threashold, again in dB/s. It is typically set to a longer value than attack. | ||||
| </p> | </p> | ||||
| </p> | </p> | ||||
| <p class=func><span class=keyword>surroundSoundEnable</span>();</p> | <p class=func><span class=keyword>surroundSoundEnable</span>();</p> | ||||
| <p class=desc>Enable virtual surround processing, to give a broader and | |||||
| <p class=desc>Enable virtual surround processing, to give a broader and | |||||
| deeper stereo image (even with mono input). | deeper stereo image (even with mono input). | ||||
| </p> | </p> | ||||
| <p class=func><span class=keyword>surroundSoundDisable</span>();</p> | <p class=func><span class=keyword>surroundSoundDisable</span>();</p> | ||||
| <p class=desc>Configures virtual surround width from 0 (mono) to 7 (widest). | <p class=desc>Configures virtual surround width from 0 (mono) to 7 (widest). | ||||
| <em>select</em> may be set to 1 (disable), 2 (mono input) or 3 (stereo input). | <em>select</em> may be set to 1 (disable), 2 (mono input) or 3 (stereo input). | ||||
| </p> | </p> | ||||
| <p class=func><span class=keyword>enhanceBassEnable</span>();</p> | <p class=func><span class=keyword>enhanceBassEnable</span>();</p> | ||||
| <p class=desc>Enable bass enhancement. A mono, low-pass filtered copy of | <p class=desc>Enable bass enhancement. A mono, low-pass filtered copy of | ||||
| the original stereo signal has bass levels boosted and is then mixed back into | the original stereo signal has bass levels boosted and is then mixed back into | ||||
| the stereo signal, which is then optionally high pass filtered (to remove | |||||
| the stereo signal, which is then optionally high pass filtered (to remove | |||||
| inaudible subsonic frequencies). | inaudible subsonic frequencies). | ||||
| </p> | </p> | ||||
| <p class=func><span class=keyword>enhanceBassDisable</span>();</p> | <p class=func><span class=keyword>enhanceBassDisable</span>();</p> | ||||
| <p class=desc>Disable bass enhancement. Before disabling, ramp down the bass | |||||
| <p class=desc>Disable bass enhancement. Before disabling, ramp down the bass | |||||
| enhancement level to zero. | enhancement level to zero. | ||||
| </p> | </p> | ||||
| <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev);</p> | <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev);</p> | ||||
| <p class=desc>Configures the bass enhancement by setting the levels of the | |||||
| <p class=desc>Configures the bass enhancement by setting the levels of the | |||||
| original stereo signal and the bass-enhanced mono level which will be mixed together. | original stereo signal and the bass-enhanced mono level which will be mixed together. | ||||
| There is no high-pass filter. | There is no high-pass filter. | ||||
| </p> | </p> | ||||
| <p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in | |||||
| <p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in | |||||
| steps of 0.5dB, to avoid pops. | steps of 0.5dB, to avoid pops. | ||||
| </p> | </p> | ||||
| <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev, hpf_bypass, cutoff);</p> | <p class=func><span class=keyword>enhanceBass</span>(lr_lev, bass_lev, hpf_bypass, cutoff);</p> | ||||
| <p class=desc>Configures the bass enhancement by setting the levels of the | |||||
| <p class=desc>Configures the bass enhancement by setting the levels of the | |||||
| original stereo signal and the bass-enhanced mono level which will be mixed together. | original stereo signal and the bass-enhanced mono level which will be mixed together. | ||||
| The high-pass filter may be enabled (0) or bypassed (1). The cutoff frequency is specified | The high-pass filter may be enabled (0) or bypassed (1). The cutoff frequency is specified | ||||
| as follows: | as follows: | ||||
| 5 200Hz | 5 200Hz | ||||
| 6 225Hz | 6 225Hz | ||||
| </pre> | </pre> | ||||
| <p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in | |||||
| <p class=desc>When changing bass level, call this function repeatedly to ramp up or down the bass in | |||||
| steps of 0.5dB, to avoid pops. | steps of 0.5dB, to avoid pops. | ||||
| </p> | </p> | ||||
| <p class=func><span class=keyword>eqSelect</span>(n);</p> | <p class=func><span class=keyword>eqSelect</span>(n);</p> | ||||
| <p class=desc>Selects the type of frequency control, where <em>n</em> is | |||||
| <p class=desc>Selects the type of frequency control, where <em>n</em> is | |||||
| one of</p> | one of</p> | ||||
| <p class=desc><b>FLAT_FREQUENCY (0)</b><br> | <p class=desc><b>FLAT_FREQUENCY (0)</b><br> | ||||
| Equalizers and tone controls disabled, flat frequency response.</p> | Equalizers and tone controls disabled, flat frequency response.</p> | ||||
| <p class=desc><b>PARAMETRIC_EQUALIZER (1)</b><br> | <p class=desc><b>PARAMETRIC_EQUALIZER (1)</b><br> | ||||
| Enables the 7-band parametric equalizer, thus disabling the | |||||
| Enables the 7-band parametric equalizer, thus disabling the | |||||
| tone controls and graphic equalizer.</p> | tone controls and graphic equalizer.</p> | ||||
| <p class=desc><b>TONE_CONTROLS (2)</b><br> | <p class=desc><b>TONE_CONTROLS (2)</b><br> | ||||
| Enables bass and treble tone controls, disabling the parametric | |||||
| Enables bass and treble tone controls, disabling the parametric | |||||
| equalization and graphic equalizer.</p> | equalization and graphic equalizer.</p> | ||||
| <p class=desc><b>GRAPHIC_EQUALIZER (3)</b><br> | <p class=desc><b>GRAPHIC_EQUALIZER (3)</b><br> | ||||
| Enables the five-band graphic equalizer, disabling the parametric | |||||
| Enables the five-band graphic equalizer, disabling the parametric | |||||
| equalization and tone controls.</p> | equalization and tone controls.</p> | ||||
| <p class=func><span class=keyword>eqBands</span>(bass, treble);</p> | <p class=func><span class=keyword>eqBands</span>(bass, treble);</p> | ||||
| <p class=desc>Configures bass and treble tone controls, which are | <p class=desc>Configures bass and treble tone controls, which are | ||||
| implemented as one second order low pass filter (bass) in parallel with | |||||
| one second order high pass filter (treble). | |||||
| implemented as one second order low pass filter (bass) in parallel with | |||||
| one second order high pass filter (treble). | |||||
| </p> | </p> | ||||
| <p class=desc>When changing bass or treble level, call this function repeatedly to ramp | |||||
| <p class=desc>When changing bass or treble level, call this function repeatedly to ramp | |||||
| up or down the level in steps of 0.04 (=0.5dB) or so, to avoid pops. | up or down the level in steps of 0.04 (=0.5dB) or so, to avoid pops. | ||||
| </p> | </p> | ||||
| <p class=func><span class=keyword>eqBands</span>(bass, mid_bass, midrange, mid_treble, treble);</p> | <p class=func><span class=keyword>eqBands</span>(bass, mid_bass, midrange, mid_treble, treble);</p> | ||||
| <p class=desc>Configures the graphic equalizer. It is implemented by five parallel, | |||||
| second order biquad filters with fixed frequencies of 115Hz, 330Hz, 990Hz, 3kHz, | |||||
| <p class=desc>Configures the graphic equalizer. It is implemented by five parallel, | |||||
| second order biquad filters with fixed frequencies of 115Hz, 330Hz, 990Hz, 3kHz, | |||||
| and 9.9kHz. Each band has a range of adjustment from 1.00 (+12dB) to -1.00 (-11.75dB). | and 9.9kHz. Each band has a range of adjustment from 1.00 (+12dB) to -1.00 (-11.75dB). | ||||
| </p> | </p> | ||||
| <p class=func><span class=keyword>eqBand</span>(bandNum, n);</p> | <p class=func><span class=keyword>eqBand</span>(bandNum, n);</p> | ||||
| <p class=desc>When changing a band, call this function repeatedly to ramp up the gain in steps of 0.5dB, | <p class=desc>When changing a band, call this function repeatedly to ramp up the gain in steps of 0.5dB, | ||||
| to avoid pops. | to avoid pops. | ||||
| </p> | </p> | ||||
| <p class=func><span class=keyword>eqFilter</span>(filterNum, filterParameters);</p> | <p class=func><span class=keyword>eqFilter</span>(filterNum, filterParameters);</p> | ||||
| <p class=desc>Configurs the parametric equalizer. The number of filters (1 to 7) | |||||
| is specified along with a pointer to an array of filter coefficients. | |||||
| The parametric equalizer is implemented using 7 cascaded, second order bi-quad | |||||
| filters whose frequencies, gain, and Q may be freely configured, but each filter | |||||
| <p class=desc>Configurs the parametric equalizer. The number of filters (1 to 7) | |||||
| is specified along with a pointer to an array of filter coefficients. | |||||
| The parametric equalizer is implemented using 7 cascaded, second order bi-quad | |||||
| filters whose frequencies, gain, and Q may be freely configured, but each filter | |||||
| can only be specified as a set of filter coefficients. | can only be specified as a set of filter coefficients. | ||||
| </p> | </p> | ||||
| <p class=func><span class=keyword>eqFilterCount</span>(n);</p> | <p class=func><span class=keyword>eqFilterCount</span>(n);</p> | ||||
| <p class=desc>Enables zero or more of the already enabled parametric filters. | <p class=desc>Enables zero or more of the already enabled parametric filters. | ||||
| </p> | |||||
| </p> | |||||
| <h3>Examples</h3> | <h3>Examples</h3> | ||||
| <p>Nearly all of the library's examples use this object. These | <p>Nearly all of the library's examples use this object. These | ||||
| examples demonstrate its special features. | examples demonstrate its special features. | ||||
| <p class=exam>File > Examples > Audio > HardwareTesting > SGTL5000 > CalcBiquadToneControlDAP | <p class=exam>File > Examples > Audio > HardwareTesting > SGTL5000 > CalcBiquadToneControlDAP | ||||
| </p> | </p> | ||||
| <h3>Notes</h3> | <h3>Notes</h3> | ||||
| <p>TODO: add example with rock/classical/speech presets, where rock uses bass boost | |||||
| <p>TODO: add example with rock/classical/speech presets, where rock uses bass boost | |||||
| and surround enhancement while speech uses bandpass filtering and auto volume control | and surround enhancement while speech uses bandpass filtering and auto volume control | ||||
| compression. | compression. | ||||
| </p> | </p> | ||||
| <h3>Audio Connections</h3> | <h3>Audio Connections</h3> | ||||
| <p>This object has no audio inputs or outputs. Separate i2s objects | <p>This object has no audio inputs or outputs. Separate i2s objects | ||||
| are used to send and receive audio data. I2S master mode objects | are used to send and receive audio data. I2S master mode objects | ||||
| must be used, since this control object configures the WM8731 into | |||||
| must be used, since this control object configures the WM8731 into | |||||
| slave mode. | slave mode. | ||||
| </p> | </p> | ||||
| <h3>Functions</h3> | <h3>Functions</h3> | ||||
| <p class=desc>not implemented | <p class=desc>not implemented | ||||
| </p> | </p> | ||||
| <!--<h3>Examples</h3> | <!--<h3>Examples</h3> | ||||
| <p class=exam>File > Examples > Audio > | |||||
| <p class=exam>File > Examples > Audio > | |||||
| </p>--> | </p>--> | ||||
| <h3>Notes</h3> | <h3>Notes</h3> | ||||
| <p></p> | <p></p> |