Leicht geändert für den LinkFixed HE-AAC gapless playback issue
It seems that CoreAudio HE-AAC encoder finishes too early on HE-AAC encoding, and can result in too small amount of enc_padding. When enc_padding is smaller than 481 (which is the additional decoder delay for SBR), there's no way for decoder to reproduce complete samples, so decoded result will be get shorter.
This is actually a bug of CoreAudio encoder. I can see the very same behavior using iTunes, and when decoding resulting HE-AAC file by iTunes, decoded result is shorter than original.
You can see this by arbitrary 44.1khz 11 sec sample (number of samples=485100), which result in number of padding samples=74, and about 10ms at ending is dropped.
Since I'm using somewhat older iTunes (10.5.3.3) and I'm reluctant to upgrading it, I don't know if it's still true for new iTunes, but I believe so since I'm using recent CoreAudioToolbox.
As a workaround, qaac now feeds additional 2048 samples of silence to HE-AAC encoder and edit iTunSMPB so that it reflects original length. As a result, HE-AAC file encoded by qaac will now play gaplessly by iTunes, but it's no more bit-identical with the result of iTunes in case of HE-AAC.
Note that you still cannot play HE-AAC files outside Apple softwares because of this issue. I'm sorry I should have noticed earlier of this.
- Fix crash on reading unsigned 8bit PCM through libsndfile (for example, Wave64 format).
- Fix bogus (non-compliant) sgpd box written on gaplessmode 1 or 2. However, I don't still recommend using it. As far as I know, only iTunes is known to support it well. VLC also supports edts, but it seems VLC decodes first few frames of HE-AAC without SBR when edts is being used.
- Support float16 and float24 WAV and Wavpack file. float16 is assumed to be normalize in range [-65536, 65536], which is different from normal [-1,1] for floating point PCM. For details, read this thread on HA
- Show PCM sample format (int8 or something) when --verbose is specified. Both input format and resulting format are shown, the latter might be different due to DSP chain.
- Disabled automatic quantization to integer when sample format is converted to float by DSP chain and encoding to ALAC.
- Repackaged 64bit libsoxr.dll as libsoxr64.dll. Now refalac64 supports both names (of course it cannot use 32bit version of DLL, so be careful).
- Show more meaningful message on write error (MSVCRT assigns EINVAL for broken pipe error, resulting in "invalid parameter" message, which is not quite helpful).
- Some code clean up.
- Switched from libsoxrate to libsoxr and new libsoxconvolver. Like libsoxr, libsoxconvolver uses SIMD optimized DFT/convolution routine when SSE is available. This library is used for --lowpass, --matrix-preset and --matrix-file. Unlike libsoxrate, libsoxconvolver is 32bit float based.
- Add --peak and --play option.
Both doesn't produce output to a file, and cannot be used with other encoding option such as -V, -v, -a, -c, -A, and -D. However, DSP options such as --rate or --lowpass can be used.
--peak just scans input and print peak. Might be useful when you apply some DSP (especially mixing), and want to know resulting peak value before encoding.
--play does what it's name implies (play files using Wave Mapper device). Since qaac is an encoder and not a music player, don't expect much from it. It's just intended for cases when you want to test new custom matrix coefficients or something. --play doesn't automatically convert sample format, nor does remix.
- Changed random number generator (used for TPDF dither) to LCG, which is known to be poor in randomness but quite fast, and is enough for just generating white noise for dither.
- Don't flush immediately after writing WAV header when writing WAV file to a pipe. This makes pipe rewinding hack of SoX happier, but it seems not perfect. Basically speaking, SoX's pipe rewinding on win32 is nothing but a hack, so don't expect automatic format detecting of SoX to always work. Just use -t wav - or something to avoid unnecessary pipe rewinding.
- Some code cleanup.
- Fix help messages.
- Updated taglib (again).
- Fixed not to write tag when value of tag is empty.
- Support loading of libFLAC_dynamic.dll (this name is used by v1.3.0 DLL distributed at www.rarewares.org). Currently, qaac searches libFLAC dll in the following order.
libFLAC_dynamic.dll -> libFLAC.dll -> libFLAC-8.dll
Since 1.3.0 and 1.2.1 DLL are binary compatible within range of use by qaac, you can use any of them.
- Tags given by command line option now take precedence over default tool tag written by qaac. As a result, you can override tool tag if you want to (with --tag too:value).
- Updated TagLib to github current HEAD.
__Fixed an issue of --threading option. There was a possibility of non sample aligned read on the pipe, similar to the problem that was fixed on 2.04 and 2.05.
- Add optional libsoxr support. It's basically the same as libsoxrate (both derives from SoX), but is more optimized (fast), and is maintained by a developer of SoX.
When libsoxr.dll is present, now qaac/refalac will use it for sample rate conversion. libsoxr binary is on the cabinet page. Note that you still need libsoxrate when you want --lowpass or mixing option.
libsoxr binary built with GCC doesn't usually work with qaac/refalac due to a few ABI compatibility issues. The binary at cabinet page is built with GCC _with care_.
I have reported this issue to author of libsoxr, so it might be fixed in the future.
- Decreased refresh rate of progress on title bar of console window.
- Explicitly check presence of BOM when reading text files, since MLang often does a wrong guess even when BOM is present.