anybody still use this thing?
Yo, it's Colton. I am a 15 year old boy in the US, and I am blind. ChucK has been the only audio language I can pick up and use, thanks to it's command line support. The mini audical is completely unusable, just like other ides for things such as super collider. I do have some questions about chuck, and I was wondering if anybody still used this thing that would be willing to answer. I need a guru!
Hi Colton,
We aren'tt guru's but use chuck for learning and fun.
We have a program to teach programming to young boys using chuck in the
dancefloor, mostly live coding in our city, Medellin (Colombia, South
America).
I am curious in the way you want to use chuck and will be ready to help in
basic issues.
regards,
Federico López
algo0ritmos
http://wiki.son0p.net/aprendizaje/algo-ritmos/start
On Sun, Sep 4, 2016 at 12:01 PM, Colton Hill
Yo, it's Colton. I am a 15 year old boy in the US, and I am blind. ChucK has been the only audio language I can pick up and use, thanks to it's command line support. The mini audical is completely unusable, just like other ides for things such as super collider. I do have some questions about chuck, and I was wondering if anybody still used this thing that would be willing to answer. I need a guru! _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Also, you might consider using csound. There are various good ways to
incorporate pieces of csound code into your Chuck programs, depending on
your operating system, & the mailing list for it is full of knowledgable,
helpful users & developers.
On Sun, Sep 4, 2016 at 4:23 PM, federico lopez
Hi Colton,
We aren'tt guru's but use chuck for learning and fun.
We have a program to teach programming to young boys using chuck in the dancefloor, mostly live coding in our city, Medellin (Colombia, South America).
I am curious in the way you want to use chuck and will be ready to help in basic issues.
regards,
Federico López algo0ritmos http://wiki.son0p.net/aprendizaje/algo-ritmos/start
On Sun, Sep 4, 2016 at 12:01 PM, Colton Hill
wrote: Yo, it's Colton. I am a 15 year old boy in the US, and I am blind. ChucK has been the only audio language I can pick up and use, thanks to it's command line support. The mini audical is completely unusable, just like other ides for things such as super collider. I do have some questions about chuck, and I was wondering if anybody still used this thing that would be willing to answer. I need a guru! _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Hi Colton,
Welcome to ChucK! It has been around for over a decade and is being used
all over the world by researchers, academics, hobbyists, musicians, and so
forth. It's very much still a popular audio programming language. There is
an online course (which is currently out of session, but will be back in
session over the coming months). It will be available at the following
link:
https://www.kadenze.com/courses/introduction-to-programming-for-musicians-an....
An in-depth book has recently been written by the designers of ChucK; there
is an e-book. It is available here:
https://www.manning.com/books/programming-for-musicians-and-digital-artists.
This mailing list is also quite a useful tool for anyone needing assistance
or needing to report bugs. There is documentation available online, and
there are some great example files. The example files (alongside the book)
would be a great first step in learning the language.
When asking for assistance, be sure to include as much information as you
can (such as your operating system and any necessary code). Happy Chucking!
Cheers,
Diana
On Mon, Sep 5, 2016 at 12:23 PM, Forrest Curo
Also, you might consider using csound. There are various good ways to incorporate pieces of csound code into your Chuck programs, depending on your operating system, & the mailing list for it is full of knowledgable, helpful users & developers.
On Sun, Sep 4, 2016 at 4:23 PM, federico lopez
wrote: Hi Colton,
We aren'tt guru's but use chuck for learning and fun.
We have a program to teach programming to young boys using chuck in the dancefloor, mostly live coding in our city, Medellin (Colombia, South America).
I am curious in the way you want to use chuck and will be ready to help in basic issues.
regards,
Federico López algo0ritmos http://wiki.son0p.net/aprendizaje/algo-ritmos/start
On Sun, Sep 4, 2016 at 12:01 PM, Colton Hill
wrote:
Yo, it's Colton. I am a 15 year old boy in the US, and I am blind. ChucK has been the only audio language I can pick up and use, thanks to it's command line support. The mini audical is completely unusable, just like other ides for things such as super collider. I do have some questions about chuck, and I was wondering if anybody still used this thing that would be willing to answer. I need a guru! _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Hi Colton, Welcome! Glad you’re trying ChucK out. As far as I understand, quite a few universities have already included it in their courses, and it seems like the community is growing quite a bit. As Diana said, the e-book is a great resource, and you will also be able to find a lot of information in the built-in examples or online. Also, if you’re interested in the Kadenze course from her link, you should definitely check it out; Kadenze courses are constantly running in an adaptive schedule mode, so you can just start whenever and learn at your own pace. Finally… Ask away, and don’t be afraid to include your code whenever you ask any questions. This will make it easier for everyone to understand what you’re trying to do, and you will get a lot more ideas to play around with. Have fun! JP
On Sep 4, 2016, at 8:23 PM, Diana Siwiak
wrote: Hi Colton,
Welcome to ChucK! It has been around for over a decade and is being used all over the world by researchers, academics, hobbyists, musicians, and so forth. It's very much still a popular audio programming language. There is an online course (which is currently out of session, but will be back in session over the coming months). It will be available at the following link: https://www.kadenze.com/courses/introduction-to-programming-for-musicians-an... https://www.kadenze.com/courses/introduction-to-programming-for-musicians-an.... An in-depth book has recently been written by the designers of ChucK; there is an e-book. It is available here: https://www.manning.com/books/programming-for-musicians-and-digital-artists https://www.manning.com/books/programming-for-musicians-and-digital-artists. This mailing list is also quite a useful tool for anyone needing assistance or needing to report bugs. There is documentation available online, and there are some great example files. The example files (alongside the book) would be a great first step in learning the language.
When asking for assistance, be sure to include as much information as you can (such as your operating system and any necessary code). Happy Chucking! Cheers, Diana
On Mon, Sep 5, 2016 at 12:23 PM, Forrest Curo
mailto:treegestalt@gmail.com> wrote: Also, you might consider using csound. There are various good ways to incorporate pieces of csound code into your Chuck programs, depending on your operating system, & the mailing list for it is full of knowledgable, helpful users & developers. On Sun, Sep 4, 2016 at 4:23 PM, federico lopez
mailto:fede2001@gmail.com> wrote: Hi Colton, We aren'tt guru's but use chuck for learning and fun.
We have a program to teach programming to young boys using chuck in the dancefloor, mostly live coding in our city, Medellin (Colombia, South America).
I am curious in the way you want to use chuck and will be ready to help in basic issues.
regards,
Federico López algo0ritmos http://wiki.son0p.net/aprendizaje/algo-ritmos/start http://wiki.son0p.net/aprendizaje/algo-ritmos/start
On Sun, Sep 4, 2016 at 12:01 PM, Colton Hill
mailto:colton-hill2014@hotmail.com> wrote: Yo, it's Colton. I am a 15 year old boy in the US, and I am blind. ChucK has been the only audio language I can pick up and use, thanks to it's command line support. The mini audical is completely unusable, just like other ides for things such as super collider. I do have some questions about chuck, and I was wondering if anybody still used this thing that would be willing to answer. I need a guru! _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu mailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users https://lists.cs.princeton.edu/mailman/listinfo/chuck-users _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu mailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu mailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
I know the language, one thing I was mainly looking to do was get a working mml parser for the thing. I want to actually make music and not beeps, and I'm not doing all that junk with coding arrays and things. I am quite familiar with mml, so if anybody can help me with a parser, that would be great. Chuck's string operations are crap though... You need those to parse mml the write way, where commands aren't seperated by spaces, like this. o4l8cdefg. I wrote a basic parser, but it uses the tokenizer to split commands, and I currently, despite checks, get an index out of bounds error and crash an osc when I attempt to put a note without a length...
On 9/4/2016 10:35 PM, JP Yépez wrote:
Hi Colton,
Welcome! Glad you’re trying ChucK out. As far as I understand, quite a few universities have already included it in their courses, and it seems like the community is growing quite a bit.
As Diana said, the e-book is a great resource, and you will also be able to find a lot of information in the built-in examples or online. Also, if you’re interested in the Kadenze course from her link, you should definitely check it out; Kadenze courses are constantly running in an adaptive schedule mode, so you can just start whenever and learn at your own pace.
Finally… Ask away, and don’t be afraid to include your code whenever you ask any questions. This will make it easier for everyone to understand what you’re trying to do, and you will get a lot more ideas to play around with.
Have fun!
JP
On Sep 4, 2016, at 8:23 PM, Diana Siwiak
Hello Colton, I've written a Lisp interpreter in ChucK [1] and went through the parsing stage, among other obstacles. String manipulation is indeed a bit weird, perhaps you're running into a bug where a substring cannot be cut out until the end of a string [2]. If you can get away with it, I recommend using regular expressions to capture a single token, add it to an array of tokens and move forward in the input by its length until the end of input. In this case you might be able to reuse my code. Otherwise you'll need to write a lexer from scratch, for this Jack Crenshaw's compiler tutorial [3] might be useful. Good luck with your endeavor! [1]: https://lists.cs.princeton.edu/pipermail/chuck-users/2016-August/008110.html [2]: https://github.com/ccrma/chuck/issues/55 [3]: http://www.compilers.iecc.com/crenshaw/
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... On 9/5/2016 8:46 AM, Vasilij Schneidermann wrote:
Hello Colton,
I've written a Lisp interpreter in ChucK [1] and went through the parsing stage, among other obstacles. String manipulation is indeed a bit weird, perhaps you're running into a bug where a substring cannot be cut out until the end of a string [2].
If you can get away with it, I recommend using regular expressions to capture a single token, add it to an array of tokens and move forward in the input by its length until the end of input. In this case you might be able to reuse my code. Otherwise you'll need to write a lexer from scratch, for this Jack Crenshaw's compiler tutorial [3] might be useful. Good luck with your endeavor!
[1]: https://lists.cs.princeton.edu/pipermail/chuck-users/2016-August/008110.html [2]: https://github.com/ccrma/chuck/issues/55 [3]: http://www.compilers.iecc.com/crenshaw/ _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On 5 Sep 2016, at 23:16, Colton Hill
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.
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
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@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
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
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
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@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
it's a shame that the dependencies for that setup are linux only, I use windows.
On 9/6/2016 9:51 PM, Michael Heuer wrote:
Hello Colton,
Looks like a good start! Imports/includes are not so great in ChucK. In LiCK, I've resorted to a big import.ckhttp://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
On 5 Sep 2016, at 23:16, Colton Hill
mailto:colton-hill2014@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@lists.cs.princeton.edumailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edumailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edumailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
If you don't have the chugins or LADSPA plugin dependencies, everything
else will still work fine.
On Wed, Sep 7, 2016 at 12:44 PM, Colton Hill
it's a shame that the dependencies for that setup are linux only, I use windows.
On 9/6/2016 9:51 PM, Michael Heuer wrote:
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
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
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@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing listchuck-users@lists.cs.princeton.eduhttps://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
I have the chugins, I can't use ladspa on windows this way, I also can't build the caps.
On 9/7/2016 12:47 PM, Michael Heuer wrote:
If you don't have the chugins or LADSPA plugin dependencies, everything else will still work fine.
On Wed, Sep 7, 2016 at 12:44 PM, Colton Hill
On 5 Sep 2016, at 23:16, Colton Hill
mailto:colton-hill2014@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@lists.cs.princeton.edumailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edumailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edumailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edumailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edumailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
I dont think you can use regex to match a whole expression like that but
you can use it to pick off bits and pieces. Just make a regex that matches
all of the possible commands + options and run that through, advancing the
string position each time. Eg
"o4l8cdefg" => string code;
string matches[0];
"((o)([0-9]+)|([abcdefg])(1|2|4|8|16)?|(l)([0-9]+))" => string pattern;
for(0 => int i; i < code.length(); )
{
if(RegEx.match(pattern, code.substring(i), matches))
{
if(matches[2] == "o")
<<< "octave:", matches[3] >>>;
else if(matches[4] == "a")
<<< "a" >>>;
// etc.
matches[0].length() +=> i;
}
else
{
<<< "invalid code" >>>;
break;
}
}
I dont know anything about MML so I dont know what the final regex would
look like.
Another option is to just go through the string iteratively and look at
each character one at a time. If whitespace is undesirable StringTokenizer
might be hurting more than helping here.
for(0 => int i; i < code.length(); )
{
int c = code.charAt(i);
if(c == 'o')
{
// look for number
}
else if(c == 'a' || c == 'b' || ... )
{
// see if number follows
}
}
spencer
On Tue, Sep 6, 2016 at 6:32 PM, Colton Hill
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
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@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- Spencer Salazar Doctoral Candidate Center for Computer Research in Music and Acoustics Stanford University spencer@ccrma.stanford.edu +1 831.277.4654 https://ccrma.stanford.edu/~spencer/
that's the issue. I would slowly go through the string and parse down every command, if I knew how to grab numbers and things between one command and the next. For example, c8.c8
On 9/7/2016 7:44 PM, Spencer Salazar wrote:
I dont think you can use regex to match a whole expression like that but you can use it to pick off bits and pieces. Just make a regex that matches all of the possible commands + options and run that through, advancing the string position each time. Eg
"o4l8cdefg" => string code;
string matches[0];
"((o)([0-9]+)|([abcdefg])(1|2|4|8|16)?|(l)([0-9]+))" => string pattern;
for(0 => int i; i < code.length(); )
{
if(RegEx.match(pattern, code.substring(i), matches))
{
if(matches[2] == "o")
<<< "octave:", matches[3] >>>;
else if(matches[4] == "a")
<<< "a" >>>;
// etc.
matches[0].length() +=> i;
}
else
{
<<< "invalid code" >>>;
break;
}
}
I dont know anything about MML so I dont know what the final regex would look like.
Another option is to just go through the string iteratively and look at each character one at a time. If whitespace is undesirable StringTokenizer might be hurting more than helping here.
for(0 => int i; i < code.length(); )
{
int c = code.charAt(i);
if(c == 'o')
{
// look for number
}
else if(c == 'a' || c == 'b' || ... )
{
// see if number follows
}
}
spencer
On Tue, Sep 6, 2016 at 6:32 PM, Colton Hill
On 5 Sep 2016, at 23:16, Colton Hill
mailto:colton-hill2014@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@lists.cs.princeton.edumailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edumailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users -- Spencer Salazar Doctoral Candidate Center for Computer Research in Music and Acoustics Stanford University spencer@ccrma.stanford.edumailto:spencer@ccrma.stanford.edu +1 831.277.4654 https://ccrma.stanford.edu/~spencer/https://ccrma.stanford.edu/%7Espencer/ _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edumailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Store whatever the current command state is (e.g. character and number) and
then keeping modifying that until you reach whatever is considered a new
command, at which point the previous command is executed. E.g.
0 => int cmdc;
float cmdnum;
for(...)
{
if(letter == 'a')
{
// dispatch previous command
if(cmdc)
doCmd(cmdc, cmdnum);
// store new command
letter => cmdc;
0 => cmdnum;
}
// further down ...
// if is number
else if(letter >= 48 && letter <= 57)
{
cmdnum*10 + (letter-48) => cmdnum;
}
}
doCmd plays whatever the command is and needs to use the appropriate
default if cmdnum is 0. Also this doesn't deal with octave/length or
anything like that but I imagine thats straightforward to add on. Probably
most of the letter if-statements could be folded into a single if. You may
need to keep additional state variables for the command if there are other
properties besides pitch class and duration, like octave (and intensity?).
spencer
On Wed, Sep 7, 2016 at 5:52 PM, Colton Hill
that's the issue. I would slowly go through the string and parse down every command, if I knew how to grab numbers and things between one command and the next. For example, c8.c8
On 9/7/2016 7:44 PM, Spencer Salazar wrote:
I dont think you can use regex to match a whole expression like that but you can use it to pick off bits and pieces. Just make a regex that matches all of the possible commands + options and run that through, advancing the string position each time. Eg
"o4l8cdefg" => string code; string matches[0]; "((o)([0-9]+)|([abcdefg])(1|2|4|8|16)?|(l)([0-9]+))" => string pattern;
for(0 => int i; i < code.length(); ) { if(RegEx.match(pattern, code.substring(i), matches)) { if(matches[2] == "o") <<< "octave:", matches[3] >>>; else if(matches[4] == "a") <<< "a" >>>; // etc.
matches[0].length() +=> i; } else { <<< "invalid code" >>>; break; } }
I dont know anything about MML so I dont know what the final regex would look like.
Another option is to just go through the string iteratively and look at each character one at a time. If whitespace is undesirable StringTokenizer might be hurting more than helping here.
for(0 => int i; i < code.length(); ) { int c = code.charAt(i); if(c == 'o') { // look for number } else if(c == 'a' || c == 'b' || ... ) { // see if number follows } }
spencer
On Tue, Sep 6, 2016 at 6:32 PM, Colton Hill
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
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@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- Spencer Salazar Doctoral Candidate Center for Computer Research in Music and Acoustics Stanford University
spencer@ccrma.stanford.edu +1 831.277.4654 https://ccrma.stanford.edu/~spencer/
_______________________________________________ chuck-users mailing listchuck-users@lists.cs.princeton.eduhttps://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- Spencer Salazar Doctoral Candidate Center for Computer Research in Music and Acoustics Stanford University spencer@ccrma.stanford.edu +1 831.277.4654 https://ccrma.stanford.edu/~spencer/
On 5 Sep 2016, at 11:54, Colton Hill
wrote: I know the language, one thing I was mainly looking to do was get a working mml parser for the thing. I want to actually make music and not beeps,
I wrote two files for playing regular and irregular tunings on the computer keyboard, which is polyphonic. The code might help with making parallel pitches. https://secure2.storegate.com/Shares/Home.aspx?ShareID=f2f70b60-a7f7-4d15-9c...
Hi Colton. Well, wouldn't classify myself as a guru, but I have programmed in chuck a fair amount, and am also blind, so I totally get your frustration! What kind of things are you wanting to do with it? The most frustrating part for me is no gui support - not in terms of integrated development environments, but for the running chuck program itself. Apparently, audical can be used as a GUI for the running chuck program as well as development. I tried two approaches to solve this, neither vary optimal: using chuck events to listen to keyboard directly and then build a simple set of single character commands. For instance: up/down arrows to adjust a value and tab to tab among parameters. All output was simply written to the standard output which the screen reader would read, most of the time... the second used a node.js server to communicate with chuck via OSC (open sound control), and with a web browser. The browser ran the GUI which allowed tabbing among parameters and changing values, and the server would turn messages from the program running in the browser to OSC commands which chuck could act upon. This was better, but in my opinion has too many moving parts as it were: too complicated... -- Rich From: Colton Hill Sent: Sunday, September 04, 2016 1:01 PM To: chuck-users@lists.cs.princeton.edu Subject: [chuck-users] anybody still use this thing? Yo, it's Colton. I am a 15 year old boy in the US, and I am blind. ChucK has been the only audio language I can pick up and use, thanks to it's command line support. The mini audical is completely unusable, just like other ides for things such as super collider. I do have some questions about chuck, and I was wondering if anybody still used this thing that would be willing to answer. I need a guru! _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
I want to make music with it. And I wanna use mml, as I am quite familiar with the syntax. I want a class that accomplishes two things. Mml parsing into frequencies, lengths, etc, and customizability where I give it a function to play with. I've managed to write a very hacked basic one throwing objects at a function to put a function inside the object... On 9/5/2016 1:46 PM, Rich Caloggero wrote: Hi Colton. Well, wouldn't classify myself as a guru, but I have programmed in chuck a fair amount, and am also blind, so I totally get your frustration! What kind of things are you wanting to do with it? The most frustrating part for me is no gui support - not in terms of integrated development environments, but for the running chuck program itself. Apparently, audical can be used as a GUI for the running chuck program as well as development. I tried two approaches to solve this, neither vary optimal: using chuck events to listen to keyboard directly and then build a simple set of single character commands. For instance: up/down arrows to adjust a value and tab to tab among parameters. All output was simply written to the standard output which the screen reader would read, most of the time... the second used a node.js server to communicate with chuck via OSC (open sound control), and with a web browser. The browser ran the GUI which allowed tabbing among parameters and changing values, and the server would turn messages from the program running in the browser to OSC commands which chuck could act upon. This was better, but in my opinion has too many moving parts as it were: too complicated... -- Rich From: Colton Hillmailto:colton-hill2014@hotmail.com Sent: Sunday, September 04, 2016 1:01 PM To: chuck-users@lists.cs.princeton.edumailto:chuck-users@lists.cs.princeton.edu Subject: [chuck-users] anybody still use this thing? Yo, it's Colton. I am a 15 year old boy in the US, and I am blind. ChucK has been the only audio language I can pick up and use, thanks to it's command line support. The mini audical is completely unusable, just like other ides for things such as super collider. I do have some questions about chuck, and I was wondering if anybody still used this thing that would be willing to answer. I need a guru! _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edumailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edumailto:chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
participants (10)
-
Colton Hill
-
Diana Siwiak
-
federico lopez
-
Forrest Curo
-
Hans Åberg
-
JP Yépez
-
Michael Heuer
-
Rich Caloggero
-
Spencer Salazar
-
Vasilij Schneidermann