Task

Output the 8 notes of the C major diatonic scale to the default musical sound device on the system. Specifically, pitch must be tuned to 12-tone equal temperament (12TET) with the modern standard A=440Hz.

These are the notes "C, D, E, F, G, A, B, C(1 octave higher)", or "Do, Re, Mi, Fa, Sol, La, Si/Ti, Do(1 octave higher)" on Fixed do Solfège.

For the purpose of this task, Middle C (in the case of the above tuning, around 261.63 Hz) should be used as the starting note, and any note duration is allowed.

For languages that cannot utilize a sound device, it is permissible to output to a musical score sheet (or midi file), or the task can be omitted.

\Square waves on the beeper speaker:
code Sound=39;
real Period;  int I;
[Period:= 1190000.0/261.625565;     \middle C
for I:= 2 to 9 do
    [Sound(1, 4, fix(Period));      \times 2^(-1/6) else 2^(-1/12)
    Period:= Period * (if I&3 then 0.890898719 else 0.943874313);
    ];
]
 
\MIDI grand piano (requires 32-bit Windows or Sound Blaster 16):
code Sound=39;
int  Note, I;
[port($331):= $3F;      \set MPU-401 into UART mode
Note:= 60;              \start at middle C
for I:= 2 to 9+1 do     \(last note is not played)
    [port($330):= $90;  port($330):= Note;  port($330):= $7F;
    Sound(0, 4, 1);     \This "Sound" is off, but convenient 0.22 sec delay
    Note:= Note + (if I&3 then 2 else 1);
    ];
]