<div>Hello All.<br>My name is Edward. I&#39;m a synthesis buff from Melbourne.<br>I&#39;ve been using Chuck for about a week now, and I&#39;m really loving it. I haven&#39;t really learnt to use a sporking language before. I used to program in Borland Turbo C 
2.0 back in the early 90s, and also did a lot of QuickBasic, but, I never really caught up to the modern age so to speak. I&#39;m only 29, so I thought, there&#39;s no time to learn like now! I think I&#39;ve got this all sporked off in a reasonably sensible way, but, I could probably do more. I am totally open to people sending me suggestions (on or off list). I&#39;m not &quot;precious&quot; about my program in any way.
</div>
<div>&nbsp;</div>
<div>&nbsp;I hope some of you get some use from this example. I don&#39;t think it is by any means &quot;distro example&quot; quality, but, I hope that with some work, and the addition of some more features not present in examples currently in distro, that one day it might be!
</div>
<div>&nbsp;</div>
<div>&nbsp;I have tried looking around for a model for sympathetic strings, and have had no luck. If anyone has any advice, please advise.</div>
<div>&nbsp;</div>
<div>best wishes to all;</div>
<div>-Edward r Jones<br>&nbsp;</div>
<div>&nbsp;</div>
<div>// <a href="http://Tambura-with-sporking.ck">Tambura-with-sporking.ck</a></div>
<div>//<br>// Tambura with Sporking<br>//<br>// by Edward r Jones (<a href="mailto:loscha@gmail.com">loscha@gmail.com</a>)<br>//<br>// This is my emulation of an electronic tambura device.<br>// By Tambura, I mean the Indian classical instrument.
<br>// A Tambura has 4 to 6 strings, which are plucked in a repeating pattern to accompany Indian classical music<br>// It has a resonating cavity, and resonant sympathetic strings, like a Sitar, but, no frets.<br>// Please Help! This Model Needs!
<br>//<br>// = Sympathetic Strings. I&#39;ve tried setting up a series of 8 delay lines <br>// tuned to the resonant frequencies I desire), but, they didn&#39;t give me the results I wanted at all.<br>// I am new to coding Physical Modelling, and if anyone has some advice on this matter I&#39;d love to hear from you.
<br>//<br>//&nbsp;&nbsp; A Resonant Cavity.<br>//&nbsp;&nbsp; I&#39;ve goen with using LPF and HPF to limit the output frequency range to give the sort of timbre I want, but,<br>//&nbsp;&nbsp; I know that this could be better acheived.<br>//<br>//&nbsp;&nbsp; At the moment, it sounds more like a Koto.
<br>//&nbsp;&nbsp; I found the stk Sitar instrument to sound nothing like a Sitar or a Tambura,<br>//&nbsp;&nbsp; Buuut, this is because of the reasons I listed above -- Sympathetic Strings &amp; real Resonant Cavity.<br>//<br>// In closing, I want to thank:
<br>// The ChucK community, I love this language (and you all!) so much,<br>// and I hope to be able to contribute to it&#39;s development in the future<br>// My wonderful partner, Michelle, who doesn&#39;t mind me staying up until 3am working on this stuff!
<br>// All my local friends in synthesis; Bill Harrison aka James Earthenware, Paul Perry, Robin Whittle &amp; Jaymz<br>//&nbsp;&nbsp;\=&gt; Clae, All the Melbourne Dorkbot community, and all the other hardcore synthesists in Melbourne, Victoria, Australia!
<br>// All my online friends, Matrixsynth, Sealed, SynthDiy and all my LiveJournal Buddies.<br>// The Founding Fathers of this craft that I love so much. John Chowning, Max V Matthews, Steve Reich, Paul Lansky &amp; Stockhausen, 
<br>//<br>// Enuff! On to the Code!<br><br><br><br>[&nbsp;&nbsp;1,&nbsp;&nbsp;0,&nbsp;&nbsp;0,&nbsp;&nbsp;1,&nbsp;&nbsp;1,&nbsp;&nbsp;0] @=&gt; int beats[];&nbsp;&nbsp;// 1 means play, 0 means skip<br>[ 00, 00, 00, 12, 09, 04] @=&gt; int notes[];&nbsp;&nbsp;// Note pitch, relative to noteoffset<br>30 =&gt; int noteoffset;&nbsp;&nbsp;&nbsp;&nbsp; // this is the transpose, to make scales easier
<br>float variance[beats.cap()];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// this is for randomization of string pitches to achieve &quot;thickness&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// They are calculated once at startup, to simulate real string tuning
<br>.05&nbsp;&nbsp;=&gt; float waver;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// range for variance in NOTES<br>72&nbsp;&nbsp; =&gt; float tempo;<br><br>float click;<br>30000 / tempo =&gt; click;<br>&lt;&lt;&lt;&quot;Click length&quot;, click,&quot;&quot;&gt;&gt;&gt;;
<br>int numsteps;<br>beats.cap() =&gt; numsteps;<br>LPF lpf;<br>HPF hpf;<br>JCRev jcrev;<br><br>2550 =&gt; lpf.freq;<br>300 =&gt; hpf.freq;<br>.05 =&gt; jcrev.mix;<br><br>StifKarp tambura[numsteps];<br>lpf =&gt; hpf =&gt; jcrev =&gt; dac;
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//------- Hook up all tamburas to the chain &amp; set them up the way we want them.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp;.pickupPosition - ( float , READ/WRITE ) - pickup position [0.0 - 1.0]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp;.sustain - ( float , READ/WRITE ) - string sustain [
0.0 - 1.0]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp;.stretch - ( float , READ/WRITE ) - string stretch [0.0 - 1.0]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp;.pluck - ( float , WRITE only ) - pluck string [0.0 - 1.0]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp;.baseLoopGain - ( float , READ/WRITE ) - ?? [
0.0 - 1.0]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp;.clear - ( ) - reset instrument<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (0 =&gt; int stab; stab &lt; numsteps; stab++)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tambura[stab] =&gt; lpf;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.03 =&gt; tambura[stab].pickupPosition;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 =&gt; tambura[stab].sustain;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 =&gt; tambura[stab].stretch;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.99 =&gt; tambura[stab].baseLoopGain;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Std.rand2f(1-waver, waver) =&gt; variance[stab];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt;&lt;&quot;tambura #&quot;,stab,&quot;hooked up&quot;,&quot;&quot;&gt;&gt;&gt;;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//------ Hookups done.<br><br><br>&lt;&lt;&lt;&quot;pre-comparison&quot;,&quot;&quot;&gt;&gt;&gt;;<br>if (beats.cap() == notes.cap())<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt;&lt;&quot;Steps in our sequence&quot;, numsteps,&quot;&quot;&gt;&gt;&gt;;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//------------------------------------ The Sequence Plays! ----------------------<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while (true)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (0 =&gt; int stab; stab &lt; numsteps; stab++)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;click * 1::ms =&gt; now;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//------------------------------------ The Sequence (never) Ends! ----------------------
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt;&lt;&quot;End of Playing!&quot;,&quot;&quot;&gt;&gt;&gt;;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>//------------------------------------------------------------------------<br>// Error, stop the program<br>else<br>&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;&lt;&lt;&quot;ERROR IN SEQUENCER DATA&quot;, &quot;&quot;;&gt;&gt;&gt;;
</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;&lt;&lt;&quot;Item count mismatch&quot;,&quot;&quot;&gt;&gt;&gt;;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>//-------------------------------------------------------------------------<br>//&nbsp;&nbsp;This is the sporkage for our note playing.
<br>fun void tampluck (int step)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;float npitch;<br>&nbsp;&nbsp;&nbsp;&nbsp;variance[step] + noteoffset + notes[step] =&gt; Std.mtof =&gt; npitch;<br>&nbsp;&nbsp;&nbsp;&nbsp;npitch =&gt; tambura[step].freq;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;&lt;&lt;&quot;Pitch&quot;,npitch,&quot;&quot;&gt;&gt;&gt;;
<br>&nbsp;&nbsp;&nbsp;&nbsp;1 =&gt; tambura[step].pluck;&nbsp;&nbsp;&nbsp;&nbsp;<br>}<br><br>-- <br><a href="http://www.loscha.com/chuck">www.loscha.com/chuck</a><br>&nbsp;</div>