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

94 lines
5 KiB
HTML
Raw Permalink Normal View History

2022-08-24 13:53:18 +00:00
<html><head><title>SpectralEntropy</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>SpectralEntropy</h1>
<div id='summary'>Spectral feature extraction</div>
</div>
<div class='subheader'>
<div id='filename'>Source: <a href='file:///Users/zzk/Library/Application Support/SuperCollider/Extensions/SCMIRUGens/Classes/SpectralEntropy.sc'>/Users/zzk/Library/Application Support/SuperCollider/Extensions/SCMIRUGens/Classes/SpectralEntropy.sc</a></div><div id='superclasses'>Inherits from: <a href="../Classes/MultiOutUGen.html">MultiOutUGen</a> : <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/SensoryDissonance.html">SensoryDissonance</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_spectral%20entropy'>&nbsp;</a><h2><a class='anchor' name='description'>Description</a></h2>
<p>Spectral Entropy, with a choice of number of sub-bands. If one band, a measure of general peakiness of the spectral distribution.
<p>See: SPECTRAL ENTROPY AS SPEECH FEATURES FOR SPEECH RECOGNITION Aik Ming Toh, Roberto Togneri and Sven Nordholm <a href="http://www.ee.uwa.edu.au/~roberto/research/theses/tr05-01.pdf">http://www.ee.uwa.edu.au/~roberto/research/theses/tr05-01.pdf</a>
<p>Pass an FFT in. <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'>fftsize: 2048</span>, <span class='argstr'>numbands: 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'>fftsize<td class='argumentdesc'>
<p>Size of FFT buffer must be known in advance for pre-calculation <tr><td class='argumentname'>numbands<td class='argumentdesc'>
<p>Number of sub-bands for entropy calculation; spectral bins are collected in sub-bands, and the number of outputs of the UGen is numbands</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, entropy;
//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);
entropy=SpectralEntropy.kr(fft,2048,1); //one output band (so full spectrum's entropy)
entropy.poll;
Out.ar(0,Pan2.ar(0.1*Blip.ar(100,10*(entropy.sqrt))));
}.play
)
(
{
var in, fft, entropy;
var amplitude;
in= SoundIn.ar;
amplitude = Amplitude.kr(in);
fft = FFT(LocalBuf(1024), in);
entropy=SpectralEntropy.kr(fft,1024,10);//10 bands
entropy = entropy * (amplitude.min(0.2)*5.0); //scale by amplitude to avoid low amplitude noise issues
entropy.poll;
//Out.ar(0,Pan2.ar(0.1*Blip.ar((entropy[0])*200,entropy[1].sqrt)));
Out.ar(0,Splay.ar(0.1*Blip.ar((entropy)*200,entropy.sqrt)));
}.play
)</pre>
<p><div class='doclink'>helpfile source: <a href='file:///Users/zzk/Library/Application Support/SuperCollider/Extensions/SCMIRUGens/HelpSource/Classes/SpectralEntropy.schelp'>/Users/zzk/Library/Application Support/SuperCollider/Extensions/SCMIRUGens/HelpSource/Classes/SpectralEntropy.schelp</a><br>link::Classes/SpectralEntropy::<br>sc version: 3.8.0</div></div></body></html>