History of SandBox
Webb - all rights reserved - ©2004
 modified by Russell Owen on  2004-10-18 13:56:59Do whatever you like to these pages modified by Al Anway on  2005-01-02 22:45:45Do whatever you like to these pages. All right, already. modified by Udo Pernisz on  2008-09-15 00:48:00Musical Scales Author - Udo Pernisz Email: upernisz@mac.com Webpage: Summary: Tunes to the Standard Pitch or other frequencies; plays major and minor scales. Instructions: After first loading, press the 'About' button to initialize values.  Switch to Help on RPN's Extra pull-down menu for details on the buttons' functions.  Apart from serving as a tuning fork this represents a programming exercise - with future upgrades.    Code: RPN.4.f+4 \ tune & play [dialog] D'This program provides the \standard pitch of 440 Hz \and plays a few scales'; [frq] D'Standard pitch (middle a) \tuned to the frequency \of 440 Hz '; [play] f0 xe S f0; [tune] #'440' =f0 drop play; [drtn] xb; [vlm] xc; [f0] xa; [cmbn] drtn vlm + Xe; [=drtn] #'100' * Xb cmbn xb; [=vlm] Xc cmbn xc; "tune & play" "About: Press this button first. \Enter values before \choosing a function." dialog drop 2 ln 6/ exp Xd xb 0 > ( : 4 =drtn ) xc 0 > ( : 2 =vlm ); "frequncy: Enter value in Hz" =f0 xa 90 < ( tune : play ); "  tune: Sets frequency to the \standard pitch of 440 Hz" frq tune; ~ "duration: Enter value in deci-\seconds [ds] e.g. for a duration \of 0.37 s enter the number 3.7" dup 0 > ( : drop 4 ) =drtn; "  volume: Valid entries are\ in the range 0 ... 8" dup 8 > ( drop 2 : ) =vlm; " play: Plays the note to which\ it is tuned." play; ~ "maj" f0 Xf 7 V {xf xe S xf xd * Xf v 5 =0 ( xf xd sqrt / Xf ) v 1 =0 ( xf xd sqrt / Xf ) _v}; "min" f0 Xf 7 V {xf xe S xf xd * Xf v 6 =0 ( xf xd sqrt / Xf ) v 3 =0 ( xf xd sqrt / Xf ) _v}; "min+" f0 Xf 7 V {xf v 1 =0 ( xd sqrt * ) xe S xf xd * Xf v 6 =0 ( xf xd sqrt / Xf ) v 3 =0 ( xf xd sqrt / Xf ) _v}; "prmt: Displayed in lines 1...4:\1- duration [ms]     2- volume\3- combined   4- frequency [Hz]" xb xc xe xa 0; #end#