Skip to main content
Topic: Track timing with Don't reset DSP between tracks (Read 360 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Track timing with Don't reset DSP between tracks

If I select the option "Don't reset DSP between tracks" in Converter, in order to process a gapless album, and have either SoX or SSRC resampler activated, the track split points will offset by a random amount. This doesn't happen with all effects: tracks times are unchanged with IIR Filter, and only occasionally changed with PPHS Resampler. Why aren't the splits precise as permitted by the output sampling rate?

I tried latest beta 17.


Re: Track timing with Don't reset DSP between tracks

Reply #1
and only occasionally changed with PPHS Resampler.
Even when it's in Ultra mode?

DSP plugins are allowed to change duration of audio (add silence, remove silence, crossfade etc etc), so foobar2000 cannot know precisely when one track ends and the next starts.

Re: Track timing with Don't reset DSP between tracks

Reply #2
In Ultra mode the duration changes by less than 1 CD sector, but it still sometimes changes. It is unexpected, because these resamplers keep duration precisely when used on one track at a time. If Foobar can't at all know if a plugin changes the duration, perhaps a note should be added on the converter page near the checkbox, and maybe the approximate splits should be rounded to 1/75 seconds.

Re: Track timing with Don't reset DSP between tracks

Reply #3
You have length issues when using the setting with DSPs that buffer samples.

A DSP gets N samples from input component at a time and sends it to a buffer. Once the buffer contains enough samples to be processed, processing is performed and as a result the DSP now has S samples to output.

The chunk sizes DSPs get depend on input formats and DSPs that are before them. Usually decoders output chunks at the format's native frame size. And at the end of a track chunk sizes can vary wildly.

I don't know the logic foobar2000 uses to decide when to change output track with this setup, but I'm pretty sure it doesn't split the chunks it receives from the DSP chain. As the sizes from inputs unlikely matches the chunk sizes from the buffer, the lengths will differ.

It could be hacked around for a special case where DSPs don't alter lengths. The converter could simply monitor duration going in and split things after getting the same duration out. But plenty of DSPs change lengths.

Best option for you is to not tick the checkbox and instead use SoX or SRC resamplers that feature signal extrapolation. That way track lengths don't get mutilated and the extrapolation should prevent glitches.

Re: Track timing with Don't reset DSP between tracks

Reply #4
I tested how SoX resamplers deals with chunks when foobar2000 resamples 44100 Hz FLAC file to 48000 Hz.

Sizes of input chunks : 4096; 4096; 4096; 4096; 4096; 4096; 4096; 4096; 4096; 4096;...
Sizes of output chunks : 7238; 5786; 3857; 3857; 5787; 3857; 3857; 3858; 5786; 3857; ...

(Apparently the decoder reads a FLAC frame, decodes it and sends an audio chunk to foobar2000 core. So the length of all input chunks is 4096 samples.)


Re: Track timing with Don't reset DSP between tracks

Reply #5
Thank you Case for elaborate, good explanation. I guess we have to accept what the current plugin architecture supports. Maybe in the free space below "slow, needed for crossfading", a warning could appear once the box is checked, "Track durations may change slightly", or similar. Does "slow" refer to the process becoming single-threaded, or is there another reason why conversion would become slow without reset?

I was looking to combine IIR Filter or possibly a VST EQ with resampler into one pass. In my experiment I had uncompressed wav files in input. The maximum deviation of track length depends on the Normal/Best mode selected, which makes sense, as best would have higher latency. With FLAC block size bumped to 16384 (only for this test), highest observed difference on one album increases from 3 to 12 CD frames.


Re: Track timing with Don't reset DSP between tracks

Reply #7
In Ultra mode the duration changes by less than 1 CD sector, but it still sometimes changes. It is unexpected, because these resamplers keep duration precisely when used on one track at a time. If Foobar can't at all know if a plugin changes the duration, perhaps a note should be added on the converter page near the checkbox, and maybe the approximate splits should be rounded to 1/75 seconds.
foobar2000 needs an API for DSP plugins so that they can signal the delay; then foobar2000 can compensate for it later.

Re: Track timing with Don't reset DSP between tracks

Reply #8
There is. It's required to synchronize visualizations with audio.

Re: Track timing with Don't reset DSP between tracks

Reply #9
Then why not let Converter use that information as well? ;)

 

Re: Track timing with Don't reset DSP between tracks

Reply #10
Issue noted, thanks for reporting.

 
SimplePortal 1.0.0 RC1 © 2008-2018