sound and music


advancemusic

Takes:   none

Returns:   none

Advances (and plays) one line of a currently paused music track. You can use advancemusic to programmatically control the tempo of a song (typically inside a worker), to speed it up or slow it down as required.

advancemusic


attenuate

Takes:   none

Returns:   none

Turns on attenuation of the calling turtle’s sound output. See setattenuation, noattenuate

attenuate


attenuation

Takes:   none

Returns:   number

Returns the attenuation value, which is 0.3 by default. This value affects all turtles that attenuate. See setattenutation, attenuate

show attenuation


audiowait

Takes:   none

Returns:   none

Causes toot, noise, playnotes and playsound to ‘block’ or hold up turtle execution while they play. See noaudiowait

audiowait


beep

Takes:   none

Returns:   none

Triggers the system beep.

beep


clearmusic

Takes:   none

Returns:   none

Clears all music from memory.

clearmusic


clearsong

Takes:   musicname (word)

Returns:   none

Clears the specified song (music) from memory.

clearsong "mymusic


clearsound

Takes:   soundname (word)

Returns:   none

Clears the specified sound from memory.

clearsound "mysound


clearsounds

Takes:   none

Returns:   none

Clears all user-defined sounds from memory.

clearsounds


loadsound

Takes:   soundname (word) | filename (word) or URL (word)

Returns:   none

Loads the given sound filename or URL into the given sound definition. A provided URL must have pipes around it (longword). turtleSpaces uses the ‘ogg’ file format. See playsound

loadsound "honk "honk.ogg


loopsound

Takes:   word

Returns:   none

Repeatedly plays the sound indicated by the provided word. Does not respect audiowait. Stop it with stopsound. See stopsound

loopsound "sheep


music

Takes:   none

Returns:   list

Returns a list of the currently loaded music.

show music


musicspeed

Takes:   none

Returns:   number

Returns the current music speed.

show musicspeed


musicvolume

Takes:   none

Returns:   number

Returns the calling turtle’s music volume.

show musicvolume


noaudiowait

Takes:   none

Returns:   none

Causes the calling turtle not to wait while TOOT, PLAYNOTES, PLAYSOUND and NOISE are played.

noaudiowait


noattenuate

Takes:   none

Returns:   none

Disables audio attenuation for the calling turtle. See attenuate

noattenuate


noise

Takes:   frequency (number) | duration (number)

Returns:   none

Generates noise output of the specified frequency, and duration in 60ths of a second. See toot

noise 2000 100


noteschannel

Takes:   none

Returns:   number

Returns the current channel used to play notes by the playnotes primitive. See setnoteschannel

show noteschannel


notespeed

Takes:   none

Returns:   number

Returns the current speed of playnotes playback.

show notespeed


pausemusic

Takes:   none

Returns:   none

Pauses playback of music, if music is playing. See resumemusic

pausemusic


playnotes

Takes:   notes [list]

Returns:   none

Plays back the provided list of notes. L specifies note length (0 = 16th note, 1 = 8th, 2 = dotted 8th, quarter, dotted quarter, half, dotted half, whole, dotted whole and double whole respectively.) R denotes a rest of the specified length, while Vxx sets the volume of subsequent notes. All notes and commands MUST be in uppercase, eg A3, due to the use of lowercase b to denote flats (eg Bb). If a list of notes is provided inside of the list supplied to playnotes, those notes are played simultanously, as a chord.

playnotes [L3 A3 L2 Bb3 C#3]
playnotes [L3 [C3 E3 G3] C4]


playmusic

Takes:   musicname (word)

Returns:   none

Begins playing the named music. The music needs to have first been loaded into memory using loadmusic. Tracker music is currently unsupported in the web environment. However, if a sound name is provided in the form of a list, playmusic will play and loop that instead, and pausemusic and stopmusic can be used to control it. See loadmusic, loadsound

playmusic "mysong
playmusic [mysound]


playsound

Takes:   “sound (word)

Returns:   none

Plays a sound, where “sound can be a loaded sound or a ‘built-in’ one from the list given in the example. playsound respects audiowait, which means execution is paused while the sound plays if audiowait is set, which it is by default. To turn audiowait off, use noaudiowait

air crack laugh stapler
air2 crash laughter static
air3 crinkle lid step
alarm crow lightbulb step2
alarm2 descent lion switch
alien dice meow switch2
alien2 doh missile tear
alien3 doodoo oof thwap
applause door paddle tiger
arcade drip pew ting
augh drop pingpong ting2
aw dunk plastic tinpan
bark evil plastic2 tires
beep explosion please toaster
beep2 fall pong tuee
beep3 fire pop tweet
beep4 fire2 powerup ufo
bell ghost radio ufo2
bell2 glass ratchet ufo3
blastoff glitch rattle ufo4
blub gong rattle2 ufo5
boing growl rattle3 ufo6
bong gun ringring warning
buc gun2 rocket whip
button gun3 rooster whip2
buzz gurgle saw whoosh
candy ha scanner wind
carkeys hangup scissors wind2
carstart hangup2 sheep window
cellphone hit sheep2 witch
cheers honk sheep3 wood
chomp honk2 slap wrapper
clang interference slide zap
click jingle sneeze zap2
click2 knock soda zap3
click3 laser spin zblrf
close latch spinout zip
cluck latch2 squeak zipper


quiet

Takes:   none

Returns:   none

Stops playback of all sounds from all turtles. This doesn’t mute auto playback in general, only stops the currently playing sounds.

quiet


resumemusic

Takes:   none

Returns:   none

Resumes paused music playback.

resumemusic


say

Takes:   word or list

Returns:   none

Causes the operating systems speech-synthesis (if available) to speak the given word or list. Note that this may not be available on some systems, and should not be used as a primary means of communicating with the user. say does not respect audiowait and will continue to execute without waiting for audio to finish

say "hello


setattenuation

Takes:   number

Returns:   none

Default is 0.3. When a sound is played, the distance between the emitter and receiver (view turtle) is multiplied by the attenuation value to calculate the resultant volume of the sound at the receiver. Basically this makes sounds quieter the farther away the view turtle is from the turtle making the sound. This is a global setting that affects all turtles. See attenuation, attenuate

setattenuation


setbeep

Takes:   word

Returns:   none

Sets the system beep to the sound named by the provided word. See beep

setbeep "sheep
beep


setinstrument

Takes:   instrumentfile (word)

Returns:   none

Loads an instrument file (saved from tracker) for use with playnotes. See tracker, playnotes

setinstrument "xylophone.snd


setmusicspeed

Takes:   speed (number)

Returns:   none

Sets the speed of music playback.

setmusicspeed 128


setmusicvolume

Takes:   percent (number)

Returns:   none

Sets the volume (amplitude) of music playback using a value from 0 to 100.

setmusicvolume 50


setnoteschannel

Takes:   number

Returns:   none

Sets the music channel to be used to play back notes with playnotes

setnoteschannel 1


setnotespeed

Takes:   speed (number)

Returns:   none

Sets the speed of note playback.

setnotespeed 128


setsoundvolume

Takes:   volume (number)

Returns:   none

Sets the volume of digital and analog sound playback using a range of 0 to 100, where 0 is off and 100 is full. This is turtle-specific. See setmusicvolume

setsoundvolume 50


setsquelch

Takes:   number

Returns:   none

Sets the ‘squelch’ value, sounds with a(n attenuated) volume under that specified value will not be sent to the audio engine for processing (they will not play.) There are a limited number of audio channels for sounds, and squelch will prevent them from being filled up with barely audible sounds. Squelch is a global setting that affects all turtles in all spaces. See squelch

setsquelch 50


setvolume

Takes:   volume (number)

Returns:   none

Sets the overall volume level, taking a value from 0 (off) to 100 (full).

setvolume 50


sounds

Takes:   none

Returns:   list

Returns all of the currently defined sounds. See loadsound, playsound

show sounds


soundvolume

Takes:   none

Returns:   number

Returns the current sound volume.

show soundvolume


squelch

Takes:   none

Returns:   number

Returns the ‘squelch’ value, the volume level sounds under which are not played. See setsquelch

show squelch


stopmusic

Takes:   none

Returns:   none

Stops music playback. See playmusic

stopmusic


stopsound

Takes:   none

Returns:   none

Stops any sounds currently being played by the calling turtle, including loopsound. See playsound, loopsound

stopsound


toot tone

Takes:   frequency (number) | duration (number)

Returns:   none

none

Toot generates a tone of the provided frequency (specified in Hertz) and duration (in 60ths of a second). The alias 'tone' is included for compatibility with other Logos.

to siren :freq
if :freq > 440 [stop]
toot :freq 3
siren :freq + 5
toot :freq 3
end


tracker

Takes:   none

Returns:   none

Opens the ‘tracker’, a music editor. turtleSpaces supports creation and playback of 6-channel waveform-generated music. See the help file available inside the tracker

tracker


volume

Takes:   none

Returns:   number

Returns the current ‘master’ volume.

show volume