[sc-users] impulse pops
stillmovement
sc at stillmovement.org
Fri Feb 1 18:05:49 PST 2008
Sorry for the delayed response.
I wound up rewriting my waveguides to use BPF in lieu of SOS and solved my
popping issues. However, SOS sounds better to my ears and I would love to
figure this out for the future.
Try the code below. If I execute this enough times I'll eventually get a
pop as described in my previous post. Again, it's very unpredictable and
intermittent but it happens enough to be an issue.
Thanks.
// A server with some options
(
~serverOptions = ServerOptions.new;
~serverOptions.memSize_( 65536 );
// maker sure outputStreams set to "01000" for 828 use
~serverOptions.outputStreamsEnabled_( "10000" );
s = Server.new( 'primary', NetAddr( "127.0.0.1", 57130), ~serverOptions );
s.makeWindow;
s.boot;
)
// a window and some Routines
(
var testWindow, beatOneLabel, beatOneButton, beatThreeLabel,
beatThreeButton;
var lowChord, highChord;
testWindow = SCWindow.new( "Will my BiQuads Work?", Rect( 400, 300, 300, 150
), false );
beatOneLabel = SCStaticText(
testWindow,
Rect( 20, 20, 100, 20)
)
.string_( "Play First:" );
beatOneButton = SCButton(
testWindow,
Rect( 20, 40, 60, 30 )
)
.states_( [ [ "Play!", Color.black, Color.clear ] ] )
.action_( { lowChord.reset.play; } )
.canFocus_( false );
beatThreeLabel = SCStaticText(
testWindow,
Rect( 100, 20, 100, 20)
)
.string_( "Play Second:" );
beatThreeButton = SCButton(
testWindow,
Rect( 100, 40, 60, 30 )
)
.states_( [ [ "Play!", Color.black, Color.clear ] ] )
.action_( { highChord.reset.play; } )
.canFocus_( false );
testWindow.front;
lowChord = Routine({
[ 54, 65, 74, 76, 83, 87 ].do({ arg tone;
var tempY, tempX;
tempY = 1.0; //rrand( 0.0, 1.0 );
tempX = 0.25**tempY * [ 1, -1 ].choose;
s.sendMsg( "/s_new", "GongChord", -1, 0, 0, "pch",
tone.midicps * rrand( 0.997, 1.002 ),
"amp", 0.35, "dur", 5.5, "panX", tempX,
"panY", tempY, "outBus", 0
);
rrand( 0.0005, 0.001).wait;
});
});
highChord = Routine({
[ 80, 86, 93, 96 ].do({ arg tone;
2.do({
var tempY, tempX;
tempY = 1.0; //rrand( 0.0, 1.0 );
tempX = 0.25**tempY * [ 1, -1 ].choose;
s.sendMsg( "/s_new", "GongChord", -1, 0, 0, "pch",
tone.midicps * rrand( 0.997, 1.002 ),
"amp", 0.35, "dur", 5.5, "panX", tempX,
"panY", tempY, "outBus", 0
);
rrand( 0.0005, 0.001).wait;
});
rrand( 0.0005, 0.001).wait;
});
});
)
// SynthDef
(
SynthDef("GongChord", { arg amp = 1, pch = 440, fbAmp = 0.9, dur = 6, q =
3000,
panX = 0, panY = 0, outBus = 0;
var env, sus, feedback, exciter, fSig = 0, dSig = 0;
var fHarm, mSig = 0;
var signal, crDur;
// adjust dTime with
crDur = ControlRate.ir.reciprocal;
feedback = Median.ar( 10, LocalIn.ar( 1 ) * fbAmp );
// controls overall sustain and deallocation of synth
// synth will sustain for twice the specified dur argument
sus = EnvGen.kr( Env.new( [ 1, 1, 0 ], [ dur * 1.5, dur * 0.5 ], -2 ),
doneAction:2 );
// envelope applied to exciter
env = EnvGen.kr( Env.new( [ 10, 10, 0.00001, 0.75, 0.75, 0.0001 ],
[ 0.0004, 0.0004, 0.4, dur * 0.1, dur * 0.8 ],
[ 'step', 'step', 'step', 'step', 'exponential' ], 0, 0
)
);
exciter = (
(
Median.ar(
3, BrownNoise.ar( 1 ) + WhiteNoise.ar( 0.5 ) +
LPF.ar( LFClipNoise.ar( 500, 0.83 ), 200 )
) * env )
+ feedback
);
// some overtones.... yes 1 is reinforced, and a subharmonic is added later
fHarm = Control.names( [ \modalFreqs ] ).kr( [
1, 1, 2.4044943820225, 3.9831460674157, 6.5168539325843, 9.3876404494382,
12.511235955056, 15.915730337079, 23.702247191011, 27.786516853933,
32.994382022472,
37.792134831461, 0.5 ]
);
// basic harmonic structure
fHarm.do({ arg harm, i;
var theta, kpole1, a0, a1, a2, b0, b1, b2, alpha;
var bCF, dTime;
bCF = pch * harm;
theta = bCF/22050 * pi;
alpha = max( sin( theta ) / ( 2 * q ), 0.0 );
b0 = alpha;
a0 = alpha + 1;
b1 = 0;
b2 = alpha.neg;
a1 = -2 * cos( theta );
a2 = 1 - alpha;
dTime = ( 1 / bCF ) - crDur;
fSig = SOS.ar( exciter, b0 / a0, b1 / a0, b2 / a0, ( a1 / a0 ).neg, ( a2 /
a0 ).neg, 1 );
dSig = DelayL.ar( fSig, 0.05, dTime, 0.45 ) * ( ( 1 / ( i + 1 ) )**0.5 );
mSig = mSig + dSig;
});
// excite some formants
[ 184.99721135582, 220, 311.12698372208, 349.4 ].do({ arg form, i;
var theta, kpole1, a0, a1, a2, b0, b1, b2, alpha;
var bCF, dTime;
bCF = form;
theta = bCF/22050 * pi;
alpha = max( sin( theta ) / ( 2 * q ), 0.0 );
b0 = alpha;
a0 = alpha + 1;
b1 = 0;
b2 = alpha.neg;
a1 = -2 * cos( theta );
a2 = 1 - alpha;
dTime = ( 1 / bCF ) - crDur;
fSig = SOS.ar( exciter, b0 / a0, b1 / a0, b2 / a0, ( a1 / a0 ).neg, ( a2 /
a0 ).neg, 1 );
dSig = DelayL.ar( fSig, 0.05, dTime, 0.75 );
mSig = mSig + ( dSig * 0.05 );
});
LocalOut.ar( mSig );
// bring level up the adjust with amp arg
signal = ( mSig * 90 ) * amp;
OffsetOut.ar( outBus, Pan4.ar( signal * sus, panX, panY ) );
}).load( s );
)
Josh Parmenter wrote:
>
>
> On Jan 21, 2008, at 4:19 PM, stillmovement wrote:
>
>> Does anybody have any ideas? My thoughts have run the gamut:
>> architecture
>> differences between PPC and Intel (the BiQuads/Delays may have a
>> heavy cost
>> at instantiation which memory latencies or processor slewing could
>> effect?);
>> threading issues internal to SC (the GUI/midi similarity with /s_new
>> calls
>> encapsulated within functions related to those classes); an Intel-
>> dependent
>> bug with SOS; something else?
>
>
> can you show me an example of the heavy instantiation? Or code that
> pops every now and then? Hard to tell what it is without an example.
>
> -Josh
>
>
> ******************************************
> /* Joshua D. Parmenter
> http://www.realizedsound.net/josh/
>
> “Every composer – at all times and in all cases – gives his own
> interpretation of how modern society is structured: whether actively
> or passively, consciously or unconsciously, he makes choices in this
> regard. He may be conservative or he may subject himself to continual
> renewal; or he may strive for a revolutionary, historical or social
> palingenesis." - Luigi Nono
> */
>
> _______________________________________________
> sc-users mailing list
> sc-users at create.ucsb.edu
> http://lists.create.ucsb.edu/mailman/listinfo/sc-users
>
>
--
View this message in context: http://www.nabble.com/impulse-pops-tp9717021p15238792.html
Sent from the Supercollider - User mailing list archive at Nabble.com.
More information about the sc-users
mailing list