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.

--
-- demo\rosetta\Musical_scale.exw
--
with javascript_semantics
include pGUI.e
include builtins\beep.e

constant freq = {261.63,293.66,329.63,349.23,392,440,493.88,523.25},
    durations = repeat(500,length(freq)-1) & 1000

function button_cb(Ihandle /*playbtn*/)
    beep(freq,durations,0.5)
    return IUP_DEFAULT
end function

IupOpen()
Ihandle label = IupLabel("Please don't shoot the piano player, he's doing the best that he can!"),
        playbtn = IupButton("Play",Icallback("button_cb"),"PADDING=30x0"),
        hbox = IupHbox({IupFill(),playbtn,IupFill()},"MARGIN=0x20"),
        vbox = IupVbox({label,hbox}, "MARGIN=10x5, GAP=5"),
        dlg = IupDialog(vbox,`TITLE="Musical Scale"`)
IupShow(dlg)
if platform()!=JS then
    IupMainLoop()
    IupClose()
end if
