File: MachineListening.sc

package info (click to toggle)
supercollider 1%3A3.13.0%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 80,292 kB
  • sloc: cpp: 476,363; lisp: 84,680; ansic: 77,685; sh: 25,509; python: 7,909; makefile: 3,440; perl: 1,964; javascript: 974; xml: 826; java: 677; yacc: 314; lex: 175; objc: 152; ruby: 136
file content (99 lines) | stat: -rw-r--r-- 2,194 bytes parent folder | download | duplicates (3)
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
99
//4 outs
BeatTrack : MultiOutUGen {

	*kr { arg chain, lock=0;

		if(chain.isKindOf(FFT).not){
			// Automatically drop in an FFT, possible now that we have LocalBuf
			chain = FFT(LocalBuf(if(SampleRate.ir>48000, 2048, 1024)), chain);
		};

		^this.multiNew('control',chain, lock);
	}

	init { arg ... theInputs;
		inputs = theInputs;
		^this.initOutputs(4, rate);
	}
}

//loudness output in sones
Loudness : UGen {

	*kr { arg chain, smask=0.25, tmask=1;

		^this.multiNew('control',chain, smask, tmask);
	}
}


Onsets : UGen {
	*kr { |chain, threshold=0.5, odftype=\rcomplex, relaxtime=1,
				floor=0.1, mingap=10, medianspan=11, whtype=1, rawodf=0|
		if(odftype.class == Symbol){
			odftype = #[\power, \magsum, \complex, \rcomplex, \phase, \wphase,\mkl]
				.indexOf(odftype)
		};
		// mingap of 10 frames, @ 44100 & 512 & 50%, is about 0.058 seconds
		^this.multiNew('control', chain, threshold, odftype, relaxtime,
				floor, mingap, medianspan, whtype, rawodf)
	}
}


//transient input not currently used but reserved for future use in downweighting frames which have high transient content
KeyTrack : UGen {

	*kr { arg chain,keydecay=2.0,chromaleak= 0.5; //transient=0.0;

		^this.multiNew('control',chain,keydecay,chromaleak); //transient;
	}
}


//a bufnum could be added as third argument for passing arbitrary band spacing data
MFCC : MultiOutUGen {
	*kr { arg chain, numcoeff=13;
		^this.multiNew('control', chain, numcoeff);
	}

	init { arg ... theInputs;
		inputs = theInputs;

		^this.initOutputs(theInputs[1], rate);
	}
}



//6 outs
BeatTrack2 : MultiOutUGen {

	*kr { arg busindex, numfeatures, windowsize=2.0, phaseaccuracy=0.02, lock=0, weightingscheme;

		^this.multiNew('control',busindex, numfeatures,windowsize, phaseaccuracy, lock, weightingscheme ? (-2.1));
	}

	init { arg ... theInputs;
		inputs = theInputs;
		^this.initOutputs(6, rate);
	}
}



SpecFlatness : UGen {
	*kr { | buffer |
		^this.multiNew('control', buffer)
	}
}
SpecPcile : UGen {
	*kr { | buffer, fraction = 0.5, interpolate = 0 , binout = 0|
		^this.multiNew('control', buffer, fraction, interpolate, binout)
	}
}
SpecCentroid : UGen {
	*kr { | buffer |
		^this.multiNew('control', buffer)
	}
}