Sounds and Music

There are three ways to incorporate sounds into your MSW Logo procedures: Sound, SoundOn/SoundOff and Playwave.

Sound [<frequency> <duration>]

Using the Sound [<frequency> <duration>] command. eg sound [523 200] will play the note "C" for 200 "clock ticks" (a clock tick is approximately 1/60th of a second).

Musical Note

Frequency (Hz)

'Scale'

A

440.00

do

A#

466.16 

-

B

493.88

re

C  

523.25

-

C#

554.37

mi

D

587.33

fa

D#

622.25 

-

E

659.26

sol

F

698.46 

-

F#

739.99

la

G

783.99 

-

G#

830.61

ti

A2

880.00

do

For further information see: http://www.ora.com/reference/dictionary/terms/S/Scale.htm

SoundOn/SoundOff

This command gives more control than the previous command. In this case the sound will play until it is turned off.

soundOn 500
wait 250
; waits 250 'clock ticks'
soundOff

Playwave "<file location><file name><flags>

This command may be used to play a ".WAV" file from a disk.

playwave "C:\\apw\\sounds\\clapping.wav 1 + 8

The "flags" indicate how you want the sound played:

0 = Synchronous does not return until completed. (ie wait until done)
1 = Asynchronous returns immediately while sound is still playing. (ie concurrent)
2 = Don't use the default sound if the specified one cannot be found.
8 = Continue to loop the sound until another sound command is issued.
16 = Don't stop an already playing sound.

NOTE: You must leave a space after playwave and before the quotation mark. You must use the double backslash. Flags can be combined by adding them together.

For information on MIDI see here.

<- Back -Menu- Next ->