rsc3/doc-schelp/Help-3.12.2/Classes/SensoryDissonance.html

90 lines
5.4 KiB
HTML
Raw Permalink Normal View History

2022-08-24 13:53:18 +00:00
<html><head><title>SensoryDissonance</title>
<link rel='stylesheet' href='./../scdoc.css' type='text/css' />
<link rel='stylesheet' href='./../frontend.css' type='text/css' />
<link rel='stylesheet' href='./../custom.css' type='text/css' />
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<script src='./../scdoc.js' type='text/javascript'></script>
<script src='./../docmap.js' type='text/javascript'></script>
<script src='./../prettify.js' type='text/javascript'></script>
<script src='./../lang-sc.js' type='text/javascript'></script>
<script type='text/javascript'>var helpRoot='./..';</script>
</head>
<ul id='menubar'></ul>
<body onload='fixTOC();prettyPrint()'>
<div class='contents'>
<div class='header'>
<div id='label'>SuperCollider CLASSES (extension)</div>
<div id='categories'><a href='./../Browse.html#UGens>Analysis'>UGens>Analysis</a></div>
<h1>SensoryDissonance</h1>
<div id='summary'>Perceptual feature modeling sensory dissonance</div>
</div>
<div class='subheader'>
<div id='filename'>Source: <a href='file:///Users/zzk/Library/Application Support/SuperCollider/Extensions/SCMIRUGens/Classes/SensoryDissonance.sc'>/Users/zzk/Library/Application Support/SuperCollider/Extensions/SCMIRUGens/Classes/SensoryDissonance.sc</a></div><div id='superclasses'>Inherits from: <a href="../Classes/UGen.html">UGen</a> : <a href="../Classes/AbstractFunction.html">AbstractFunction</a> : <a href="../Classes/Object.html">Object</a></div>
<div id='related'>See also: <a href="./../Classes/Chromagram.html">Chromagram</a></div>
</div>
<div id='toc'>
<ul class='toc'><li class='toc1'><a href='#description'>Description</a></li>
<ul class='toc'></ul><li class='toc1'><a href='#classmethods'>Class methods</a></li>
<ul class='toc'><li class='toc3'><a href='#*kr'>kr</a> </li>
<li class='toc2'><a href='#Inherited%20class%20methods'>Inherited class methods</a></li>
</ul><li class='toc1'><a href='#instancemethods'>Instance methods</a></li>
<ul class='toc'><li class='toc2'><a href='#Inherited%20instance%20methods'>Inherited instance methods</a></li>
</ul><li class='toc1'><a href='#examples'>Examples</a></li>
<ul class='toc'></ul></ul></div><a class='anchor' name='kw_psychoacoustic%20measure'>&nbsp;</a><a class='anchor' name='kw_sensory%20dissonance'>&nbsp;</a><h2><a class='anchor' name='description'>Description</a></h2>
<p>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.
<p>In usual use, you probably won't care about the other arguments; just pass an FFT in, assuming FFT size 2048 by default. <h2><a class='anchor' name='classmethods'>Class Methods</a></h2>
<h3 class='cmethodname'><span class='methprefix'>*</span><a name='*kr' href='./../Overviews/Methods.html#kr'>kr</a> (<span class='argstr'>fft</span>, <span class='argstr'>maxpeaks: 100</span>, <span class='argstr'>peakthreshold: 0.1</span>, <span class='argstr'>norm</span>, <span class='argstr'>clamp: 1</span>)</h3>
<div class='method'><h4>Arguments:</h4>
<table class='arguments'>
<tr><td class='argumentname'>fft<td class='argumentdesc'>
<p>input fft chain, that is, from an FFT UGen<tr><td class='argumentname'>maxpeaks<td class='argumentdesc'>
<p>Maximum number of spectral peaks detected; cannot be modulated, initialisation only. <tr><td class='argumentname'>peakthreshold<td class='argumentdesc'>
<p>Minimum spectral power detection threshold for a peak <tr><td class='argumentname'>norm<td class='argumentdesc'>
<p>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. <tr><td class='argumentname'>clamp<td class='argumentdesc'>
<p>Clamps very high dissonances, in default mode will end up with sensory dissonance measure in range 0.0 to 1.0</table></div><h3><a class='anchor' name='Inherited%20class%20methods'>Inherited class methods</a></h3>
<div id='inheritedclassmets'></div><h2><a class='anchor' name='instancemethods'>Instance Methods</a></h2>
<h3><a class='anchor' name='Inherited%20instance%20methods'>Inherited instance methods</a></h3>
<div id='inheritedinstmets'></div><h2><a class='anchor' name='examples'>Examples</a></h2>
<pre class='code prettyprint lang-sc'>(
{
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
)</pre>
<p><div class='doclink'>helpfile source: <a href='file:///Users/zzk/Library/Application Support/SuperCollider/Extensions/SCMIRUGens/HelpSource/Classes/SensoryDissonance.schelp'>/Users/zzk/Library/Application Support/SuperCollider/Extensions/SCMIRUGens/HelpSource/Classes/SensoryDissonance.schelp</a><br>link::Classes/SensoryDissonance::<br>sc version: 3.8.0</div></div></body></html>