Referencia › Sound and Music — 63 comandos


advancemusic

sound and music

Entrada: none
Salida: 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

sound and music

Entrada: none
Salida: none

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

attenuate

attenuation

sound and music

Entrada: none
Salida: number

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

show attenuation

audio

sound and music

Entrada: none
Salida: none

Enables audio. noaudio turns it off. audiop returns the audio state.

audio

audiowait

sound and music

Entrada: none
Salida: none

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

audiowait

beat

sound and music

Entrada: none
Salida: number

Returns the current beat. See beatp, which returns true if beat has advanced since last read. See also resetbeat, which resets the beat counter.

show beat

beatsync

sound and music

Entrada: none
Salida: none

Causes playnotes to wait for the next beat before playing. This is on by default. See beat, beatp, nobeatsync

beatsync

beep

sound and music

Entrada: none
Salida: none

Triggers the system beep.

beep

clearmusic

sound and music

Entrada: none
Salida: none

Clears all music from memory.

clearmusic

clearsong

sound and music

Entrada: musicname (word)
Salida: none

Clears the specified song (music) from memory.

clearsong "mymusic

clearsound

sound and music

Entrada: soundname (word)
Salida: none

Clears the specified sound from memory.

clearsound "mysound

clearsounds

sound and music

Entrada: none
Salida: none

Clears all user-defined sounds from memory.

clearsounds

defineinstrument

sound and music

Entrada: number [parameters]
Salida: none

Defines a synth instrument. See instrumentdefinition.

defineinstrument 1 [...]

instrument

sound and music

Entrada: none
Salida: number

Returns the current instrument number used by playnotes. See setinstrument

show instrument

instrumentdefinition

sound and music

Entrada: number
Salida: list

Returns the instrument definition contained in the given instrument slot.

show instrumentdefinition 129

listspeechvoices

sound and music

Entrada: none
Salida: none

Prints the currently available speech voices. See setspeechvoice, say, speechvoices

listspeechvoices

listsounds

sound and music

Entrada: none
Salida: none

Prints the names of the currently defined sounds, one per line. See loadsound, sounds

listsounds

loadsound

sound and music

Entrada: soundname (word) | filename (word) or URL (word)
Salida: none

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

loadsound "honk "honk.ogg

loopsound

sound and music

Entrada: word
Salida: none

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

loopsound "sheep

mididown

sound and music

Entrada: none
Salida: list

Returns a list of MIDI keys currently pressed down.

show mididown

midiread

sound and music

Entrada: none
Salida: list

Returns a list of the MIDI keys pressed since last read. See midip, mididown, midiup

show midiread

midiup

sound and music

Entrada: none
Salida: list

Returns a list of MIDI keys released since last read. See midip, midiread, mididown

show midiup

music

sound and music

Entrada: none
Salida: list

Returns a list of the currently loaded music.

show music

musicspeed

sound and music

Entrada: none
Salida: number

Returns the current music speed.

show musicspeed

musicvolume

sound and music

Entrada: none
Salida: number

Returns the calling turtle's music volume.

show musicvolume

noaudiowait

sound and music

Entrada: none
Salida: none

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

noaudiowait

noattenuate

sound and music

Entrada: none
Salida: none

Disables audio attenuation for the calling turtle. See attenuate

noattenuate

noaudio

sound and music

Entrada: none
Salida: none

Disables audio. audio turns it on. audiop returns the audio state.

noaudio

nobeatsync

sound and music

Entrada: none
Salida: none

Disables beatsync, which times playnotes to the start of the next beat. See beat, beatsync

nobeatsync

noise

sound and music

Entrada: frequency (number) | duration (number)
Salida: none

Generates noise output of the specified frequency, and duration in 60ths of a second. If a duration value of -1 is provided, noise sounds indefinitely. Passing a duration value of 0 turns it off. See toot

noise 2000 100

notesvolume

sound and music

Entrada: none
Salida: number

Returns the current default note volume used by playnotes.

show notesvolume
100

pausemusic

sound and music

Entrada: none
Salida: none

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

pausemusic

playnotes

sound and music

Entrada: notes [list]
Salida: 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.

Pxx sets the pan (0 = left, 99 = right) while RVx (0-100) sets the reverb level. PBxxx sets pitch bend, and LOOP causes the provided notes to play forever.

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.

Qx queues playback to next X 'beat', eg 1 = next beat, 4 = next bar. See beat
Sxx causes notes to sustain, with xx being tenths of a second
playnotes [L3 A3 L2 Bb3 C#3]
playnotes [L3 [C3 E3 G3] C4]

playmusic

sound and music

Entrada: musicname (word)
Salida: 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

sound and music

Entrada: "sound (word) OR [sound multiple] (list)
Salida: none

Plays a sound, where "sound can be a loaded sound or a 'built-in' one from the list given in the example. If a list is provided, the first value is the name of the sound, the second is a multiplier of the playback frequency (0.5 is half, 2 is double). 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

sound and music

Entrada: none
Salida: none

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

quiet

resetbeat

sound and music

Entrada: none
Salida: none

Resets the beat. See beat

resetbeat

resumemusic

sound and music

Entrada: none
Salida: none

Resumes paused music playback.

resumemusic

say

sound and music

Entrada: word or list
Salida: 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

sound and music

Entrada: number
Salida: 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

sound and music

Entrada: word
Salida: none

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

setbeep "sheep
beep

setinstrument

sound and music

Entrada: instrument (number)
Salida: none

Sets the instrument number to be used by playnotes. Numbers from 0 to 128 are general MIDI instruments. If instrument 128 is selected, drums are used. Instrument valuises from 129 to 304 are beepbox synthesizer presets.

See the following list for MIDI instruments (others currently not listed):
Piano Family
  0 Acoustic Grand Piano
  1 Bright Acoustic Piano
  2 Electric Grand Piano
  3 Honky-tonk Piano
  4 Electric Piano 1
  5 Electric Piano 2
  6 Harpsichord
  7 Clavichord
Chromatic Percussion Family
  8 Celesta
  9 Glockenspiel
 10 Music Box
 11 Vibraphone
 12 Marimba
 13 Xylophone
 14 Tubular Bells
 15 Dulcimer
Organ Family
 16 Drawbar Organ
 17 Percussive Organ
 18 Rock Organ
 19 Church Organ
 20 Reed Organ
 21 Accordion
 22 Harmonica
 23 Tango Accordion
Guitar Family
 24 Acoustic Guitar (nylon)
 25 Acoustic Guitar (steel)
 26 Electric Guitar (jazz)
 27 Electric Guitar (clean)
 28 Electric Guitar (muted)
 29 Overdriven Guitar
 30 Distortion Guitar
 31 Guitar harmonics
Bass Family
 32 Acoustic Bass
 33 Electric Bass (finger)
 34 Electric Bass (pick)
 35 Fretless Bass
 36 Slap Bass 1
 37 Slap Bass 2
 38 Synth Bass 1
 39 Synth Bass 2
Strings Family
 40 Violin
 41 Viola
 42 Cello
 43 Contrabass
 44 Tremolo Strings
 45 Pizzicato Strings
 46 Orchestral Harp
 47 Timpani
Ensemble Family
 48 String Ensemble 1
 49 String Ensemble 2
 50 SynthStrings 1
 51 SynthStrings 2
 52 Choir Aahs
 53 Voice Oohs
 54 Synth Voice
 55 Orchestra Hit
Brass Family
 56 Trumpet
 57 Trombone
 58 Tuba
 59 Muted Trumpet
 60 French Horn
 61 Brass Section
 62 SynthBrass 1
 63 SynthBrass 2
Reed Family
 64 Soprano Sax
 65 Alto Sax
 66 Tenor Sax
 67 Baritone Sax
 68 Oboe
 69 English Horn
 70 Bassoon
 71 Clarinet
Pipe Family
 72 Piccolo
 73 Flute
 74 Recorder
 75 Pan Flute
 76 Blown Bottle
 77 Shakuhachi
 78 Whistle
 79 Ocarina
Synth Lead Family
 80 Lead 1 (square)
 81 Lead 2 (sawtooth)
 82 Lead 3 (calliope)
 83 Lead 4 (chiff)
 84 Lead 5 (charang)
 85 Lead 6 (voice)
 86 Lead 7 (fifths)
 87 Lead 8 (bass + lead)
Synth Pad Family
 88 Pad 1 (new age)
 89 Pad 2 (warm)
 90 Pad 3 (polysynth)
 91 Pad 4 (choir)
 92 Pad 5 (bowed)
 93 Pad 6 (metallic)
 94 Pad 7 (halo)
 95 Pad 8 (sweep)
Synth Effects Family
 96 FX 1 (rain)
 97 FX 2 (soundtrack)
 98 FX 3 (crystal)
 99 FX 4 (atmosphere)
100 FX 5 (brightness)
101 FX 6 (goblins)
102 FX 7 (echoes)
103 FX 8 (sci-fi)
Ethnic Family
104 Sitar
105 Banjo
106 Shamisen
107 Koto
108 Kalimba
109 Bag pipe
110 Fiddle
111 Shanai
Percussive Family
112 Tinkle Bell
113 Agogo
114 Steel Drums
115 Woodblock
116 Taiko Drum
117 Melodic Tom
118 Synth Drum
119 Reverse Cymbal
Sound Effects Family
120 Guitar Fret Noise
121 Breath Noise
122 Seashore
123 Bird Tweet
124 Telephone Ring
125 Helicopter
126 Applause
127 Gunshot
Drums
128 Drums
Key#   Drum Sound
35/B1  Acoustic Bass Drum
36/C2  Bass Drum 1
37/Cb2 Side Stick
38/D2  Acoustic Snare
39/Eb2 Hand Clap
40/E2  Electric Snare
41/F2  Low Floor Tom
42/Gb2 Closed Hi Hat
43/G2  High Floor Tom
44/Ab2 Pedal Hi-Hat
45/A2  Low Tom
46/Bb2 Open Hi-Hat
47/B2  Low-Mid Tom
48/C3  Hi-Mid Tom
49/Db3 Crash Cymbal 1
50/D3  High Tom
51/Eb3 Ride Cymbal 1
52/E3  Chinese Cymbal
53/F3  Ride Bell
54/Gb3 Tambourine
55/G3  Splash Cymbal
56/Ab3 Cowbell
57/A3  Crash Cymbal 2
58/Bb3 Vibraslap
59/B3  Ride Cymbal 2
60/C4  Hi Bongo
61/Db4 Low Bongo
62/D4  Mute Hi Conga
63/Eb4 Open Hi Conga
64/E4  Low Conga
65/F4  High Timbale
66/Gb4 Low Timbale
67/G4  High Agogo
68/Ab4 Low Agogo
69/A4  Cabasa
70/Bb4 Maracas
71/B4  Short Whistle
72/C5  Long Whistle
73/Db5 Short Guiro
74/D5  Long Guiro
75/Eb5 Claves
76/E5  Hi Wood Block
77/F5  Low Wood Block
78/Gb5 Mute Cuica
79/G5  Open Cuica
80/Ab5 Mute Triangle
81/A5  Open Triangle

setmusicspeed

sound and music

Entrada: speed (number)
Salida: none

Sets the speed of music playback.

setmusicspeed 128

setmusicvolume

sound and music

Entrada: percent (number)
Salida: none

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

setmusicvolume 50

setsoundvolume

sound and music

Entrada: volume (number)
Salida: 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

setspeechvoice

sound and music

Entrada: voicename (phrase)
Salida: none

Sets the voice to be used with say. See speechvoice, speechvoices, listspeechvoices (which lists all of the available voices)

setspeechvoice |Fred|

setsquelch

sound and music

Entrada: number
Salida: 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

settempo

sound and music

Entrada: number
Salida: none

Sets the tempo used by playnotes. The default is 120 beats per minute.

settempo 80

setvolume

sound and music

Entrada: volume (number)
Salida: none

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

setvolume 50

sounds

sound and music

Entrada: none
Salida: list

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

show sounds

silence

sound and music

Entrada: none
Salida: none

Terminates all playing audio.

silence

soundvolume

sound and music

Entrada: none
Salida: number

Returns the current sound volume.

show soundvolume

speechvoice

sound and music

Entrada: none
Salida: voice (word)

Returns the current speech voice. See setspeechvoice, say

show speechvoice

speechvoices

sound and music

Entrada: none
Salida: list

Returns the currently available speech voices. See setspeechvoice, say, listspeechvoices

show speechvoices

squelch

sound and music

Entrada: none
Salida: number

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

show squelch

stopmusic

sound and music

Entrada: none
Salida: none

Stops music playback. See playmusic

stopmusic

stopsound

sound and music

Entrada: none
Salida: none

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

stopsound

tempo

sound and music

Entrada: none
Salida: number

Returns the current tempo used by playnotes, see settempo

show tempo

toot

También: tone

sound and music

Entrada: frequency (number) | duration (number)
Salida: none

none

Toot generates a tone of the provided frequency (specified in Hertz) and duration (in 60ths of a second). If a duration value of -1 is provided, toot sounds indefinitely. Passing a duration value of 0 turns it off. 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

sound and music

Entrada: none
Salida: 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

sound and music

Entrada: none
Salida: number

Returns the current 'master' volume.

show volume

setnotesvolume

sound and music

Entrada: number
Salida: none

Sets the default note volume used by playnotes. See notesvolume

setnotesvolume 50

~notespeed

sound and music

Entrada: none
Salida: number

Returns the current speed setting for note playback.

print ~notespeed