Sounds and imported files
Sounds#
playWav(sound, 0) plays a sound: one of the game's own files by its path, one of the
map's sounds by its name (sounds.Name, from the Sound Editor's list), or a clip the
script makes when it is built. tone(), noise(), pluck(), fm() and silence() make
clips; .fade(), .filter(), .delay(), .reverb() and .limit() change them;
mixdown() lays clips over one another, and together() turns down clips the game will
play at once.
const beep = tone("A5", 0.1, { wave: "square", volume: 0.3 });
const zap = tone("A3", 0.4, { wave: "saw" }).filter("lowpass", [[0, 300], [0.4, 3000]]).reverb({ decay: 0.3 });
program(() => {
playWav(beep, 0);
if (random()) playWav(zap, 0);
playWav("sound\\glue\\mousedown2.wav", 0);
});
The build puts each clip the script plays into the map once, and a trigger() and a
transmission can take one too. Which clip plays may follow a variable of the program. The
game plays 32 sounds at once and adds copies up with no limiter, so keep a clip's peak
under 1 where copies overlap. Music played note by note is trigscript/music
(Music).
Files the script imports#
Import Video… in the Explorer turns a file into one the script can import. It takes a picture, a sound or a MIDI file as well as a video, and keeps the result in the map with the script:
- a video becomes a
.videofile (import film from "./film.video"): its frames, a tile a pixel, ink or not, forfog.playorfog.light; - a picture becomes an
.imagefile: its pixels at the size chosen, whichscale,crop,threshold,tonesandhalftoneturn into rows forfog.picture; - a sound file becomes a
.soundfile: a clip forplayWavand the music library; - a MIDI file becomes a
.notesfile: each track's notes, whichmusic.midiplays.
All of it is worked out when the script is built, and what reaches the game is what the
script makes of it. cover(picture, shapes) gives the brushes of your own shapes that
draw a picture's ink, for a renderer of your own; fog.picture is the same with the
game's sight ranges. The Bad Apple!! showcase uses a video this
way.