<div>Fellow ChucKists,</div><div><br></div><div>Yesterday I wanted to wish Dan a happy birthday on FaceBook, hoping for many more years of fun with strings and code but thought it'd be nicer to write this in ChucK. Then stuff happened and I was too late.</div>
<div><br></div><div>Belated but no less sincere; emulating strings in LiSa... because we can, and because LiSa can (LiSa can actually do anything, she's just modest). We start out with a very literal implementation of Karplus-Strong at concert A4 tuning. Then we start mucking with various parameters in ways that are less traditionally Karplus-Strong for some more interesting tembral effects.</div>
<div><br></div><div>Yours,</div><div>Kas.</div><div><br></div><div>/*</div><div>Do copy, do share.</div><div>No warranties, no refunds.</div><div>Physical models can (and will!) blow up; please mind your speakers, neighbours and pets.</div>
<div>Remixing and sharing results strongly encouraged (many parameters left....).</div><div>Happy belated birthday to Dan!</div><div>*/</div><div><br></div><div><br></div><div>//the patch (noise or a saw plus a envelope could emulate a bow instead of a pluck)</div>
<div>Impulse i => LiSa l => dac;</div><div>//needs to be defined</div><div>second => l.duration;</div><div><br></div><div>//two voices for averaging</div><div>2 => l.maxVoices;</div><div><br></div><div>//buffer duration = source of the pitch</div>
<div>second / 440 => dur base_cycle;</div><div><br></div><div>//create a looping delay</div><div>//looping for both recording and playback is on by default</div><div>base_cycle => l.loopEndRec;</div><div>l.loopEnd (0, base_cycle);</div>
<div>l.loopEnd (1, base_cycle);</div><div>1 => l.record;</div><div><br></div><div>//offset the second voice by one sample</div><div>//so we average between the current and the last sample value</div><div>l.play (0, 1);</div>
<div>l.playPos (1, -1 * samp); //"::" should work here but gives me a error? [BUG]</div><div>l.play( 1, 1);</div><div><br></div><div>//average between the two values. ratio sets the "filter's" effect.</div>
<div>//make sure the two add up to unity (1.0).</div><div>l.voiceGain (0, .5);</div><div>l.voiceGain (1, .5);</div><div><br></div><div>//feedback sets the tone's decay</div><div>.995 => l.feedback;</div><div><br></div>
<div>//off we go!</div><div>1 => i.next;</div><div>2::second => now;</div><div><br></div><div><br></div><div>//tradition ends here.</div><div>//fun starts</div><div>l.loopEnd (1, base_cycle * .5);</div><div><br></div>
<div>1 => i.next;</div><div>2::second => now;</div><div><br></div><div>l.loopEnd (1, base_cycle * 2);</div><div><br></div><div>1 => i.next;</div><div>2::second => now;</div><div><br></div><div>l.loopEnd (1, base_cycle * .333333);</div>
<div><br></div><div>1 => i.next;</div><div>2::second => now;</div><div><br></div><div>l.loopEnd (1, base_cycle * 1.5);</div><div><br></div><div>1 => i.next;</div><div>2::second => now;</div><div><br></div><div>
<div>l.loopEndRec() * 2 => l.loopEndRec;</div><div>l.loopEnd (1, base_cycle - samp); </div><div>1 => i.next;</div><div>4::second => now;</div></div><div><br></div>