SoundOut is a GUI driven sound output module for AviSynth.
Installation and Usage
Copy "SoundOut.dll" and "libsndfile-1.dll" to your AviSynth plugin directory, usually "c:\program files\avisynth 2.5\plugins". If you want to have "SoundOut.dll" in another location, you should move "libsndfile-1.dll" to your system32 folder, usually "c:\windows\system32".
Add SoundOut() to your script where you would like to export audio. If you have your video stored in a variable, use SoundOut(variable) to add SoundOut. A GUI should then pop up when you open your script. Here is a simple example of how to use it:
If you need to do some sample processing, i.e. to change the samplerate or otherwise edit your video, you must do it before calling the SoundOut module. Like this:
This will allow you to export uncompressed audio to the following formats:
- Microsoft WAV format
- Apple/SGI AIFF format
- Sun/NeXT AU format
- RAW PCM data
- Sonic Foundry's 64 bit RIFF/WAV (WAVE64)
- Apple Core Audio File format
- Microsoft WAV format with Broadcast Wave Format chunk.
Note, that 8 bit samples are NOT supported in the Core Audio File and Sun/NeXT AU format.
This will allow you to export lossless compressed audio FLAC format.
FLAC supports 8, 16 or 24 bit audio. Any other format is internally converted to 24 bit.
This will allow you to export lossless compressed audio to the Monkey Audio Codec (APE) format. APE does not support input sample sizes that are larger than 2GB. Use only for smaller files.
APE supports 8, 16 or 24 bit audio. Any other format is internally converted to 24 bit.
This will allow you to compress your audio to MPEG 1 Layer 2 (MP2).
TwoLame only supports 16 mono or stereo audio. If you attempt to compress more than two channels, an error will be shown. Any other format than 16 bit integer samples are internally converted to 16 bit.
This will allow you to compress your audio to MPEG 1 Layer 3 (MP3) using LAME v3.97 encoder.
LAME Supports up to two channels of audio and the following samplerates: 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025 and 8000Hz.
This will allow you to compress your audio to A/52 (AC3). The encoding is done via libaften.
Aften supports 1 to 6 channel audio. Supported samplerates are 48000, 44100 or 32000 samples per second.
Channel mapping is:
|Number of channels||Channel order|
|3||Left, Center, Right|
|4||Left, Right, Surround Left, Surround Right|
|5||Left, Center, Right, Surround Left, Surround Right|
|6||Left, Center, Right, Surround Left, Surround Right, LFE|
This will allow you to compress your audio to an Vorbis encoded OGG file. It is possible to give an average bitrate, or do the encode as CBR.
WavPack is a completely open audio compression format providing lossless, high-quality lossy compression mode. Compatible with virtually all PCM audio formats including 8, 16, 24, and 32-bit ints; 32-bit floats; mono, stereo, and multichannel; sampling rates from 6 to 192 kHz (and non-standard rates)
This output module will allow you to output to any program that supports input from stdin. This gives you complete control of your encoding, if you have commandline tools for the job.
You can select the format SoundOut should deliver to the application you use. There are three WAV formats and RAW PCM data. This is sent to stdin of the application. The program builds the command line from 4 parts, the executable, command line options before the output file, the output file that is selected, and command line options after the output file name.
There are two ways of specifying the executable. Either give complete path to the executable, or simply enter the executable's filename, and place it in a subdirectory called SoundOut in your plugin directory.
Exporting from script
It is possible to use SoundOut as an ordinary filter, running inside the script and giving parameters for each output mode. The parameters consists of two things: General Parameters, which can be used for all filters, and filter specific parameters, which gives parameters to the active output module.
The out parameter determines whether the GUI will be shown, if it is properly set, the filter will begin exporting audio as soon as it is started.
If the out parameter is not set, it is still possible to set additional parameters. The defaults will however be retrieved from the registry, but specific parameters override
|output||string|| Select output module to use. Possible values are: |
"WAV", "AC3", "MP2", "MP3", "OGG", "FLAC", "MAC", "WV" and "CMD".
|filename||string|| Full path to the output filename, including extension. |
No extra quotes are required.
|showprogress||boolean||Show the progress window? Default: true|
|overwritefile||string|| "Yes": Always overwrite file. |
"No": Never Overwrite file.
|autoclose||bool|| Should the progress window close automatically 5 seconds after encoding has finished? |
This will also code the window, even though an error occurred.
|silentblock||bool|| When processing, enabling this option will return silent samples instead of blocking the requesting application. If disabled, any application requesting audio will be blocking, while sound is being exported |
|addvideo||bool|| When enabled, this will add video to the current output, if none is present. The video is a black 32x32 pixels at 25fps, with the length of the audio. |
|wait||integer|| How many seconds should the output window be shown, if autoclose is on.|
WAV/AIF/CAF Script Parameters:
|type||integer|| Select WAVE format |
0: Microsoft WAV (default),
|format||integer||Sets the sample format number of bits per sample. |
0: 16bit per sample,
|peakchunck||boolean|| Add Peak chunk to WAV file? |
Audio will be written in the format delivered to the SoundOut plugin. All internal sound formats are supported.
FLAC Script Parameters:
|compressionlevel||integer|| Sets the compression level. 1 (fastest) to 8 (slowest) |
APE Script Parameters:
|compressionlevel||integer|| Sets the compression level. 1 (fastest) to 6 (slowest) |
MP2 Script Parameters:
|bitrate||integer|| Sets Bitrate for CBR or maximum bitrate for VBR. |
|stereomode||integer|| -1: Automatic (default) |
0: Separate Stereo
|psymodel||integer|| -1: Fast & Dumb |
0: Low complexity
|vbrquality||float|| Sets VBR Quality. Useful range is about -10 to 10. |
Default is 0
|vbr||boolean|| Encode as VBR? |
|quick||boolean|| Quick Encode? |
|dab||boolean|| Add DAB Extensions? |
|crc||boolean|| Add CRC Error checks? |
|original||boolean|| Set Original Flag? |
|copyright||boolean|| Set Copyright flag? |
|emphasis||integer|| Set Emphasis flag. |
0: No Emphasis (default)
MP3 Script Parameters:
|mode||integer|| Sets Encoding mode: |
0: VBR (default)
|vbrpreset||integer|| Sets quality preset, when using VBR mode. |
Standard = 1001 (default),
|abrrate||integer|| Sets Average bitrate for ABR encoding. |
AC3 Script Parameters:
|iscbr||boolean|| Encode at Constant Bitrate? |
|cbrrate||integer|| Sets Bitrate for CBR or maximum bitrate for VBR. |
|vbrquality||integer|| VBR Bitrate quality. Values between 1 and 1023 are accepted. |
|drc||integer|| Dynamic Range Compression
0: Film Light
|acmod||integer|| Set channel mapping. |
0 = 1+1 (Ch1,Ch2)
|dialognormalization||integer|| Dialog normalization. Values from 0 to 31 are accepted. |
|islfe||boolean|| Is there LFE channel present? |
Default: false if less than 4 channels, true otherwise.
|bandwidthfilter||boolean|| Use the bandwidth low-pass filter? |
|lfelowpass||boolean|| Use the LFE low-pass filter. |
|dchighpass||boolean|| Use the DC high-pass filter. |
|dolbysurround||boolean|| Is the material Dolby Surround encoded? (only applies to stereo sound, otherwise ignored) |
|blockswitch||boolean|| Selectively use 256-point MDCT? |
Default: false (Use only 512-point MDCT).
|accuratealloc||boolean|| Do more accurate encoding? |
OGG Script Parameters:
|vbrbitrate||integer|| Selects the average bitrate to encode at. |
|cbr||boolean|| Encode as CBR? |
Wavpack Script Parameters:
|compressionlevel||integer|| Sets the compression level. 0(Very Fast) to 5(Extremely Slow)|
Default: 2 (Normal)
|format||integer||Sets the sample format number of bits per sample. |
0: 8bit per sample,
Commandline Output Script Parameters:
|type||integer|| Select WAVE format. |
0: Microsoft WAV (default),
|format||integer|| Select Output Bits per sample. |
0: 16 Bit
|executable||string|| Executable to use. |
Default: "aften.exe" (without quotes).
|prefilename||string|| Parameters that are placed before the output filename. |
Default: "-b 384 -" (without quotes).
|postfilename||string|| Parameters that are placed after the output filename. |
Default: "" (without quotes).
|showoutput||boolean|| Show the output window? |
|nofilename||boolean|| Encode without output filename, and don't use postfilename? |
SoundOut(output = "mp3", filename="c:\outputFile.mp3", autoclose = true, showprogress = true, mode = 2, cbrrate = 192)
Engages mp3 output module with CBR at 192kbit/sec.
SoundOut is multi-threaded, and uses one thread for requesting audio from the previous filters, and another thread for encoding. The threads are given a "below normal" priority.
Only attempt to run two exports at the same time at your own risk. It is most likely slower and could potentially crash. You can safely export sound while you encode, if your encode does not read audio from AviSynth.
|v2.60||Initial Release; based on v1.1.1|
- Downgraded FLAC to v1.2.0, to avoid backwards incompatible 24 bit files.
- Conversion tune-up.
- OverWriteFile set to "No" was not respected.
- Client sample requests shown in GUI.
- Added WavPack output module.
- Added Sample type selection to WAV Output.
- Updated FLAC to v 1.2.1 - 24 bit/sample seems broken, so only 8 & 16 bit are enabled.
- Fixed bug in FLAC to enable files larger than 2GB.
- FLAC now uses the same GUI as other filters.
- Aften updated.
- Re-enabled Aften multithreading.
- Faster 3DNOW! float to 24 bit conversion.
- Vorbis, AC3 and MP3 now checks if file can be created.
- Fixed hang in aften on multiprocessor machines.
- Added wait parameter, how many seconds should SoundOut wait on autoclose.
- Avoid lockup if encoder cannot be initialized and set for direct output.
- Fixed OverwriteFile was not always being respected.
- Updated libaften to rev534.
- Fixed overwriteFile not being recognized in script.
- Fixed crash if mp2 file could not be opened for writing.
- Exit blocked, even if filter is (almost) instantly destroyed, if script is set for output.
- AC3 is now reporting the actual samples encoded (including padding).
- Updated libaften to rev. 512.
- Added overwriteFile="yes"/"no"/"ask". Default is Ask.
- The application will not exit, as long as an encode window is open.
- Fixed "nofilename" not being recognized in script.
- LFE no longer overridden by registry, when using GUI.
- Added ReplayGain calculation to Analyze.
- Parent filters are now blocked, or silent samples are returned, if the filter is currently exporting sound.
- Video is automatically added, if none is present. (black 32x32 RGB32)
- Buttons for export are disabled when output window is open.
- Main window is now minimized when export module is selected.
- Fixed Analyze bug on 16 bit samples.
- Fixed WAVEFORMATEXTENSIBLE channel mapping in Commandline Output.
- AC3 output: LFE option disabled when not relevant.
- AC3 output: LFE option named properly.
- Added Analyze option to calculate average, maximum and RMS levels. Only available through GUI.
- WAVEFORMATEXTENSIBLE in commandline out attempts to set channel maps based on channel number.
- Fixed thread race issue on very fast encoders.
- Minor GUI tweaks.
- Added channelmapping to AC3 output.
- Added LFE channel indicator switch to AC3 output.
- GUI now spawned in a new thread, fixing GUI lockup in foobar2000 and similar.
- Fixed general thread race issue, where a fast encoder might lead to incomplete output.
- Fixed WAVE_FORMAT_EXTENSIBLE header without info in CmdLine Output.
- Fixed "Format" not working on Commandline output.
- Fixed Filename dialog not appearing.
- Forced final samplereading to be correct.
- Removed "private" option from MP2 GUI and script, as there is no way to set it via twolame.
- Removed DAB Extensions from MP2 GUI, as TwoLame reports it as not functioning.
- Added complete script customization.
- Added possibility to set output file from script.
- Added window autoclose option to script.
- Added option to script to disable progress window.
- GUI creates message handle thread.
- Settings are now saved to registry if output filter initializes successfully.
- Updated documentation.
- Added Broadcast WAVE out.
- Fixed OGG Vorbis support.
- Fixed Text fields not being correctly read.
- Fixed AC3 settings not being restored properly.
- Added: MP2 settings are now saved.
- Added OGG Vorbis support.
- Added: Parameters stored (on save) and read to registry.
- Added: "No filename needed" option in commandline output, to disable output filename prompt.
- Fixed collision between libaften and libvorbis.
- Updated libaften to rev 257.
- Enabled SSE optimizations in libaften.
- Hopefully fixed issue with commandline executable filename becoming garbled.
- Added Commandline piping output.
- Added MP3 / LAME output.
- Fixed AC3 VBR Error sometimes wrongly being displayed.
- Fixed AC3 DRC Setting not being respected.
- Various GUI bugfixes.
- Updated AC3 GUI.
- Fixed crash in WAV output.
- More stats during conversion.
- Added AC3 Output.
- Added new parameter handling.
- Fixed last block not being encoded.[[Category:]]