<div dir="ltr"><div><div><div>Hello Colton,<br><br></div>Looks like a good start!  Imports/includes are not so great in ChucK.  In LiCK, I&#39;ve resorted to a big <a href="http://import.ck">import.ck</a> file<br><br><a href="https://github.com/heuermh/lick/blob/master/import.ck">https://github.com/heuermh/lick/blob/master/import.ck<br></a><br></div>There are a lot of functional-ish classes in LiCK, if you wanted to pass around play functions as objects.<br><br></div><div>class MmlParser<br>{<br></div><div>  Play @ play;<br><br></div><div>  // ... parse stuff, spork ~ play.play(freq, nlength, qlength, vol), ...<br></div><div>}<br></div><div><br></div><div>class Play // &quot;abstract&quot; class, since there are no interfaces in ChucK<br>{<br></div><div>  fun void play(float freq, dur nlength, dur qlength, float vol)<br>  {<br></div><div>    // empty<br></div><div>  }<br></div><div>}<br></div><div><br></div><div>class PlayNote extends Play<br>{<br></div><div>  SinOsc sin =&gt; ADSR adsr =&gt; dac;<br><br></div><div>  fun void play(float freq, dur nlength, dur qlength, float vol)<br>  {<br></div><div>    freq =&gt; sin.freq;<br></div><div>    vol =&gt; sin.gain;<br></div><div>    1 =&gt; adsr.keyOn;<br></div><div>    nlength =&gt; now;<br></div><div>    1 =&gt; adsr.keyOff;<br></div><div>    qlength =&gt; now;<br></div><div>  }  <br>}<br></div><div><br></div><div>MmlParser mmlParser;<br></div><div>PlayNote playNote;<br></div><div>playNote @=&gt; mmlParser.play;<br></div><div><br>mmlParser.parse(input);<br></div><div><br></div><div>   michael<br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 6, 2016 at 8:32 PM, Colton Hill <span dir="ltr">&lt;<a href="mailto:colton-hill2014@hotmail.com" target="_blank">colton-hill2014@hotmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I also want to make sure I have a customizable play function that will<br>
handle my playing. Here&#39;s the code I&#39;ve been using for my current mml<br>
parser in chuck, actually does take a code string and a play function,<br>
and operates well. Only issue is including doesn&#39;t work... So have a test.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On 9/6/2016 3:33 AM, Hans Åberg wrote:<br>
&gt;&gt; On 5 Sep 2016, at 23:16, Colton Hill &lt;<a href="mailto:colton-hill2014@hotmail.com">colton-hill2014@hotmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; I know regular expressions syntax, but I really don&#39;t know how I would<br>
&gt;&gt; manage to make an mml parser that actually works. Turn o4l8cdefg into<br>
&gt;&gt; octave 4, length 8, and c d e f g notes with an 8th note length since no<br>
&gt;&gt; length is specified. Then there&#39;s c4., which is c4^c8... Just bla…<br>
&gt; There are free MML parsers in C out there. Linking to ChucK, which is written in C++, might be a way.<br>
&gt;<br>
&gt;<br>
&gt; ______________________________<wbr>_________________<br>
&gt; chuck-users mailing list<br>
&gt; <a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.<wbr>princeton.edu</a><br>
&gt; <a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.<wbr>edu/mailman/listinfo/chuck-<wbr>users</a><br>
<br>
</div></div><br>______________________________<wbr>_________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.<wbr>princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.<wbr>edu/mailman/listinfo/chuck-<wbr>users</a><br>
<br></blockquote></div><br></div>