Skip to content

Commit

Permalink
helpfile fix, helpfile add
Browse files Browse the repository at this point in the history
  • Loading branch information
danstowell committed May 15, 2012
1 parent c1ad847 commit af7acaa
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 2 deletions.
82 changes: 82 additions & 0 deletions source/MCLDUGens/sc/HelpSource/Classes/PV_MagSmooth.schelp
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
class:: PV_MagSmoth
summary:: Smooth spectral magnitudes over time
categories:: UGens>FFT, UGens>Analysis
related:: PV_MagSmear

Description::

Smooths out the magnitude of FFT bins over time using recursive averaging.

For each bin, the calculation looks like:

mag = (prevmag * factor) + (mag * (1-factor))


classmethods::

method::new

argument::chain
an fft chain

argument::factor
from 0 (no smoothing occurs) to 1 ("infinite" smoothing, magnitudes never change)


Examples::

code::

s.boot;
b = Buffer.alloc(s, 1024);
c = Buffer.read(s, "sounds/a11wlk01.wav");

(
x = {
var son, chain, out;

son = PlayBuf.ar(1, c, loop: 1);

chain = FFT(b, son);
chain = PV_MagSmooth(chain, 1 - MouseX.kr(1, 0.00001, 1));

out = IFFT(chain);

(out * 0.3).dup

}.play;
)
x.free;


// This one subtracts the smoothed version away, to leave just the spiky bits!
// This is a fairly well-known basis of noise-removal by spectral subtraction,
// which works well if the noise is static or slow-changing while the signal
// is fast-changing.
// In this demo, mouse left/right controls the amount of smoothing,
// and when the mousebutton is down you hear the "original"
// (otherwise you hear the "cleaned" version).
d = Buffer.alloc(s, 1024);
(
x = {
var son, chain, chainorig, chainsmooth, out;

son = PlayBuf.ar(1, c, loop: 1);

chain = FFT(b, son);
chainorig = PV_Copy(chain, d);
chainsmooth = PV_MagSmooth(chain, 1 - MouseX.kr(1, 0.00001, 1));
chain = PV_MagSubtract(chainorig, chainsmooth, 1);

out = XFade2.ar(IFFT(chain), son, MouseButton.kr(-1,1));

(out * 0.3).dup

}.play;
)
x.free;


b.free; c.free;
::

4 changes: 2 additions & 2 deletions source/MCLDUGens/sc/HelpSource/Classes/TextVU.schelp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CLASS:: TextVU
summary:: super-efficient sawtooth oscillator with low aliasing
summary:: display level of a UGen as a textual meter
categories:: UGens>Generators
related:: Classes/PulseDPW
related:: Classes/Poll

DESCRIPTION::
This behaves similar to Poll but displays its output as a textual "VU meter" visualisation (ranging from -60 to 0 dB). The class also automatically inserts an Amplitude analysis into the chain (you can modify this by supplying a function to the ana argument). Also, internally it ONLY RUNS AT CONTROL RATE, although it can analyse ar or kr inputs (and passes them back out again).
Expand Down

0 comments on commit af7acaa

Please sign in to comment.