Difference between revisions of "SciAudio"

From SCI Wiki
Jump to navigationJump to search
 
(23 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{SCISoftwareInfobox
+
{{FanSCISoftwareInfobox
 
| Software = sciAudio
 
| Software = sciAudio
| image = [[Image:SciAudio.png|200px]]<br />
+
| Image = [[Image:SciAudio.png|200px]]<br />
 
''sciAudio Example''
 
''sciAudio Example''
| Version = 1.1
+
| Version = 1.2.1
 
| ReleaseDate = Oct. 20, 2012
 
| ReleaseDate = Oct. 20, 2012
| Developers = {{Gumby}}
+
| Company = N/A
| ProgLanguage = C#
+
| Published = {{Published}}
| Platform = {{WindowsTool}}
+
| Developers = {{JeremiahNellisToolDev}}
 +
| Interface =
 +
| ProgLanguage = {{CSharp}}
 +
| OpenSource = {{Open}}
 +
| Source = {{SourceSW}}
 +
| License = None
 +
| Platform = {{WinTool}}
 
| Type = {{ModTool}}
 
| Type = {{ModTool}}
| Localization = English
+
| Localization = {{EnglishTool}}
| Website =  
+
| Website = https://bitbucket.org/nellisjp/sciaudio/
}}  
+
}}
  
 
<div align="center"><span style="font-size: 22pt">sciAudio</span><br />
 
<div align="center"><span style="font-size: 22pt">sciAudio</span><br />
 
Version 1.1<br />
 
Version 1.1<br />
''Author: [[Gumby]]''</div>
+
''Developer: [[Jeremiah Nellis]]''</div>
 
<br />
 
<br />
 
==<br /><br /> Description ==
 
==<br /><br /> Description ==
  
 
<blockquote>
 
<blockquote>
sciAudio is here!  Check out the "LockerGnome Quest Redux" demo game to see it in action!
+
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
 
Announcement here: http://sciprogramming.com/community/index.php?topic=634.0
Line 116: Line 122:
 
==<br /> Examples ==
 
==<br /> Examples ==
  
 +
<blockquote>
 
<div class="CodeBlockHeader">Code:</div>
 
<div class="CodeBlockHeader">Code:</div>
 
<syntaxhighlight lang="sci">
 
<syntaxhighlight lang="sci">
Line 131: Line 138:
 
)
 
)
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
  
 
<div class="CodeBlockHeader">Code:</div>
 
<div class="CodeBlockHeader">Code:</div>
Line 145: Line 153:
 
)
 
)
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
  
 
<div class="CodeBlockHeader">Code:</div>
 
<div class="CodeBlockHeader">Code:</div>
Line 159: Line 168:
 
)
 
)
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
  
 
<div class="CodeBlockHeader">Code:</div>
 
<div class="CodeBlockHeader">Code:</div>
Line 171: Line 181:
 
)
 
)
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
  
 
<div class="CodeBlockHeader">Code:</div>
 
<div class="CodeBlockHeader">Code:</div>
Line 182: Line 193:
 
)
 
)
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
  
 
<div class="CodeBlockHeader">Code:</div>
 
<div class="CodeBlockHeader">Code:</div>
Line 193: Line 205:
 
)
 
)
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
  
 
<div class="CodeBlockHeader">Code:</div>
 
<div class="CodeBlockHeader">Code:</div>
Line 207: Line 220:
 
   init()
 
   init()
 
)
 
)
 +
</syntaxhighlight>
 +
</blockquote>
 +
 +
==<br /><br /> Version 1.2/1.2.1 ==
 +
 +
New version attached here and also put all this code into a git repo, apparently it wasn't before:  https://bitbucket.org/nellisjp/sciaudio/
 +
 +
Now there is an sciAudio.ini file (needs to be in the sciAudio subdirectory of your game) that is read in and used for monitoring a list of (5) possible applications to monitor to determine when to kill sciAudio.  It's a bit hacky, and 5 applications might be overkill but it gives a little flexibility and is backward-compatible with the previous versions which monitored either 'RUN', 'DosBox' or 'ntvdm'.  I also improved the logging around all of this so it's a bit easier to troubleshoot.
 +
 +
Here's what the included INI file looks like, modify it to suit your needs:
 +
 +
<div class="CodeBlockHeader">Code:</div>
 +
<syntaxhighlight lang="sci">
 +
[sciAudio]
 +
GameExecutableName1=RUN
 +
GameExecutableName2=DOSBox
 +
GameExecutableName3=ntvdm
 +
GameExecutableName4=
 +
GameExecutableName5=
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
Version 1.2.1 includes a fix that was causing the application to not work reliably because it was checking for the game application 'too soon' and would abruptly exit.  Fix consists of a 5 second delay before watching currently running processes.
 +
 +
==<br /> Notes ==
 +
 +
If you decide to re-use the same sound instance for multiple sounds, it's up to you to reset any previously specified properties, otherwise they will be carried over into the next command
 +
 +
Use the sciAudio.log file (located in the same directory as executable) for troubleshooting sound playback.
  
 
==<br /> Download ==
 
==<br /> Download ==
Line 213: Line 253:
 
<blockquote>
 
<blockquote>
 
Download from here (source included):
 
Download from here (source included):
* [[Image:ZIP.PNG|ZIP File]] [[scidl:AudioUtilities/sciAudio10_wSRC.zip|sciAudio 1.0]]<span class="DLInfo"> (ZIP file) [200 KB]</span>
+
* [[Image:ZIP.png|ZIP File]] [[scidl:AudioUtilities/SciAudio_v1.2.1.zip|sciAudio 1.2.1]]<span class="DLInfo"> (ZIP file) [193 KB]</span>
 +
* [[Image:ZIP.png|ZIP File]] [[scidl:AudioUtilities/sciAudio10_wSRC.zip|sciAudio 1.0]]<span class="DLInfo"> (ZIP file) [200 KB]</span>
 
</blockquote>
 
</blockquote>
 +
 +
==<br /> References ==
 +
 +
<references />
  
 
==<br /> Also See ==
 
==<br /> Also See ==
  
* [[:Category:SCI Tools|SCI Tools]]
+
*

Latest revision as of 01:16, 20 May 2024

sciAudio
SciAudio.png
sciAudio Example
Latest Version:  1.2.1
Release Date:  Oct. 20, 2012
Company: N/A
Publication Status:  Published
Developer(s): Jeremiah Nellis
Interface:
Language: C#
Open Source: Open
Source Availability: 
License: None
Type: Mod Tool
Platform: Windows
Localization: English
Website: https://bitbucket.org/nellisjp/sciaudio/


sciAudio

Version 1.1

Developer: Jeremiah Nellis




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

  1. Place the 2 nAudio DLLs & executable into a subfolder within your game named 'sciAudio'
  2. Create subfolders within sciAudio for your playback files. Something like this

    <gamedir>\sciAudio\effects
    <gamedir>\sciAudio\music

  3. Include the sciAudio.sc script & 'use' it in any script you wish to have sciAudio playback in


Available commands

command <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()
)



Version 1.2/1.2.1

New version attached here and also put all this code into a git repo, apparently it wasn't before: https://bitbucket.org/nellisjp/sciaudio/

Now there is an sciAudio.ini file (needs to be in the sciAudio subdirectory of your game) that is read in and used for monitoring a list of (5) possible applications to monitor to determine when to kill sciAudio. It's a bit hacky, and 5 applications might be overkill but it gives a little flexibility and is backward-compatible with the previous versions which monitored either 'RUN', 'DosBox' or 'ntvdm'. I also improved the logging around all of this so it's a bit easier to troubleshoot.

Here's what the included INI file looks like, modify it to suit your needs:

Code:
[sciAudio]
GameExecutableName1=RUN
GameExecutableName2=DOSBox
GameExecutableName3=ntvdm
GameExecutableName4=
GameExecutableName5=

Version 1.2.1 includes a fix that was causing the application to not work reliably because it was checking for the game application 'too soon' and would abruptly exit. Fix consists of a 5 second delay before watching currently running processes.


Notes

If you decide to re-use the same sound instance for multiple sounds, it's up to you to reset any previously specified properties, otherwise they will be carried over into the next command

Use the sciAudio.log file (located in the same directory as executable) for troubleshooting sound playback.


Download

Download from here (source included):


References



Also See