| @@ -1113,25 +1113,47 @@ The actual packets are taken | |||
| }); | |||
| </script> | |||
| <script type="text/x-red" data-help-name="AudioEffectChorus"> | |||
| <h3>Summary</h3> | |||
| <p>description</p> | |||
| <h3>Summary</h3> | |||
| <p>The chorus effect simulates the richness of several nearly-identical | |||
| sound sources (like the way a choir sounds different to a single singer). | |||
| 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 | |||
| 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 | |||
| 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 | |||
| the delay line.</p> | |||
| <p>For two voices the effect can be represented as:<br/> | |||
| result = (sample(0) + sample(dt))/2<br/> | |||
| where sample(0) represents the current sample and sample(dt) | |||
| is the sample in the delay line from dt milliseconds ago.</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></td><td></td></tr> | |||
| <tr class="top"><th>Port</th><th>Purpose</th></tr> | |||
| <tr class="odd"><td align="center">In 0</td><td>Signal Input</td></tr> | |||
| <tr class="odd"><td align="center">Out 0</td><td>Chorused Output</td></tr> | |||
| </table> | |||
| <h3>Functions</h3> | |||
| <p class=func><span class=keyword>begin</span>(delayBuffer, length, n_chorus);</p> | |||
| <p class=desc>blah blah blah blah | |||
| <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 | |||
| 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 | |||
| specify 1 if you want). | |||
| </p> | |||
| <p class=func><span class=keyword>stop</span>();</p> | |||
| <p class=desc>blah blah blah blah | |||
| <p class=desc>Stops the chorus effect. Audio is still passed through. To restart, | |||
| call begin (you must re-specify the chorus parameters). | |||
| </p> | |||
| <p class=func><span class=keyword>modify</span>(n_chorus);</p> | |||
| <p class=desc>blah blah blah blah | |||
| <p class=desc>Alters the number of voices in a running chorus (previously started with begin). | |||
| </p> | |||
| <h3>Notes</h3> | |||
| <p></p> | |||
| <p>The longer the length of the chorus, the more memory blocks are used.</p> | |||
| </script> | |||
| <script type="text/x-red" data-template-name="AudioEffectChorus"> | |||
| <div class="form-row"> | |||
| @@ -1152,25 +1174,58 @@ The actual packets are taken | |||
| }); | |||
| </script> | |||
| <script type="text/x-red" data-help-name="AudioEffectFlange"> | |||
| <h3>Summary</h3> | |||
| <p>description</p> | |||
| <h3>Summary</h3> | |||
| <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 | |||
| 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 | |||
| in the audio spectrum.</p> | |||
| <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> | |||
| <p>The effect can be represented as:<br> | |||
| 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 | |||
| frequency of the effect, Fe. Typically a low frequency (a few Hertz) is used. | |||
| <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></td><td></td></tr> | |||
| <tr class="top"><th>Port</th><th>Purpose</th></tr> | |||
| <tr class="odd"><td align="center">In 0</td><td>Signal Input</td></tr> | |||
| <tr class="odd"><td align="center">Out 0</td><td>Flanged Output</td></tr> | |||
| </table> | |||
| <h3>Functions</h3> | |||
| <p class=func><span class=keyword>begin</span>(delayBuffer, length, offset, depth, delayRate);</p> | |||
| <p class=desc>blah blah blah blah | |||
| <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 | |||
| 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 | |||
| frequency, in Hertz. | |||
| </p> | |||
| <p class=func><span class=keyword>modify</span>(offset, depth, delayRate);</p> | |||
| <p class=desc>blah blah blah blah | |||
| <p class=desc>Alters the parameters in a running flanger (previously started with begin). | |||
| </p> | |||
| <p class=func><span class=keyword>stop</span>();</p> | |||
| <p class=desc>blah blah blah blah | |||
| <p class=desc>Stops the flanging effect. Audio is still passed through. To restart, | |||
| call begin (you must re-specify the flanger parameters). | |||
| </p> | |||
| <h3>Notes</h3> | |||
| <p></p> | |||
| <p>The longer the length of the delay buffer, the more memory blocks are used.</p> | |||
| <p>Try these settings:<br> | |||
| #define FLANGE_DELAY_LENGTH (2*AUDIO_BLOCK_SAMPLES)<br> | |||
| and<br> | |||
| int s_idx = 2*FLANGE_DELAY_LENGTH/4;<br> | |||
| int s_depth = FLANGE_DELAY_LENGTH/4;<br> | |||
| double s_freq = 3;</p> | |||
| <p>The flange effect can also produce a chorus-like effect if a longer | |||
| delay line is used with a slower modulation rate, for example try:<br> | |||
| #define FLANGE_DELAY_LENGTH (12*AUDIO_BLOCK_SAMPLES)<br> | |||
| and<br> | |||
| int s_idx = 3*FLANGE_DELAY_LENGTH/4;<br> | |||
| int s_depth = FLANGE_DELAY_LENGTH/8;<br> | |||
| double s_freq = .0625;</p> | |||
| </script> | |||
| <script type="text/x-red" data-template-name="AudioEffectFlange"> | |||
| <div class="form-row"> | |||