The Prompt Commands - HP 39gs Master Manual

Graphing calculator
Hide thumbs Also See for 39gs:
Table of Contents

Advertisement

T
h
e
P
r
o
m
p
t
c
o
m
T
h
e
P
r
o
m
p
t
c
o
m
BEEP <frequency>;<duration>
This will use the piezo crystal in the calculator to create a sound of the specified frequency for the specified
duration (in seconds). The resulting frequency is not terribly accurate, varying by up to 5% from one
calculator to the next and depending also on the temperature. If you want accuracy then use a piano! The
volume is also not very loud because of concerns with interruptions to tests and examinations. Any frequency
can be produced using the
information below will help with this.
The frequencies of the twelve semi-tone jumps in the normal Western harmonic
scale form a geometric sequence, and since the ratio from C to C' is 2, the
ratio for each semi-tone must be
instruments is usually 440 cycle/sec for the note A. Since much of the simple
music used by students is written using the scale of C, we use
find the frequency of C as 261.6 cycles/sec.
We can use this to form a standard 'header' for any program we want to use
to play music. The header shown right in the rounded box sets up the scale of
C major. The code which then follows plays the first two bars of the tune
"Strangers in the Night".
In this header, the duration of a note (T) is set to 0.5 seconds. It is easy to
change the tempo of the music by adjusting this. In this case you may find
that the music sounds a little better with T set to 0.55 or 0.6 seconds. T is a
crotchet, T/2 a quaver etc.
CHOOSE <variable>;<title>;<menu option1>;....
This command pops up a menu with the title specified
and with however many options follow. The number of
the menu option highlighted when the user presses
is returned in the variable.
It is particularly important to the use of this command to
realise that the initial value of the variable before the
statement determines which option is initially highlighted. This value
must be a valid one in the sense that it must refer to one of the lines in
the list you have defined. Assigning an initial value outside the range of
the menu may crash the program. In particular, the default value for any variable is zero and this is not a
legal list line so failing to pre-define a value may crash your program. If the user presses
of zero is returned but the program will still continue to execute from that point unless you include code to
check for the cancellation and take action to terminate it or take some other action.
m
a
n
d
s
m
a
n
d
s
command but most people are interested in using it to play tunes. The
BEEP
. The standard frequency used in tuning
12
2
to
9
12
440 /(
2)
CHOOSE
294
then a value

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

40gs

Table of Contents