File: Ringz.schelp

package info (click to toggle)
supercollider 1%3A3.11.2%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 71,152 kB
  • sloc: cpp: 387,846; lisp: 80,328; ansic: 76,515; sh: 22,779; python: 7,932; makefile: 2,333; perl: 1,123; javascript: 915; java: 677; xml: 582; yacc: 314; lex: 175; objc: 152; ruby: 136
file content (98 lines) | stat: -rw-r--r-- 2,883 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
class:: Ringz
summary:: Ringing filter.
related:: Classes/Formlet, Classes/RHPF, Classes/RLPF, Classes/Resonz
categories::  UGens>Filters>Linear


Description::

This is the same as  link::Classes/Resonz:: , except that it is a constant skirt gain filter, meaning that the peak gain depends on the value of Q. Also, instead of the
resonance parameter in Resonz, the bandwidth is specified in a 60dB ring decay time. One Ringz is equivalent to one component of the
link::Classes/Klank::  UGen.


classmethods::

method::ar, kr

argument::in

The input signal.


argument::freq

Resonant frequency in Hertz.


argument::decaytime

The 60 dB decay time of the filter.


argument::mul

Output will be multiplied by this value.


argument::add

This value will be added to the output.


Examples::

code::
{ Ringz.ar(Dust.ar(3, 0.3), 2000, 2) }.play

{ Ringz.ar(WhiteNoise.ar(0.005), 2000, 0.5) }.play

// modulate frequency
{ Ringz.ar(WhiteNoise.ar(0.005), XLine.kr(100,3000,10), 0.5) }.play

{ Ringz.ar(Impulse.ar(6, 0, 0.3), XLine.kr(100,3000,10), 0.5) }.play

// modulate ring time
{ Ringz.ar(Impulse.ar(6, 0, 0.3), 2000, XLine.kr(4, 0.04, 8)) }.play

// modulate ring time opposite direction
{ Ringz.ar(Impulse.ar(6, 0, 0.3), 2000, XLine.kr(0.04, 4, 8)) }.play

(
{
    var exciter;
    exciter = WhiteNoise.ar(0.001);
    Mix.arFill(10, {
        Ringz.ar(exciter,
        XLine.kr(exprand(100.0,5000.0), exprand(100.0,5000.0), 20),
        0.5)
    })
}.play
)
::

Section:: Interaction with sample rate

Ringz (and UGens that are based on it: link::Classes/Klank::, link::Classes/DynKlank:: and link::Classes/Formlet::) are "sample-rate independent" with respect to emphasis::impulses:: at the input. That is, given single-sample impulses, the output signal at different sample rates should be the same frequency and amplitude.

This design has a side effect: If the input is not made of impulses, the output amplitude is proportional to the sample rate.

code::
(
a = {
	// rectangular pulse exciter (deterministic input)
	var exc = EnvGen.ar(Env([1, 1, 0], [0.01, 0], \lin)),
	sig = Ringz.ar(exc, 440, decaytime: 0.2),
	rms = sqrt(Integrator.ar(sig.squared) * (0.2 / SampleRate.ir)),
	end = DetectSilence.ar(sig, doneAction: 2);
	rms.poll(end);
	Silent.ar(1)
}.play;
)
::

At 44.1 kHz, this prints a RMS amplitude of 1.0758. At 88.2 kHz, the amplitude doubles.

Modal synthesis (simulating the vibrating modes of a struck surface) feeds a short, decaying burst of noise into Ringz-style resonators. This is a common use case that emphasis::is:: subject to this amplitude effect.

If you will need the results to be compatible at different sample rates, make sure to scale the volume appropriately: if code::sig:: is the Ringz, Klank or Formlet signal, use code::sig * (originalSampleRate / SampleRate.ir):: and substitute the right value in place of code::originalSampleRate::.