Slide 36
Slide 36 text
MUSIGOL(Innis 1968)
First "DSL as a Library" for MUSIC
real procedure Sinoscil(Time, Frequency, Amplitude);
value Time, Frequency, Amplitude;
real Time, Frequency, Amplitude;
begin
real X, XX;
X := (6.2831853072 * Frequency * Time) MOD 6.2831853072;
if abs(X - 3.1415926536) < 0.0315 then Sinoscil := Amplitude * (3.1415926536 - X) else if abs(X - 6.283185307) < 0.0315
then Sinoscil := Amplitude * (X - 6.2831853072) else
begin
if X > 3.1415926536 then X := X - 6.28318503072;
XX := sign(X);
X := abs(X);
X := if X > 1.5707963268 then XX * 0.636619772 * (3.1415926536 - X) else X * XX * 0.636619772;
XX := X * X;
Sinoscil := X * (1.570794852 + XX * (-0.645920978 + XX *
(0.079487663 - 0.004362476 * XX))) * Amplitude;
end;
end Sinoscil;
Both the system and the user codes are entirely written in ALGOL 60.
procedure Score;
begin
Boing(-3, -1.5, 20, E4);
Boing(-3.5, -4, 15, Slope(-3.5, -4, CS4, C9));
...
Speaker(OUTS, 100);
end of Score;