
-----------------------------------
Dan
Thu Dec 19, 2002 8:46 pm

[Tutorial]How to use sound and music in Turing
-----------------------------------
How to use sound and music in Turing


There are several different methods of adding music and sound to your games and programs. The main methods are using the play command, the Music command and the sound comand.

The Code:

      Play

play ("Notes")

notes are a b c d e f g

> and < will change the octave

flats are - ; sharps are +
to change the length of the note put a number in front of it. 1 (whole note), 2 (half note), 4 (quarter note), 8 (eight note) and 6 (sixteenth note)

p will add rests to the song

		
     Music
	Music.PlayFile ("filename") %play a sound or music file

	Music.SoundOff  %stop playing the file

         Note: playable file types are wav, snd, mod, and mid (mp3 too in newer turings)


      Sound
	sound (frequency, duration) %time is in milliseconds


How to use the code:

Note: Turing will play the whole file or string of notes before it cautions along with the rest of the code. To run music or sound and run your program at the same time you need to use a fork

Play code

        Simple examples


        play ("8abcdefgfedcba") %some eighth notes in a higher octave
        play ("