# FFSoX Player

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

## Contents

 About News Objectives Installation Additional Setup General Configuration Configuring SoX Amplification The "vol" Effect The "gain" Effect Resampling Dithering

FFSoX Player is a Winamp input plug-in based on the FFmpeg and SoX libraries. Using FFmepg almost all multimedia files may be played with Winamp, including but by far not restricted to H.264 and VP8. Audiophile sound processing is provided using high quality 32 bit SoX algorithms and dithering.

Note that only a minimal FFmpeg is bundled with FFSoX Player releases. If you you want to have full FFmpeg support you have to get a complete FFmpeg build from third party sites (see below).

 Home: http://in-ffsox.sourceforge.net/ Project: http://sourceforge.net/projects/in-ffsox/ Download: http://sourceforge.net/projects/in-ffsox/files/ FFSoX Player at HA Forum: http://www.hydrogenaudio.org/forums/index.php?showtopic=81613 FFSoX Player at WA Forum: http://forums.winamp.com/showthread.php?t=319968 FFSoX Player at Doom9 Forum: http://forum.doom9.org/showthread.php?t=155350 Getting Help: http://sourceforge.net/projects/in-ffsox/forums/forum/1162526 General Discussion: http://sourceforge.net/projects/in-ffsox/forums/forum/1162525 Loudness Analysis with R128GAIN: http://r128gain.sourceforge.net/

## News

2012-12-13 0.6.1
• Provided a switch to enable the "steep filter" for the SoX resampler.
• Disabled editing all drop down boxes except "replay gain mode" and "phase response" for the SoX resampler.
• Accepted input for the "replay gain mode" is 0..100.
• Accepted input for the "phase response" is 0..100.
 SoXvery high qualitylinear phase responsesteep filter Sweep http://src.infinitewave.ca/ Passband http://src.infinitewave.ca/ SRCsinc best Sweep http://src.infinitewave.ca/ Passband http://src.infinitewave.ca/
2012-12-08 0.6.0
• Provided the Secret Rabbit Code (SRC) resampler as an alternative to the SoX resampler.
• Please note that the SRC resampler takes a lot of CPU compared to the SoX resampler:
 SRC (best) SoX (very high) SRC (medium)
2012-11-25 0.5.0
• Allow for applying intermediate replay gain values between album gain (0%) and track gain (100%):
• Fixed a memory leak.
2012-11-04 0.4.9-2
• Made it compatible with the latest FFmpeg version.
• Requires "avutil-52.dll".
2012-04-29 0.4.9 Looking up "in_ffsox.ini" as described by "DrO" at WA forum:
use IPC_GETINIDIRECTORY(W) from wa_ipc.h and then append \Plugins\in_ffsox to get
the correct location - that api has been around since 2.9x

-daz
2012-03-09 0.4.8
• Upgraded to new SoX 14.4.0.
• Restructured build process for the tool chain.
2012-02-11 0.4.7
• According to FFmpeg.org: FFmpeg development has gone into OVERDRIVE. As a consequence the FFSoX Player plugin wasn't compiling any longer using the latest FFmpeg versions. This release ports the FFSoX Player plugin to the latest FFmpeg API.
• Video synchronization has been greatly improved by replacing heuristics with a call to av_opt_ptr(avcodec_get_frame_class(), frame, "best_effort_timestamp");
• This release requires "avformat-54.dll" and "avcodec-54.dll", and is now again in line with the latest FFmpeg builds from http://ffmpeg.zeranoe.com/builds/win32/shared/ (cf. installation below.)
2011-10-13 0.4.6.7
• Unicode support for file and directory names.
• Option "SoX Decoder" removed.
2011-10-03 0.4.6.6
• Provided the option "Force Seek" in order to allow for seeking without any test whether seeking is supported by a format or not.
NOTE: If checked and a particular format doesn't support seeking the behaviour is undefined.
• Provided the option "Prefer Float" for switching on/off 32 bit floating point decoders for lossy codecs.
2011-10-01 0.4.6.5
• Enables 32 bit float format for e.g. MP3, AC3 and other lossy audio codecs.
• Enables (and requires) usage of "swscale-2.dll".
2011-05-15 0.4.6.4 Important: Requires "bumped" FFmpeg, i.e. "avformat-53.dll", "avcodec-53.dll", and "avutil-51.dll". For upgrading to the latest full FFmpeg build (cf. installation below) get the respective DDLs from
http://ffmpeg.zeranoe.com/builds/win32/shared/, or
http://www.bizzeh.com/ffmpeg/free/shared/.
2011-01-15 0.4.6
• Support for integrated playback of
• EBU R128 compliant tagged and
• classical ReplayGain compliant tagged

• In order to avoid clipping during up-sampling it is now by defualt
• the first effect in the chain if the resulting gain is an amplification, or
• the last effect in the chain if the resulting gain is an attenuation.
2010-12-16 0.4.5
• Fixed mapping tags (under certain circumstances "Album Artist" where not properly mapped or could mask "Album").
• Fixed playing mono.
• Changed suggestion when to use "multiple integer" mode for up-sampling.
2010-10-10 0.4.4
• Changed order of applying the replay gain and resampling effects. Resampling is now the first effect.
• The stereo (2.0) audio stream is preferred over any other audio stream.
• Added an "Objectives" section to the documentation (currently only with respect to audio processing).
2010-08-28 0.4.3
• Fixed Musepack SV7 and SV8 formats crashing at the end of a track.
2010-08-22 0.4.2
• Fixed seeking OGG.
• Verified that sreaming (e.g. via HTTP) is supported. For streaming "SoX decoder" in preferences should be switched off.
2010-08-08 0.4.1
• Support for "avcore-0.dll" (new FFmpeg library, c.f. also how to install FFmpeg from third party sites below).
• Resolved some video synchronization issues.
• Switch on/off SoX decoders via configuration.
2010-07-25 0.4
• Enabled seeking (depends on whether the corresponding FFmpeg format supports it).
• Made switching on/off the gain effect's limiter available in configuration dialog.
• Resolved some issues which caused the plug-in to crash in case of unsupported codecs.
2010-07-04 0.3
2010-07-04 0.2.1
• Fixed a minor bug which caused the plug-in to crash in case of unsupported codecs.
2010-07-03 0.2.1
• No need any longer to switch off global RG settings.
2010-07-03 0.2
• Added FFmpeg source code to "in_ffsox-0.2-src.tar.gz" in order to comply with FFmpeg license.
2010-06-27 0.2
• Minimal FFmpeg added (only with decoders/containers for VORBIS, FLAC, WAVPACK, WAV, THEORA, VP8, OGG, MKV, WEBM).
2010-06-13 0.1
• Initial release.
• Decoding via libSoX.

## Objectives

Please note: Most of the following, if not all, will not apply if you prefer to listen to your music by a simple 2.1 system (or similar) on your desktop. We refer to our home stereo tool chain:

The whole thing started some years ago by being totally annoyed by the crappy sound coming out of the speakers when connecting the PC to the home stereo.

In order to get an idea of what potentially disturbs digital audio plaback you may read the "The Unique Evils of Digital Audio" paper published by Benchmark Media Systems, Inc, one of the leading suppliers of digital audio equipment. The bottom line is that each distortion in the playback chain, being it jitter (induced by fluctuations of your DAC's clock) or quantization noise (rounding errors induced by digital sound processing, e.g. the application of replay gain), will correspond to the generation of nonhamonics interfering with the original signal.

There are a lot of people out there telling you that you are physically unable to here distortions of that small order of magnitute. Don't believe them by any means:

• If you yourself here it, than it should be enough of evidence at all.
• And of course you are physically able to here the annoying interference effects induced by the nonharmonics corresponding to any distortion even if of small order of magnitude.

A main objective of the solution proposed here (the Winamp plug-in is only part of it) is to minimize any distortion of the audio signal, or to avoid it at all, if possible. This contradicts the second main objective to provide replay gain, unfortunately implying digital sound processing (DSP), i.e. altering the audio signal by intention in the digital domain. The compromise is as follows:

## Installation

1. If not already done download and install Winamp (v5.58 recommended, v5.572 should work, v5.571 may crash on playing video, v5.56 should work).
2. If not already done close Winamp.
4. Run the installer "in_ffsox-<ver>.exe".
5. If you want to have full FFmpeg support do the following:
6. Start Winamp.

The following steps are strictly not needed but recommended.

1. If not already done close Winamp.
2. If your sound card doesn't support native ASIO (if you've never heard about ASIO this propably is the case) download and install ASIO4ALL.
3. Google for "winamp asio otachan".
4. Download the "out_asio(dll).dll" and drop it into Winamp's "Plugins" sub-folder (e.g. "C:\Program Files\Winamp\Plugins").
5. Start Winamp.

## General Configuration

1. If not already done start Winamp.
2. Go to Options -> Preferences -> Output -> ASIO output:

3. Choose the device (e.g. ASIO4ALL or your native ASIO driver):

4. Close both preference dialogs.
5. Start playing a song.
6. Double click the ASIO4ALL symbol appearing at the far right of Window's task bar.

Note the bit depth (e.g. 16 or 24 bits).

7. If there are drop outs adjust buffer sizes for both, ASIO4ALL and Winamp's ASIO plug-in.
8. Go to Options -> Preferences -> Input -> FFSoX Player:

9. Adjust Extensions and Bits per Sample (according to ASIO4ALL, see above).

Note: If choosing an extension make sure that no other input plug-in is supporting the same.

10. Go to Options -> Preferences -> File Types and click All:

11. Go to Options -> Preferences -> Playback -> Playback and adjust Allow 24bit depending on wether your sound device is 24 bit or not (see ASIO4ALL above).

12. Go to Options -> Preferences -> Video and adjust Video Preferences according to your needs:

## Configuring SoX

### The "vol" Effect

Coosing "vol" from the drop down box corresponds to the following SoX command:

sox <input file> <output file> vol <gain>dB


Switching on "Limit" adds a limiter with the associated limiter gain to the "vol" effect:

sox <input file> <output file> vol <gain>dB <limiter gain>


In case of attenuation no limiter is added even if switched on.

### The "gain" Effect

Coosing "gain" from the drop down box corresponds to the following SoX command:

sox <input file> <output file> gain <gain>


Switching on "Limit" adds a limiter to the "gain" effect:

sox <input file> <output file> gain -l <gain>


In case of attenuation no limiter is added even if switched on.

### Resampling

Depending on your taste and on the capabilities of your digital analog converter (DAC, see e.g. http://en.wikipedia.org/wiki/Digital-to-analog_converter) you may wish to up-sample the audio. This is done by choosing an appropriate sample frequency from the corresponding drop-down box. The corresponding SoX command looks like

sox <input file> <output file> rate <sample frequency>


Depending on the power of your PC you may wish to select a quality level for resampling (cf. SoX man page):

sox <input file> <output file> rate [-q|-l|-m|-h|-v] <sample frequency>


The switch Largest Multiple defines how the FFSox Player plug-in should interpret the selected sample frequency:

• If the switch is off the chosen sample frequency is not altered.
• If the switch is on the chosen sample frequency is altered to the largest integer multiple of the original sample frequency less or equal to the chosen one:

• If e.g. the chosen sample frequency is 96000 Hz (double of DVD standard) and the original sample frequency is 44100 Hz (CD standard) the up-sample frequency will be 88200 Hz (i.e. 2 × 44100).

• If e.g. again the chosen sample frequency is 96000 Hz (double of DVD standard) and the original sample frequency is 22050 Hz (e.g. Youtube video) the up-sample frequency will also be 88200 Hz (i.e. 4 × 22050).
• If e.g. once again the chosen sample frequency is 96000 Hz (double of DVD standard) and the original sample frequency is 48000 Hz (DVD standard) the up-sample frequency finally will be 96000 Hz (i.e. 2 × 48000).

Because this mode avoids odd fractions between input and output sample frequencies it is of particular interest if you only want to up-sample during play-back because of sound improvement and are not bound to a particular output sample frequency.

### Dithering

Dithering is a kind of "intelligent" rounding when it comes to throwing away the superfluous bits from SoX's internal 32 bit sound representation (i.e. 8 bits in case you've chosen 24 bit for output and 16 bits in case of 16 bits for output, cf. http://en.wikipedia.org/wiki/Dither). Please note that dithering is a matter of taste.

Activating dithering corresponds to the following SoX command:

sox <input file> <output file> <amplify> <resample> dither


Activating noise shaping corresponds to the following SoX command:

sox <input file> <output file> <amplify> <resample> dither -s