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.

/* REXX ---------------------------------------------------------------
* 24.02.2013 Walter Pachl derived from original REXX version
* Changes: sound(f,sec) --> beep(trunc(f),millisec)
*          $ -> sc
*          @. -> f.
*          re > ra (in sc)
*--------------------------------------------------------------------*/
  sc='do ra mi fa so la te do'
  dur=1250                          /* milliseconds                   */
  Do j=1 For words(sc)              /* sound each "note" in the string*/
    Call notes word(sc,j),dur       /* invoke a subroutine for sounds.*/
    End                             /* j                              */
  Exit                              /* stick a fork in it, we're done.*/
notes: Procedure
  Arg note,dur
  f.=0                              /* define common names for sounds.*/
  f.la=220
  f.si=246.94
  f.te=f.si
  f.ta=f.te
  f.ti=f.te
  f.do=261.6256
  f.ut=f.do
  f.ra=293.66
  f.re=f.ra     /* re is to be a synonym for ra */
  f.mi=329.63
  f.ma=f.mi
  f.fa=349.23
  f.so=392
  f.sol=f.so
  Say note trunc(f.note) dur
  If f.note\==0 Then
    Call beep trunc(f.note),dur     /* sound the "note".              */
  Return