Difference between revisions of "SciAudio"
Line 116: | Line 116: | ||
==<br /> Examples == | ==<br /> Examples == | ||
+ | <blockquote> | ||
<div class="CodeBlockHeader">Code:</div> | <div class="CodeBlockHeader">Code:</div> | ||
<syntaxhighlight lang="sci"> | <syntaxhighlight lang="sci"> | ||
Line 131: | Line 132: | ||
) | ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
<div class="CodeBlockHeader">Code:</div> | <div class="CodeBlockHeader">Code:</div> | ||
Line 145: | Line 147: | ||
) | ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
<div class="CodeBlockHeader">Code:</div> | <div class="CodeBlockHeader">Code:</div> | ||
Line 159: | Line 162: | ||
) | ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
<div class="CodeBlockHeader">Code:</div> | <div class="CodeBlockHeader">Code:</div> | ||
Line 171: | Line 175: | ||
) | ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
<div class="CodeBlockHeader">Code:</div> | <div class="CodeBlockHeader">Code:</div> | ||
Line 182: | Line 187: | ||
) | ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
<div class="CodeBlockHeader">Code:</div> | <div class="CodeBlockHeader">Code:</div> | ||
Line 193: | Line 199: | ||
) | ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
<div class="CodeBlockHeader">Code:</div> | <div class="CodeBlockHeader">Code:</div> | ||
Line 208: | Line 215: | ||
) | ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | </blockquote> | ||
==<br /> Download == | ==<br /> Download == |
Revision as of 21:17, 29 March 2016
Latest Version: | 1.1 | ||
---|---|---|---|
Release Date: | Oct. 20, 2012 | ||
Company: | {{{Company}}} | ||
Publication Status: | {{{Published}}} | ||
Developer(s): | Template:Gumby | ||
Language: | C# | ||
Open Source: | {{{OpenSource}}} | ||
Source Available: | {{{Source}}} | ||
License: | {{{License}}} | ||
Platform: | Template:WindowsTool | ||
Type: | Mod Tool | ||
Localization: | English | ||
Website: |
Description
sciAudio is here! Check out the "LockerGnome Quest Redux" demo game to see it in action!
Announcement here: http://sciprogramming.com/community/index.php?topic=634.0
Features
- Playback of WAV and MP3 files
- Unlimited number of sounds playing simultaneously
- Fade in/out, looping and volume control
- Classification of sounds for playback management
- Multiple commands may be issued simultaneously to the 'controller' file
- Multiple controller files to avoid resource contention
- Runs hidden in background & will terminate itself shortly upon game close
- Calls to sciAudio are performed very similarly to the built-in SCI sound calls
- Poor man's encryption (MP3's only) - simply rename your .MP3 to be .sciAudio
- Log file for troubleshooting sound playback ('sciAudio.log' located in same directory as sciAudio.exe)
Limitations
Works only in Windows (requires .NET framework)
Usage
Setup
- Place the 2 nAudio DLLs & executable into a subfolder within your game named 'sciAudio'
- Create subfolders within sciAudio for your playback files. Something like this
<gamedir>\sciAudio\effects
<gamedir>\sciAudio\music- Include the sciAudio.sc script & 'use' it in any script you wish to have sciAudio playback in
Available commandscommand <playback command>
play
Begins playback of a sound
stop
Stops playback of a sound
change
Changes playback of a sound. Used primarily for volume & loop control, very limited usefulness.
playx (play exclusively based on sound class)
This behaves just like the 'play' command, but will stop any currently playing sounds with the same sound class as the specified class.
fileName
Filename to playback, including the path.
soundClass
Sound class to assign this sound. This is simply a string to assign to the playback for the purpose of potentially changing or terminating all sounds with the same sound class at a later time.
For example, you might have several sound effects playing simultaneously in a room. Upon leaving the room, you want to stop all the sound effects. To to this you would issue a stop <soundclass> command, which would stop all currently playing sounds with the specified sound class.
If no sound class is specified, a default sound class of "noClass" will be used
volume
Playback volume of sample. Default is 100 (100% volume of sample). Range: 0 to ~300?
fadeInMillisecs
Number of milliseconds to fade in the sample
fadeOutMillisecs
Number of milliseconds to fade out a sample. Can be issued with a play or stop command
loopFadeInMillisecs
Number of milliseconds to fade in a sample between loops.
loopFadeOutMillisecs
Number of milliseconds to fade out a sample between loops.
loopCount
Number of times to loop the sample. Default is 0, -1 is infinite
conductorFile
'Conductor' file name used to place commands into. This is how commands are passed between the SCI virtual machine & the sciAudio application. The sciAudio application constantly polls all conductor files, looking for changes & executes them. These files must have extension of .con.
The default value for this parameter is command.con.
Utilization of this parameter is useful in the event you have many near-simultaneous playback commands issued from within your game. Multiple different conductor files can mitigate the issue of potential file contention of just using a single file. Most game developers will probably not need to use this option.
playXFadeOutMillisecs
Only used for the 'playx' command. Upon terminating any currently playing sounds for a sound class, this value will be used for the fade out.
Examples
Code:(use "sciAudio") (local snd ) (instance aud of sciAudio (properties) (method (init) (super:init()) ) )
Code:// basic playback (send snd: command("play") fileName("effects\\score.sciAudio") // important: note the two backslashes in path name! volume("35") loopCount("0") fadeInMillisecs("3000") // fade in beginning by 3 secs fadeOutMillisecs("2000") // fade out ending by 2 secs init() )
Code:// looping playback example (send snd: command("play") fileName("effects\\loopedSound.sciAudio") volume("100") loopFadeInMillisecs("2000") loopFadeOutMillisecs("2000") loopCount("-1") // loop forever init() )
Code:// stop with 5 second fade out (send snd: command("stop") fileName("music\\introMusic.sciAudio") fadeOutMillisecs("5000") loopCount("0") init() )
Code:// change currently playing volume for a sound class (send snd: command("change") soundClass("myMusicSoundClass") volume("50") // set playback to 50% volume init() )
Code:// stop looping a particular sound file (send snd: command("change") soundClass("music\\introMusic.sciAudio") loopCount("0") // stop looping init() )
Code:// exclusive playback (starts new playback of sound // & stops any already playing sounds (with fadeout) for same soundClass (send snd: command("playx") soundClass("narration") conductorFile("speech\\narrate.con") fileName("speech\\newNarration.sciAudio") playXFadeOutMillisecs("1500") // will fade currently playing "narration" sound class sounds volume("200") init() )
Download
Download from here (source included):
- ZIP File sciAudio 1.0 (ZIP file) [200 KB]