playClip
(Redirected from PlayClip)
This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
This article needs: Needs basic examples of both online and local file playback
playClip() Function
• Introduced in version 1.5.7
Play an audio clip on local computer, from an online source or from a local file. Multiple audio sources can be played from at the same time and unlike playStream() the same audio source can be played simultaneously by multiple calls to playClip(). Supports MP3 and Wave formats. Playback can be disabled on a client via Preferences -> Sound -> Play streams. See the playStream() page for details on using Dropbox urls.
Note: Audio clips are loaded into memory in uncompressed form and could potentially consume a lot of memory. playClip() is best used for short Sound FX clips. Use playStream() for long-playing soundtracks/ambient sounds.
Usage
playClip(uri)
playClip(uri, cycleCount)
playClip(uri, cycleCount, volume)
Parameter
uri
- The uri/url of the file. For example, http://www.mywebsite/mysong.mp3 or file:/C:/mysong.mp3cycleCount
- The number of times the audio should play. If set to 0, the file is cached but not played; if set to -1, the file is played continuously. Defaults to 1.volume
- The volume the audio is to be played at. Can range from 0 to 1. Defaults to 1.
Examples
To play a song from an online source to all clients, the GM can create the macro "playSong" on a Lib token, say, "Lib:MusicPlayer":
[playClip(macro.args)]
To play the song, the GM can then use execLink:
[H: songUrl = "http://erinmcnamee.com.hostbaby.com/files/07_No_Sorrow__Banish_Misfortune.mp3"]
[H: audioByte = macroLinkText("playSong@Lib:MusicPlayer", "none", songUrl)]
[H: execLink(audioByte,0,"all")]
Dropbox URLs
After creating the dropbox share link you have to replace www.dropbox.com
with dl.dropboxusercontent.com
. That provides a direct link that playClip can use. Thanks to Full Bleed on the forums for the tip.