[plt-scheme] code organization question
Yoav Goldberg wrote:
>...
>
>(The code is a library for musical objects.)
>
>I have a type "sound", which is a collection of sound-related things.
>It can be partially specified (ie have some missing elements), and is
>constructed with a keywords like syntax:
>
>(make-sound 'pitch: (make-pitch '(B b) 4) 'duration:
>(make-duration-from-wholes 1/4))
>
>
>
.Hello Yoav
I don't have an answer to your actual question but you might find it
useful to look at Roger Dannenberg's Canon Score Language and Stephen
Travis Pope's Mode, which also use labelled arguments for short hand for
note description (papers are available from the author's respective home
pages).
Roger B. Dannenberg
http://www.cs.cmu.edu/~rbd/
Stephen Travis Pope
http://www.create.ucsb.edu/~stp/
I've been trying to do something similar in Haskell, and at least for
users (rather than other developers wanting to make extended sound or
note types), the shortest shorthand I've come up with is quoted strings
in ABC notation and a parser for them. For Haskell this has the
unfortunate problem of delegating type checking to runtime, but using
proper constructors makes note descriptions very long even with
defaults. Maybe Scheme macros could get help around some of the
'unseemliness' of quoted strings.
As for developers - if you are proposing differing representations of
the note/sound type, you might want to check [1] - for my undergraduate
thesis a few years ago I used the techniques described in this paper to
make a score language in MzScheme that could handle both MIDI and Cmix's
Minc as note representations.
Best wishes
Stephen
[1] ICFP 98 Findler and Flatt
Modular Object-Oriented Programming with Units and Mixins
http://www.ccs.neu.edu/scheme/pubs/icfp98-ff.pdf