-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assignment 1 - Matt Cook #13
base: master
Are you sure you want to change the base?
Changes from all commits
e6b7047
03481bb
c1d0004
89ee3b9
736961e
e5be53a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also did something recursive, along with trying to make letters, and discovered that the letters were much more difficult. I guess it's because Context Free is supposed to be for art/shapes, and letters aren't quite art or shapes. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 } | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is clever 👍. I struggled with arcs in my letters, and ended up just going with lines because it was too hard to adjust them correctly/make them look good, but this doesn't look too bad. |
||
|
||
rule ARCS { | ||
SQUARE { } | ||
ARCS { s 0.97 y 0.55 r 2 } | ||
} | ||
|
||
rule LINE { | ||
TRIANGLE [ s 1 30 y 0.26 ] | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see you also looked at the welcome code :) |
||
|
||
|
||
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 } | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does "audio programming" mean? Can you actually write functions to generate audio? That is how I would interpret audio programming, although my first thought on reading it was that it was merely a sort of markup language for sound. |
||
|
||
# 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! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Such excitement about one of my least favorite languages... |
||
|
||
# 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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an interesting drawback. I felt this way about Context Free as well, and in general, I feel like there are a number of DSLs that are much easier to write procedurally using another language than they are to hand code (HTML and SQL are two more that come to mind, although there are people that hand code both of them) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree about abstract art. That was originally what I was going to try to make, but then I realized it was very hard with randomness as the only tool, because abstract art is often can look random, but is not actually random at all.
You can sort of free-hand using paths, but I agree it's not as easy as it could be.