MCPcopy Create free account
hub / github.com/LancePutnam/Gamma / onAudio

Method onAudio

examples/algorithmic/luster.cpp:48–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 }
47
48 void onAudio(AudioIOData& io){
49 while(io()){
50
51 // Generate new seed?
52 if(tmr()){ if(rnd::prob()) seed++; }
53
54 // Modulated mix between pulse waves
55 float mx = mix.hann();
56 float s = (oscA.up() - oscB.up())*mx + (osc1.up() - osc2.up())*(1-mx);
57
58 // Add frequency shifted versions of signal to get barberpole combs
59 fshift1.freq(modfs1.tri()*2);
60 fshift2.freq(modfs2.tri()*2);
61 s += (fshift1(s) + fshift2(s))*0.5;
62
63 if(stft(s)){
64 // Apply spectral thin
65 rnd::push(seed);
66 float prb = rnd::uni(0.3, 0.1);
67 for(unsigned k=0; k<stft.numBins(); ++k){
68 //float frac = double(k)/stft.numBins();
69 float m = rnd::pick(rnd::pick(2,1, 0.1),0, prb);
70 stft.bin(k) *= m;
71 }
72 rnd::pop();
73 stft.zeroEnds();
74 }
75
76 s = stft()*0.5;
77
78 // "Spatialize" with modulated echoes
79 float s0 = chrA3(chrA2(chrA1(s)));
80 float s1 = chrB3(chrB2(chrB1(s)));
81
82 io.out(0) = s0;
83 io.out(1) = s1;
84 }
85 }
86};
87
88int main(){

Callers

nothing calls this directly

Calls 8

probFunction · 0.85
pushFunction · 0.85
popFunction · 0.85
upMethod · 0.80
triMethod · 0.80
numBinsMethod · 0.80
zeroEndsMethod · 0.80
freqMethod · 0.45

Tested by

no test coverage detected