Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Unexpected audio format change - strange output files created (Read 703 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Unexpected audio format change - strange output files created

I've been transcoding my library from FLAC to OGG (for mobile use).
And because I'm applying some DSP, I switched on "don't reset DSP between tracks" (to avoid glitches on gapless track transitions).

When the sample rate changes I get the error "unexpected audio format change", which is to be expected.
However, what confused me was the output files that got created.

Let's say we're processing files in this order:
Album A/Final Track  (44.1kHz)
Album B/Track 1  (48kHz)
Album B/Track 2  (48kHz)

The messages that report the errors are:
Source: "....\Album A\Final Track.flac"
  An error occurred while writing to file (Unexpected audio format change) : "....\Album A\Final Track.ogg"
Source: "...\Album B\Track 1.flac"
  Conversion failed: Unexpected audio format change

The output files that get created are:
Album A/Final Track.ogg - all good
Album B/Track 1.ogg - contains the content of Track 2
Album B/Track 2.ogg - very short containing no usable audio data

Now that I've discovered exactly what files get created, I know how to cope (re-transcode the first two tracks of Album B), but I was just interested if anyone can explain why the error messages don't identify the files that are actually affected.

(Using foobar2000 v2.0 if that's relevant).

Re: Unexpected audio format change - strange output files created

Reply #1
To start you really should upgrade from foobar2000 v2.0. That version has very bad bugs.

I don't know if my head isn't working right, but the error you quote should only happen if you try to encode files with differing specs into a single file - not when you encode tracks into separate files.
But if that error also happens with foobar2000 v2.1.4 or v2.2 preview, I'd like to hear what kind of DSP config you use to trigger it.

Re: Unexpected audio format change - strange output files created

Reply #2
To start you really should upgrade from foobar2000 v2.0. That version has very bad bugs.

I don't know if my head isn't working right, but the error you quote should only happen if you try to encode files with differing specs into a single file - not when you encode tracks into separate files.
But if that error also happens with foobar2000 v2.1.4 or v2.2 preview, I'd like to hear what kind of DSP config you use to trigger it.
OK thanks - I'll update to a later version and let you know what happens.
(In the meantime, FYI I was encoding to separate files).

EDIT: Updated to version 2.1.4 and got exactly the same results as with v2.0. (Note that this is the 32 bit Windows version, if that's relevant).

The transcoding is from FLAC to OGG.
The FLAC source files have ReplayGain tags.
The DSP being used on transcode is:
- ReplayGain: apply album gain, prevent clipping according to album peak.
- SqrSoft Compressor/Limiter: gain 0, threshold -18, ratio 1:inf, attack 3, hold 6, release 300, stereo tie on, lookahead 10, gain 9.
- Don't reset DSP between tracks is ON.
(The reason for all this DSP is because the OGG is for portable use in noisy environments like planes and cars).

If I switch Don't reset DSP between tracks OFF, the conversion happens without error.

Re: Unexpected audio format change - strange output files created

Reply #3
Thanks for the bug report.
Main problem is that "no DSP reset" mode treats all input as one audio stream and partitions output back into tracks, making use of original track lengths + reported DSP latency. After something failed in the middle, the output no longer really makes sense and the conversion goes off the rails, precisely as you've observed.
For the next version, I changed it so it fails converting remaining tracks (no further output written) after such error.
I think you want to convert each album as a separate batch. What you currently do can cause last samples of album N to be mixed up with first samples of album N+1 in the list.
I'll keep this scenario in mind for a future update, perhaps I can add no-DSP-reset-between-album-tracks as a feature so you don't have to convert each album manually.

Also, why not just resample everything to a fixed rate before doing any other DSP?
Microsoft Windows: We can't script here, this is bat country.

Re: Unexpected audio format change - strange output files created

Reply #4
Thanks for the bug report.
Main problem is that "no DSP reset" mode treats all input as one audio stream and partitions output back into tracks, making use of original track lengths + reported DSP latency. After something failed in the middle, the output no longer really makes sense and the conversion goes off the rails, precisely as you've observed.
Ok thanks. I now understand why it all goes pear-shaped.
Quote
I think you want to convert each album as a separate batch.
That makes sense, except this was a fresh transcode of my entire library, so doing it all in one go was much easier. The reason for the fresh transcode was because previously (without the "no DSP reset") I had too many instances of little glitches at the boundaries of tracks that ran into one another (eg. things like Dark Side Of The Moon, Beethoven Symphony 5, etc).
My library is nearly all 44.1kHz, with just a small smattering of 48kHz albums (typically ripped from DVDs).
Quote
Also, why not just resample everything to a fixed rate before doing any other DSP?
Yes, good idea. I frankly didn't even remember I had some 48kHz albums until I Googled what the error message actually meant.