diff --git a/context-free.md b/context-free.md index 8d9c470..0220026 100644 --- a/context-free.md +++ b/context-free.md @@ -1,22 +1,24 @@ # Context Free ## Who is this programming language for? - +For people who want to create computer art. It seems to be for artists who want a lot of control over what they are making, as only very basic shapes exists and so everything you would want to make needs to be custom designed. ## What is easy to do in this language? Why is it easy? - +It is easy to create visual shapes, as you can simply define the shape into existence and then describe parameters on how it should look. It is easy because the language syntax is dedicated toward creating shapes, and the execution automatically shows you what you are making. It is also very easy to do recursive shapes/designs rather than hand-coding/drawing each shape, as they allow looping and recursive constructs. ## What is hard to do in this language? Why is it hard? - +It is harder to quickly put what you are thinking visually into code. While it seems every shape/design is doable in Context Free, some require more thought than it might be to simply free-hand a shape. It is hard because everything is written in code, which for some abstract/less pattern oriented art, it can be more difficult to imagine how it should be described in code. ## How did you learn how to program in this language? - +I looked at the "documentation", which was just an introduction describing the difference between version 2 and 3, and I looked at some art in the gallery to see what is possible, although didn't look into the code they used to create their art. ## What is the underlying _computational model_ for this programming language? _We don't yet have a great definition of the term "computational model". For now, try to come up with the clearest, most concise explanation of what happens when a ContextFree program runs._ +I would assume there is some underlying Cartesian coordinate system to describe what should be at each point/pixel, and for each shape definition, there are functions for circle, square, etc. in how they should generated with regards to the parameters. As the function is being computed, corresponding pixels are filled in with the visual parameters of color, brightness, etc. -## What do you think is interesting about the ContextFree program you wrote? +## What do you think is interesting about the ContextFree program you wrote? +I think what is interesting is the mix of recursive programming with the cycling of shapes as the background, in conjunction with the more "hard-coded" letters "DSL" which required more incremental testing to ensure that it turned out good. diff --git a/matt_cook.cfdg b/matt_cook.cfdg new file mode 100644 index 0000000..c241c80 --- /dev/null +++ b/matt_cook.cfdg @@ -0,0 +1,61 @@ +startshape MYART + +rule MYART { + CIRCLEREC{z -0.5 } + DSL { hue 360 sat 1 b 1 } +} + +rule DSL { + D { x -3.5 y 0.5 } + S { x 0.5 y 0.25 } + L { x 3 y 0.5} +} + +rule D { + LINE { y 0.2 r 0 s 0.4 } + ARCD {x 3 y 5 s 0.4 } + ARCD {x 3 y 5 r 180 flip 90 s 0.4 } +} + +rule S { + ARCS { y 5 flip 100 s 0.4 } + ARCS { y 5 r 200 flip 90 s 0.4 } + +} + +rule L { + LINE {s 0.4 } + LINE { s 0.15 x 0.3 r -90 y 0} +} + +rule ARCD { + SQUARE { } + ARCD { size 0.97 y 0.55 r 1.5 } +} + +rule ARCS { + SQUARE { } + ARCS { s 0.97 y 0.55 r 2 } +} + +rule LINE { + TRIANGLE [ s 1 30 y 0.26 ] +} + + +rule CIRCLEREC { + CIRCLE { hue 225 sat 0.7 b 0.6 } + SQUAREREC { x 1 r 10 s 0.995 } +} + +rule SQUAREREC { + SQUARE {hue 120 sat 0.5 b 1 } + TRIANGLEREC { x 1 r 10 s 0.995 } +} + +rule TRIANGLEREC { + TRIANGLE {hue 210 sat 0.5 b 1 } + CIRCLEREC { x 1 r 10 s 0.995 } +} + + diff --git a/matt_cook_jmh.png b/matt_cook_jmh.png new file mode 100644 index 0000000..2337674 Binary files /dev/null and b/matt_cook_jmh.png differ diff --git a/my-dsl.md b/my-dsl.md index 3bbac9a..c591983 100644 --- a/my-dsl.md +++ b/my-dsl.md @@ -2,37 +2,48 @@ _What is the name of the language? Link the name to its webpage (if appropriate)._ + The name of the language is [Csound](http://www.csounds.com/). # Domain _Describe the language's domain in five words._ + Modular and extensible audio programming. # Computational model _What is the underlying computational model of this language? To answer this question, provide a high-level description (no more than 100 words) of the computation that occurs when someone executes a program in this language._ + Wave files are produced using _orchestra_ and _score_ files that define the instruments, notes, and other audio parameters. This is done through unit generators (also known as opcodes), which use predefined arrays of values that describe waveforms of specific frequencies. If the waveform is not predefined, the unit generator uses the function for that waveform to determined the values. + # DSL-ness _Fowler writes about a spectrum of languages, from general-purpose languages to "purely" domain-specific. Where does the DSL you chose fall on this spectrum, and why?_ +Csound is at a point in the spectrum close to a "purely" domain-specific language, as all it is really used for is for audio programming or as a sound compiler. Csound is easily extensible as it is completely modular, the expressiveness of Csound is limited in that it can only be used to define different sounds at specific points in time. # Internal or external? _Is the language implemented as an internal or external DSL? Justify your answer._ +Csound is an external DSL, because although it is written in C it is self-contained and separate from C. Csound uses syntax that would not be valid in C, and thus cannot be an internal DSL. # Host language _What language(s) was (were) used to implement the DSL?_ +C! # Benefits _Identify one potential benefit of the DSL: how is a programmer's life or a company's bottom line made easier by the existence of this language?_ +This language offers a lot of flexibility over synthesized audio as you can very carefully articulate exactly what type of instruments, notes, and timing you want. Also, because there are already many unit generators, Csound can make synthesized sound very cheap as you do not have the cost of instrumental recordings and such if you were to do it in a general-programming language (although libraries could exist for that in some languages as well) + # Drawbacks _Identify one potential drawback of the DSL: what does a programmer or company -lose by using this DSL instead of a general-purpose language?_ +lose by using this DSL instead of general-purpose language?_ + +Hand coding the _orchestra_ and _score_ files can become tedious, which combined with the limits of the strict syntax, can make it pretty difficult to truly express the music the programmer/composer is trying to create. The one way to overcome this drawback is to use Csound in conjunction with another language/tool, which still has the downside of making it harder to connect all of the pieces and logic.