[chuck-users] anybody still use this thing?

Michael Heuer heuermh at gmail.com
Tue Sep 6 22:51:10 EDT 2016


Hello Colton,

Looks like a good start!  Imports/includes are not so great in ChucK.  In
LiCK, I've resorted to a big import.ck file

https://github.com/heuermh/lick/blob/master/import.ck

There are a lot of functional-ish classes in LiCK, if you wanted to pass
around play functions as objects.

class MmlParser
{
  Play @ play;

  // ... parse stuff, spork ~ play.play(freq, nlength, qlength, vol), ...
}

class Play // "abstract" class, since there are no interfaces in ChucK
{
  fun void play(float freq, dur nlength, dur qlength, float vol)
  {
    // empty
  }
}

class PlayNote extends Play
{
  SinOsc sin => ADSR adsr => dac;

  fun void play(float freq, dur nlength, dur qlength, float vol)
  {
    freq => sin.freq;
    vol => sin.gain;
    1 => adsr.keyOn;
    nlength => now;
    1 => adsr.keyOff;
    qlength => now;
  }
}

MmlParser mmlParser;
PlayNote playNote;
playNote @=> mmlParser.play;

mmlParser.parse(input);

   michael


On Tue, Sep 6, 2016 at 8:32 PM, Colton Hill <colton-hill2014 at hotmail.com>
wrote:

> I also want to make sure I have a customizable play function that will
> handle my playing. Here's the code I've been using for my current mml
> parser in chuck, actually does take a code string and a play function,
> and operates well. Only issue is including doesn't work... So have a test.
>
>
> On 9/6/2016 3:33 AM, Hans Åberg wrote:
> >> On 5 Sep 2016, at 23:16, Colton Hill <colton-hill2014 at hotmail.com>
> wrote:
> >>
> >> I know regular expressions syntax, but I really don't know how I would
> >> manage to make an mml parser that actually works. Turn o4l8cdefg into
> >> octave 4, length 8, and c d e f g notes with an 8th note length since no
> >> length is specified. Then there's c4., which is c4^c8... Just bla…
> > There are free MML parsers in C out there. Linking to ChucK, which is
> written in C++, might be a way.
> >
> >
> > _______________________________________________
> > chuck-users mailing list
> > chuck-users at lists.cs.princeton.edu
> > https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20160906/23faedf0/attachment.html>


More information about the chuck-users mailing list