API | Audio
These functions control the playback of audio files.
- PS.audioLoad ( filename, options )
- PS.audioPlay ( filename, options )
- PS.audioPlayChannel ( channel, options )
- PS.audioFade ( channel, from, to, duration, onEnd )
- PS.audioPause ( channel )
- PS.audioStop ( channel )
- PS.piano ( note, long )
- PS.harpsichord ( note, long )
- PS.xylophone ( note )
- Audio library
PS.audioLoad ( filename, options )
PS.audioLoad() preloads an audio file, allocates a channel ID to the loaded audio, and optionally plays it.
Parameters:
- filename : string
- (optional) options : object or PS.DEFAULT
Returns: PS.DONE or PS.ERROR
The filename parameter should be a case-sensitive string matching the filename of the audio to be played, without a path specifier or file extension (example: "fx_click"). By default, the file is assumed to reside in the Perlenspiel Audio Library. Note that library filenames are all lower-case.
If filename is specified as an empty string (""), PS.audioLoad() has no effect, and immediately returns the value PS.DONE.
The options parameter, if provided, should be a JavaScript object containing one or more of the following case-sensitive properties:
- .autoplay : boolean or PS.DEFAULT
- .volume : float or PS.DEFAULT
- .loop : boolean or PS.DEFAULT
- .lock : boolean or PS.DEFAULT
- .onLoad : function or PS.DEFAULT
- .onEnd : function or PS.DEFAULT
- .data : any JavaScript value or PS.DEFAULT
- .path : string, or PS.DEFAULT
- .fileTypes : string array or PS.DEFAULT
options.autoplay
If options.autoplay is true or a non-zero number, the audio file specified by filename is played immediately upon loading. Any playback behaviors specified by other parameters in the options object (such as .volume and .loop) will be applied.
If options.autoplay is false, zero (0), null, PS.DEFAULT or not supplied, the default behavior (no autoplay) is applied.
options.volume
The options.volume property specifies the volume assigned to subsequent playback of the audio file specified by filename. It should be expressed as a float in the range 0 (muted) to 1.0 (maximum) inclusive. Values outside this range are clamped.
If options.volume is null, PS.DEFAULT or not supplied, the default volume (0.5, 50% maximum) is applied.
options.loop
If options.loop is true or a non-zero number, the audio file specified by filename will loops continuously on subsequent playback. If options.loop is false, zero (0), null, PS.DEFAULT or not supplied, the default behavior (no looping) is applied.
options.lock
If options.lock is true or a non-zero number, the audio file specified by filename is marked for long-term retention by the audio engine. Such files are less likely to be discarded if the engine needs more space. If options.lock is false, zero (0), null, PS.DEFAULT or not supplied, the default behavior (no file lock) is applied.
options.onLoad
The options.onLoad property specifies a JavaScript function that will be called when the audio file specified by filename is completely loaded, and a channel has been successfully allocated to it. It should be a reference to a valid JavaScript function expecting one parameter, which will be an object containing the following case-sensitive properties:
- .channel : string
- The ID of the channel allocated to the loaded audio file.
This string must be saved somewhere in your code if you intend to use the channel
allocated by PS.audioLoad() in any subsequent calls to PS.audioPlayChannel(),
PS.audioPause() or PS.audioStop().
- .name : string
-
The string passed into the filename parameter
of PS.audioLoad().
- .path : string
-
The string passed into the options.path property
of PS.audioLoad(). If options.path was specified as an empty string (""),
null, PS.DEFAULT, or was not supplied,
the .path property will be set to the path of the Perlenspiel Audio Library.
- .url : string
-
The complete, case-sensitive URL of the audio file actually loaded
by PS.audioLoad(), including its file extension.
- .duration : integer
-
The duration of the loaded audio file in milliseconds.
- .data : user-supplied, or string
-
The value specified by the options.data property of of PS.audioLoad() (see below).
If the options.data property was null, PS.DEFAULT or not supplied,
this property is set to the string passed into the filename parameter
of PS.audioLoad().
If options.onLoad is null, PS.DEFAULT or not supplied, no function will be called upon completion of file loading.
options.onEnd
The options.onEnd property specifies a JavaScript function that will be called each time the audio channel (not the file!) allocated by this call to PS.audioLoad() completes playback, including the end of each loop, if looping is enabled on the channel. It should be a reference to a valid JavaScript function expecting one parameter, which will be an object containing the same case-sensitive properties as those sent to the options.onLoad function (see above).
If options.onEnd is null, PS.DEFAULT or not supplied, no function will be called upon completion of channel playback.
options.data
If an .onLoad or .onEnd property is provided in the options object, the options.data property specifies the value that will be assigned to the .data property of the object passed to those functions when they are called. Any valid JavaScript value can be specified.
If the options.data property is null, PS.DEFAULT or not supplied, the filename parameter passed to PS.audioLoad() will be assigned to the .data property of the object passed to those functions.
options.path
The options.path property is used to specify the location of custom audio files not sourced from the Perlenspiel Audio Library. It should be a case-senstive string representing the path to the directory containing the audio file(s) specified by the filename parameter, relative to the directory containing the project's game.html file.
For example, suppose you have placed your custom sound files in a subdirectory named audio, located in the same directory as your game.html file, like this:
game.html
game.js
audio/
mysound.ogg
mysound.mp3
In this case, you would specify the string "audio/" in the options.path property.
To play audio files located in the same directory as the game.html file, specify the string "./" in the options.path property.
If options.path is an empty string (""), null, PS.DEFAULT or not supplied, the path of the Perlenspiel Audio Library is applied.
IMPORTANT: Webkit-based browsers, such as Chrome, Edge and Brave, are picky about security. By default, they will not load resources (including custom audio and image files) that (1) do not reside on an actual HTTP or HTTPS server, and (2) do not share the root filepath of any script that tries to access them. This means that you have to install all of your scripts, audio and image files on a live server, in the same root filepath, before you can test or deploy an application using these browsers. (It's possible to reconfigure browsers to avoid this necessity, but this is not recommended.)
Firefox is currently more lenient about security. Resource files don't need to be on a server, or share the same root filepath. This leniency is subject to change at any time.
options.fileTypes
The options.fileTypes property is used to specify which file formats are available for any custom audio files used by your project. This property should be an array of lower-case strings indicating the filetypes provided for the file specified by the filepath parameter. The strings should be provided in priority order; compressed formats (such as .mp3 and .ogg) should appear first. Legal strings are:
- "ogg" (compressed .ogg Vorbis)
- "mp3" (compressed .mp3)
- "webm" (compressed .webm Opus or Vorbis)
- "wav" (uncompressed .wav)
Note that filetype specifiers should not be prefixed by a period (".ogg").
Preparing custom audio files
All major browsers can play either .ogg or .mp3 files, but not necessarily both. For maximum compatibility, you should provide both .ogg and .mp3 versions of every custom sound you want to use. All files must be stored in the same directory. Both versions of each sound file should share exactly the same case-sensitive filename, suffixed with a format-appropriate lower-case extension (.ogg or .mp3). Perlenspiel will automatically detect and play the file version compatible with your browser.
Encode the compressed formats at whatever bitrate you feel is adequate. For stereo music, I recommend at least 160 kbps for .mp3 files, and 128 kbps for .ogg files. Lower bitrates may be adequate for voices, sound effects and/or or monaural sounds.
For future compatibility, you may also want to provide a 44.1kHz .webm file (Opus codec preferred, Vorbis format acceptable). Opus-encoded .webm files sound noticeably better than .ogg or .mp3 files encoded at the same bitrate. The .webm format is already supported by many major browsers, and is now part of the official HTML5 standard, which means it will eventually become compatible with all browsers.
If options.fileTypes is PS.DEFAULT or not supplied, the default fileTypes array for the browser running Perlenspiel is applied. This will usually (but not necessarily) be:
- [ "ogg", "mp3" ]
If the options parameter of PS.audioLoad() is PS.DEFAULT or not supplied, default values are used for all of the above properties.
Return value
PS.audioLoad() returns the constant PS.DONE on successful completion, or if an empty string was passed to its filename parameter.
PS.ERROR is returned if an error occurs.
// EXAMPLE:
// Preload and lock a library sound on startup,
// and save its channel ID for future use.
var click_id = ""; // variable to save channel ID
PS.init = function( system, options ) {
// set up a 10 x 10 grid
PS.gridSize( 10, 10 );
// Loader function to save channel ID
var loader = function ( data ) {
click_id = data.channel; // save ID
};
// Load the sound
PS.audioLoad( "fx_click", {
lock : true,
onLoad : loader // specify loader function
} );
};
PS.audioPlay ( filename, options )
PS.audioPlay() plays an audio file, automatically loading it and allocating a channel to it first if necessary. It works exactly the same way PS.audioLoad() operates when the .autoplay property of its options parameter is set to true.
Parameters:
- filename : string
- (optional) options : object or PS.DEFAULT
Returns: PS.DONE or PS.ERROR
The filename parameter should be a case-sensitive string matching the filename of the audio to be played, without a file extension. By default, the file is assumed to reside in the Perlenspiel Audio Library. Note that library filenames are all lower-case.
If filename is specified as an empty string (""), PS.audioPlay() has no effect, and immediately returns the value PS.DONE.
The options parameter, if provided, should by a JavaScript object containing one or more of the following case-sensitive properties:
- .volume : float or PS.DEFAULT
- .loop : boolean or PS.DEFAULT
- .lock : boolean or PS.DEFAULT
- .onLoad : function or PS.DEFAULT
- .onEnd : function or PS.DEFAULT
- .data : any JavaScript value or PS.DEFAULT
- .path : string, or PS.DEFAULT
- .fileTypes : string array or PS.DEFAULT
See the documentation for PS.audioLoad() above for a detailed description of these properties.
If options is PS.DEFAULT or not supplied, default values are used for all properties.
Return value
PS.audioPlay() returns the constant PS.DONE on successful completion, or if an empty string was passed to its filename parameter.
PS.ERROR is returned if an error occurs.
// EXAMPLES:
// Play a pop when any bead is clicked/touched
PS.touch = function( x, y, data, options ) {
PS.audioPlay( "fx_pop" );
};
// Play triangle at 75% volume
// when any key is pressed
PS.keyDown = function( key, shift, ctrl, options ) {
PS.audioPlay( "perc_triangle", { volume: 0.75 } );
};
PS.audioPlayChannel ( channel, options )
PS.audioPlayChannel() plays an audio channel previously allocated by a call to PS.audioLoad() or PS.audioPlay().
Parameters:
- channel : string
- (optional) options : object or PS.DEFAULT
Returns: string or PS.ERROR
The channel parameter should be a channel ID string previously allocated by a call to PS.audioLoad() or PS.audioPlay().
Playback of channel always starts at the beginning of the asscoaited audio file.
If PS.audioPlayChannel() is called when the specified channel is already playing as the result of a previous call, the first playback instance will immediately stop, and the channel will start playing again from the beginning.
If channel is specified as an empty string (""), PS.audioPlayChannel() has no effect, and immediately returns the constant PS.DONE.
An error occurs if the channel parameter is invalid.
The options parameter, if provided, should by a JavaScript object containing one or more of the following properties:
- .volume : float or PS.DEFAULT
- .loop : boolean or PS.DEFAULT
- .onEnd : function or PS.DEFAULT
- .data : any JavaScript value or PS.DEFAULT
See the documentation for PS.audioLoad() above for a detailed description of these properties. NOTE: Only the four properties listed above apply to PS.audioPlayChannel().
If options is PS.DEFAULT or not supplied, default values are used for all properties.
Return value
PS.audioPlayChannel() returns its channel parameter upon successful completion, or the constant PS.DONE if an empty string is passed to its channel parameter.
PS.ERROR is returned if an error occurs.
// EXAMPLE:
var pop_id = ""; // variable to save channel ID
// Preload and lock a library sound on startup,
// and save its channel ID for future use.
PS.init = function( system, options ) {
// set up a 10 x 10 grid
PS.gridSize( 10, 10 );
// Loader function to save channel ID
var loader = function ( data ) {
pop_id = data.channel; // save ID
};
// Load the sound
PS.audioLoad( "fx_pop", {
lock : true,
onLoad : loader // specify loader function
} );
};
// Play a pop when any bead is clicked/touched
PS.touch = function( x, y, data, options ) {
PS.audioPlayChannel ( pop_id );
};
PS.audioFade ( channel, from, to, duration, onEnd )
PS.audioFade() lets you linearly fade a currently playing audio channel up or down.
Parameters:
- channel : string
- from : number or PS.CURRENT
- to : number
- (optional) duration : number or PS.DEFAULT
- (optional) onEnd : function or PS.DEFAULT
Returns: string, PS.DONE or PS.ERROR
The required channel parameter should be a channel ID string previously allocated by a call to PS.audioLoad() or PS.audioPlay().
If the audio channel specified by channel is currently playing when PS.audioFade() is called, the fade effect specified by its remaining parameters begins immediately.
If channel is not currently playing when PS.audioFade() is called, or if channel is specified as an empty string (""), PS.audioFade() has no effect, and immediately returns the constant PS.DONE.
An error occurs if the channel parameter is invalid.
The required from parameter specifies the audio level from which the fade effect will begin. It should be a float between 0 (silence) and 1 (full volume). Values outside this range are clamped. If from is specified as PS.CURRENT, the fade effect begins at the channel's current volume level.
The required to parameter specifies the audio level at which the fade effect will end. It should be a float between 0 (silence) and 1 (full volume). Values outside this range are clamped. An error occurs if the values of from and to are specified identically.
The optional duration parameter specifies the duration of the fade effect in milliseconds. It should be a integer greater than or equal to 1. Non-integral numbers are floored. Values less than 1 will cause an error. If duration is specified as PS.DEFAULT or not supplied, the default duration value (1000, one second) is used for the fade effect.
The optional onEnd parameter specifies a function that will be called when the fade effect is complete. It should be a valid JavaScript function expecting a single parameter, which will be passed the string specified by the channel parameter. If onEnd is specified as PS.DEFAULT or not supplied, no function is called when the fade effect is complete.
If PS.audioPause() or PS.audioStop() is called on a channel currently being faded, the fade effect is immediately cancelled. If an onEnd function was specified for the cancelled fade effect, that function is immediately called when the fading channel is paused or stopped.
Return value
PS.audioFade() returns its channel parameter upon successful completion, or the constant PS.DONE if an empty string is passed to its channel parameter.
PS.ERROR is returned if an error occurs.
PS.audioPause ( channel )
PS.audioPause() lets you pause and/or resume a previously played audio channel.
Parameters:
- channel : string
Returns: string or PS.ERROR
The channel parameter should be a channel ID string previously allocated by a call to PS.audioLoad() or PS.audioPlay().
If the audio channel specified by channel is playing, it will pause immediately. If channel is already paused as a result of a previous call to PS.audioPause(), it resumes playing at the point from which it was paused.
If channel is not playing or previously paused, nothing happens.
If channel is specified as an empty string (""), PS.audioPause() has no effect, and immediately returns the constant PS.DONE.
An error occurs if the channel parameter is invalid.
Return value
PS.audioPause() returns its channel parameter upon successful completion, or the constant PS.DONE if an empty string is passed to its channel parameter.
PS.ERROR is returned if an error occurs.
PS.audioStop ( channel )
PS.audioStop() lets you stop a previously started audio channel.
Parameters:
- channel : string
Returns: string or PS.ERROR
The channel parameter should be a channel ID string previously allocated by a call to PS.audioLoad() or PS.audioPlay().
If the audio channel specified by channel is playing, it stops immediately.
If channel is not playing, or was previously stopped, nothing happens.
If channel is currently paused by a previous call to PS.audioPause(), the pause is cancelled, and the location pointer of channel is reset to the beginning of the associated audio file. Subsequent calls to PS.audioPause() on channel will have no effect unless the channel is restarted by a call to PS.audioPlayChannel().
If channel is specified as an empty string (""), PS.audioStop() has no effect, and immediately returns the constant PS.DONE.
An error occurs if the channel parameter is invalid.
Return value
PS.audioStop() returns its channel parameter upon successful completion, or the constant PS.DONE if an empty string is passed to its channel parameter.
PS.ERROR is returned if an error occurs.
PS.piano ( note, long )
PS.piano() returns the filename of an indexed piano note.
Parameters:
- note : integer
- (optional) long : boolean
Returns: string or PS.ERROR
The Perlenspiel Audio Library includes a piano with 88 keys, ranging from A0 to C8 inclusive.
PS.piano() takes a note parameter between 1 and 88 inclusive, and returns a string representing the filename of the associated piano sound. Values outside this range are clamped.
There are two versions of each piano note, short (about 1 second in duration) and long (about 4 seconds). The optional long parameter determines which version's filename is returned. If long is true, the long version is returned. If long is false or not supplied, the short version is returned.
Return value
PS.piano() returns a string representing the filename of the piano sound specified by note and long.
PS.ERROR is returned if an error occurs.
// EXAMPLES:
// Play SHORT version of piano note 44
// when any bead is clicked/touched
PS.touch = function( x, y, data, options ) {
PS.audioPlay( PS.piano( 44 ) );
};
// Play LONG version of piano note 32
// when any key is pressed
PS.keyDown = function( key, shift, ctrl, options ) {
PS.audioPlay( PS.piano( 32, true ) );
};
PS.harpsichord ( note, long )
PS.harpsichord() returns the filename of an indexed harpsichord note.
Parameters:
- note : integer
- (optional) long : boolean
Returns: string or PS.ERROR
The Perlenspiel Audio Library includes a harpsichord with 57 keys, ranging from A2 to F7 inclusive.
PS.harpsichord() takes a note parameter between 1 and 57 inclusive, and returns a string representing the filename of the associated harpsichord sound. Values outside this range are clamped.
There are two versions of each harpsichord note, short (about 1 second in duration) and long (about 4 seconds). The optional long parameter determines which version's filename is returned. If long is true, the long version is returned. If long is false or not supplied, the short version is returned.
Return value
PS.harpsichord() returns a string representing the filename of the harpsichord sound specified by note and long.
PS.ERROR is returned if an error occurs.
PS.xylophone ( note )
PS.xylophone() returns the filename of an indexed xylophone note.
Parameters:
- note : integer
Returns: string or PS.ERROR
The Perlenspiel Audio Library includes a xylophone with 39 notes, ranging from A4 to B7 inclusive.
PS.xylophone() takes a note parameter between 1 and 39 inclusive, and returns a string representing the filename of the associated xylophone sound. Values outside this range are clamped.
Return value
PS.xylophone() returns a string representing the filename of the xylophone sound specified by note.
PS.ERROR is returned if an error occurs.
Audio library
The Perlenspiel audio library contains nearly 400 sounds that you can use in your games, including a full range of piano, harpsichord and xylophone notes, dozens of percussion instruments, and sound effects ranging from simple to silly.
To use these sounds, pass the filenames below as a string to the PS.audioLoad() and PS.audioPlay() commands. Be sure the filename is spelled correctly! Note that filenames are all lower-case.
// EXAMPLE:
// Play a click when a bead is clicked
PS.touch = function ( x, y, data, options ) {
PS.audioPlay( "fx_click" );
};
Click on any filename to hear what it sounds like.
Sound effects
All sound effect filenames begin with an fx_ prefix.
- fx_click: Your basic click
- fx_tick: Metallic tick
- fx_bang: Small bang
- fx_blip: Electronic blip
- fx_bloop: Electronic bloop
- fx_boop: Electronic boop
- fx_beep: Double electronic beep
- fx_pop: Pop
- fx_chirp1: High electronic chirp
- fx_chirp2: Low electronic chirp
- fx_bloink: Bloink
- fx_rip: Rip
- fx_scratch: Scratch
- fx_squink: Squink 1
- fx_squirp: Ssquirp
- fx_squish: Squish
- fx_tweet: Tweet
- fx_zurp: Zurp
- fx_ding: Ding
- fx_swoosh: Swoosh
- fx_bucket: A kicked bucket
- fx_drip1: Liquid drip
- fx_drip2: Liquid drip with pop
- fx_squawk: Duck squawk
- fx_hoot: Windy hoot
- fx_whistle: Police whistle
- fx_silencer: Gunshot with silencer
- fx_blast1: Electro-blast 1
- fx_blast2: Electro-blast 2
- fx_blast3: Electro-blast 3
- fx_blast4: Electro-blast 4
- fx_coin1: Electro-coin 1
- fx_coin2: Electro-coin 2
- fx_coin3: Electro-coin 3
- fx_coin4: Electro-coin 4
- fx_coin5: Electro-coin 5
- fx_coin6: Electro-coin 6
- fx_coin7: Electro-coin 7
- fx_coin8: Electro-coin 8
- fx_jump1: Electro-jump 1
- fx_jump2: Electro-jump 2
- fx_jump3: Electro-jump 3
- fx_jump4: Electro-jump 4
- fx_jump5: Electro-jump 5
- fx_jump6: Electro-jump 6
- fx_jump7: Electro-jump 7
- fx_jump8: Electro-jump 8
- fx_powerup1: Electro-powerup 1
- fx_powerup2: Electro-powerup 2
- fx_powerup3: Electro-powerup 3
- fx_powerup4: Electro-powerup 4
- fx_powerup5: Electro-powerup 5
- fx_powerup6: Electro-powerup 6
- fx_powerup7: Electro-powerup 7
- fx_powerup8: Electro-powerup 8
- fx_shoot1: Electro-shoot 1
- fx_shoot2: Electro-shoot 2
- fx_shoot3: Electro-shoot 3
- fx_shoot4: Electro-shoot 4
- fx_shoot5: Electro-shoot 5
- fx_shoot6: Electro-shoot 6
- fx_shoot7: Electro-shoot 7
- fx_shoot8: Electro-shoot 8
- fx_tada: Tacky “ta-daaa!” fanfare
- fx_wilhelm: The classic Wilhelm scream; use sparingly
- fx_uhoh: High-speed “Uh-oh,” for errors
Percussion instruments
All percussion filenames begin with a perc_ prefix.
- perc_drum_snare: Snare drum hit
- perc_drum_bass: Bass drum kick
- perc_drum_tom1: Tom-tom 1 (high)
- perc_drum_tom2: Tom-tom 2 (medium)
- perc_drum_tom3: Tom-tom 3 (medium-low)
- perc_drum_tom4: Tom-tom 4 (low)
- perc_cymbal_crash1: Crash cymbal 1
- perc_cymbal_crash2: Crash cymbal 2
- perc_cymbal_crash3: Crash cymbal 3
- perc_cymbal_crash4: Crash cymbal 4
- perc_cymbal_ride: Ride cymbal
- perc_hihat_closed: Closed hi-hat
- perc_hihat_open: Open hi-hat
- perc_hihat_pedal: Pedaled hi-hat
- perc_bongo_low: Low bongo
- perc_bongo_high: High bongo
- perc_conga_low: Low conga
- perc_conga_high: High conga
- perc_block_low: Low woodblock
- perc_block_high: High woodblock
- perc_cowbell_low: Low cowbell
- perc_cowbell_high: High cowbell
- perc_shaker: Shaker
- perc_tambourine: Tambourine
- perc_triangle: Triangle
Piano notes
All 88 keys on a standard concert piano (notes A0 to C8) are available in two versions, short (about 1 second) and long (about 4 seconds).
You can translate a note number (1-88) to its associated filename with the PS.piano() function.
Short version filenames begin with a piano_ prefix.
- piano_a0 piano_bb0 piano_b0
- piano_c1 piano_db1 piano_d1 piano_eb1 piano_e1 piano_f1 piano_gb1 piano_g1 piano_ab1 piano_a1 piano_bb1 piano_b1
- piano_c2 piano_db2 piano_d2 piano_eb2 piano_e2 piano_f2 piano_gb2 piano_g2 piano_ab2 piano_a2 piano_bb2 piano_b2
- piano_c3 piano_db3 piano_d3 piano_eb3 piano_e3 piano_f3 piano_gb3 piano_g3 piano_ab3 piano_a3 piano_bb3 piano_b3
- piano_c4 piano_db4 piano_d4 piano_eb4 piano_e4 piano_f4 piano_gb4 piano_g4 piano_ab4 piano_a4 piano_bb4 piano_b4
- piano_c5 piano_db5 piano_d5 piano_eb5 piano_e5 piano_f5 piano_gb5 piano_g5 piano_ab5 piano_a5 piano_bb5 piano_b5
- piano_c6 piano_db6 piano_d6 piano_eb6 piano_e6 piano_f6 piano_gb6 piano_g6 piano_ab6 piano_a6 piano_bb6 piano_b6
- piano_c7 piano_db7 piano_d7 piano_eb7 piano_e7 piano_f7 piano_gb7 piano_g7 piano_ab7 piano_a7 piano_bb7 piano_b7
- piano_c8
Long version filenames begin with a l_piano_ prefix.
- l_piano_a0 l_piano_bb0 l_piano_b0
- l_piano_c1 l_piano_db1 l_piano_d1 l_piano_eb1 l_piano_e1 l_piano_f1 l_piano_gb1 l_piano_g1 l_piano_ab1 l_piano_a1 l_piano_bb1 l_piano_b1
- l_piano_c2 l_piano_db2 l_piano_d2 l_piano_eb2 l_piano_e2 l_piano_f2 l_piano_gb2 l_piano_g2 l_piano_ab2 l_piano_a2 l_piano_bb2 l_piano_b2
- l_piano_c3 l_piano_db3 l_piano_d3 l_piano_eb3 l_piano_e3 l_piano_f3 l_piano_gb3 l_piano_g3 l_piano_ab3 l_piano_a3 l_piano_bb3 l_piano_b3
- l_piano_c4 l_piano_db4 l_piano_d4 l_piano_eb4 l_piano_e4 l_piano_f4 l_piano_gb4 l_piano_g4 l_piano_ab4 l_piano_a4 l_piano_bb4 l_piano_b4
- l_piano_c5 l_piano_db5 l_piano_d5 l_piano_eb5 l_piano_e5 l_piano_f5 l_piano_gb5 l_piano_g5 l_piano_ab5 l_piano_a5 l_piano_bb5 l_piano_b5
- l_piano_c6 l_piano_db6 l_piano_d6 l_piano_eb6 l_piano_e6 l_piano_f6 l_piano_gb6 l_piano_g6 l_piano_ab6 l_piano_a6 l_piano_bb6 l_piano_b6
- l_piano_c7 l_piano_db7 l_piano_d7 l_piano_eb7 l_piano_e7 l_piano_f7 l_piano_gb7 l_piano_g7 l_piano_ab7 l_piano_a7 l_piano_bb7 l_piano_b7
- l_piano_c8
Harpsichord notes
A 57-key harpsichord manual (notes A2 to F7) is available in two versions, short (about 1 second) and long (about 4 seconds).
You can translate a harpsichord note number (1-57) to its associated filename with the PS.harpsichord() function.
Short version filenames begin with a hchord_ prefix.
- hchord_a2 hchord_bb2 hchord_b2
- hchord_c3 hchord_db3 hchord_d3 hchord_eb3 hchord_e3 hchord_f3 hchord_gb3 hchord_g3 hchord_ab3 hchord_a3 hchord_bb3 hchord_b3
- hchord_c4 hchord_db4 hchord_d4 hchord_eb4 hchord_e4 hchord_f4 hchord_gb4 hchord_g4 hchord_ab4 hchord_a4 hchord_bb4 hchord_b4
- hchord_c5 hchord_db5 hchord_d5 hchord_eb5 hchord_e5 hchord_f5 hchord_gb5 hchord_g5 hchord_ab5 hchord_a5 hchord_bb5 hchord_b5
- hchord_c6 hchord_db6 hchord_d6 hchord_eb6 hchord_e6 hchord_f6 hchord_gb6 hchord_g6 hchord_ab6 hchord_a6 hchord_bb6 hchord_b6
- hchord_c7 hchord_db7 hchord_d7 hchord_eb7 hchord_e7 hchord_f7
Long version filenames begin with a l_hchord_ prefix.
- l_hchord_a2 l_hchord_bb2 l_hchord_b2
- l_hchord_c3 l_hchord_db3 l_hchord_d3 l_hchord_eb3 l_hchord_e3 l_hchord_f3 l_hchord_gb3 l_hchord_g3 l_hchord_ab3 l_hchord_a3 l_hchord_bb3 l_hchord_b3
- l_hchord_c4 l_hchord_db4 l_hchord_d4 l_hchord_eb4 l_hchord_e4 l_hchord_f4 l_hchord_gb4 l_hchord_g4 l_hchord_ab4 l_hchord_a4 l_hchord_bb4 l_hchord_b4
- l_hchord_c5 l_hchord_db5 l_hchord_d5 l_hchord_eb5 l_hchord_e5 l_hchord_f5 l_hchord_gb5 l_hchord_g5 l_hchord_ab5 l_hchord_a5 l_hchord_bb5 l_hchord_b5
- l_hchord_c6 l_hchord_db6 l_hchord_d6 l_hchord_eb6 l_hchord_e6 l_hchord_f6 l_hchord_gb6 l_hchord_g6 l_hchord_ab6 l_hchord_a6 l_hchord_bb6 l_hchord_b6
- l_hchord_c7 l_hchord_db7 l_hchord_d7 l_hchord_eb7 l_hchord_e7 l_hchord_f7
Xylophone notes
Taps on a 39-note xylophone (notes A4 to B7) are available. Each begins with a xylo_ prefix.
You can translate a xylophone note number (1-39) to its associated filename with the PS.xylophone() function.
- xylo_a4 xylo_bb4 xylo_b4
- xylo_c5 xylo_db5 xylo_d5 xylo_eb5 xylo_e5 xylo_f5 xylo_gb5 xylo_g5 xylo_ab5 xylo_a5 xylo_bb5 xylo_b5
- xylo_c6 xylo_db6 xylo_d6 xylo_eb6 xylo_e6 xylo_f6 xylo_gb6 xylo_g6 xylo_ab6 xylo_a6 xylo_bb6 xylo_b6
- xylo_c7 xylo_db7 xylo_d7 xylo_eb7 xylo_e7 xylo_f7 xylo_gb7 xylo_g7 xylo_ab7 xylo_a7 xylo_bb7 xylo_b7