File: SensoryDissonance.schelp

package info (click to toggle)
supercollider-sc3-plugins 3.7.1~repack-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 14,332 kB
  • ctags: 11,704
  • sloc: cpp: 140,180; lisp: 14,746; ansic: 2,133; xml: 86; makefile: 82; haskell: 21; sh: 8
file content (77 lines) | stat: -rw-r--r-- 1,933 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
class:: SensoryDissonance
summary:: Perceptual feature modeling sensory dissonance
related:: Classes/Chromagram
categories:: UGens>Analysis
keyword:: psychoacoustic measure, sensory dissonance

Description::

Sensory Dissonance model, measuring roughness between pairs of prominent spectral peaks. Follows the algorithm in William A. Sethares (1998) Consonance-Based Spectral Mappings. CMJ 22(1): 56-72. 

In usual use, you probably won't care about the other arguments; just pass an FFT in, assuming FFT size 2048 by default. 


classmethods::

method::kr


argument::fft
input fft chain, that is, from an FFT UGen
argument::maxpeaks
Maximum number of spectral peaks detected; cannot be modulated, initialisation only. 
argument::peakthreshold
Minimum spectral power detection threshold for a peak 
argument::norm
Normalisation factor. Calculated for you in the UGen class if you don't provide one, but you can experiment here. In combination with the next argument and maxpeaks, allows you to have alternative range outputs if you so desire. 
argument::clamp
Clamps very high dissonances, in default mode will end up with sensory dissonance measure in range 0.0 to 1.0

Examples::

code::


(
{

var in, fft, dissonance;

//in = SinOsc.ar(MouseX.kr(100,1000),0,0.1);
//in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1));  
in= SoundIn.ar; 

fft = FFT(LocalBuf(2048), in);

dissonance=SensoryDissonance.kr(fft);

dissonance.poll; 

Out.ar(0,Pan2.ar(0.1*Blip.ar(100,(dissonance.sqrt)*200))); 
}.play
)



//different fftsize, max num peaks, own normalisation, avoid clamping by setting high value (more CPU cost) 
(
{

var in, fft, dissonance;

//in = SinOsc.ar(MouseX.kr(100,1000),0,0.1);
//in = Mix(SinOsc.ar([440,MouseX.kr(440,880)],0,0.1));  
in= SoundIn.ar; 

fft = FFT(LocalBuf(4096), in);

dissonance=SensoryDissonance.kr(fft,500,1.0,1.0,999999);

dissonance.poll; 

Out.ar(0,SinOsc.ar(dissonance*0.1,0,0.1)); 
}.play
)


::