scide: LookupDialog - redo lookup on classes after partial lookup
[supercollider.git] / SCClassLibrary / Common / Audio / MachineListening.sc
blob6147e1f1cca8ad0c14ca57f5d207d276e471e67d
1 //4 outs
2 BeatTrack : MultiOutUGen {
4         *kr { arg chain, lock=0;
6                 if(chain.isKindOf(FFT).not){
7                         // Automatically drop in an FFT, possible now that we have LocalBuf
8                         chain = FFT(LocalBuf(if(SampleRate.ir>48000, 2048, 1024)), chain);
9                 };
11                 ^this.multiNew('control',chain, lock);
12         }
14         init { arg ... theInputs;
15                 inputs = theInputs;
16                 ^this.initOutputs(4, rate);
17         }
20 //loudness output in sones
21 Loudness : UGen {
23         *kr { arg chain, smask=0.25, tmask=1;
25                 ^this.multiNew('control',chain, smask, tmask);
26         }
30 Onsets : UGen {
31         *kr { |chain, threshold=0.5, odftype=\rcomplex, relaxtime=1,
32                                 floor=0.1, mingap=10, medianspan=11, whtype=1, rawodf=0|
33                 if(odftype.class == Symbol){
34                         odftype = #[\power, \magsum, \complex, \rcomplex, \phase, \wphase,\mkl]
35                                 .indexOf(odftype)
36                 };
37                 // mingap of 10 frames, @ 44100 & 512 & 50%, is about 0.058 seconds
38                 ^this.multiNew('control', chain, threshold, odftype, relaxtime,
39                                 floor, mingap, medianspan, whtype, rawodf)
40         }
44 //transient input not currently used but reserved for future use in downweighting frames which have high transient content
45 KeyTrack : UGen {
47         *kr { arg chain,keydecay=2.0,chromaleak= 0.5; //transient=0.0;
49                 ^this.multiNew('control',chain,keydecay,chromaleak); //transient;
50         }
54 //a bufnum could be added as third argument for passing arbitrary band spacing data
55 MFCC : MultiOutUGen {
56         *kr { arg chain, numcoeff=13;
57                 ^this.multiNew('control', chain, numcoeff);
58         }
60         init { arg ... theInputs;
61                 inputs = theInputs;
63                 ^this.initOutputs(theInputs[1], rate);
64         }
69 //6 outs
70 BeatTrack2 : MultiOutUGen {
72         *kr { arg busindex, numfeatures, windowsize=2.0, phaseaccuracy=0.02, lock=0, weightingscheme;
74                 ^this.multiNew('control',busindex, numfeatures,windowsize, phaseaccuracy, lock, weightingscheme ? (-2.1));
75         }
77         init { arg ... theInputs;
78                 inputs = theInputs;
79                 ^this.initOutputs(6, rate);
80         }
85 SpecFlatness : UGen
87         *kr { | buffer |
88                 ^this.multiNew('control', buffer)
89         }
91 SpecPcile : UGen
93         *kr { | buffer, fraction = 0.5, interpolate = 0 |
94                 ^this.multiNew('control', buffer, fraction, interpolate)
95         }
97 SpecCentroid : UGen
99         *kr { | buffer |
100                 ^this.multiNew('control', buffer)
101         }