jniemann66 / ReSampler

High quality command-line audio sample rate converter
GNU Lesser General Public License v2.1
160 stars 25 forks source link

Sound duration #39

Open sergeevabc opened 7 months ago

sergeevabc commented 7 months ago

Windows 7 x64, ReSampler 2.1.0

Source: Swept_24.wav from http://src.infinitewave.ca/TestSignals.zip

$ mediainfo Swept_24.wav
Duration                                 : 8 s 0 ms

$ resampler -i Swept_24.wav -o out-res.wav -r 44100 --doubleprecision
2.1.0 64-bit version
Input file: Swept_24.wav
Output file: out-res.wav
Using double precision for calculations.
input bit format: 24
source file channels: 1
input sample rate: 96000
output sample rate: 44100
Scanning input file for peaks ...Done
Peak input sample: 0.500000 (-6.020598 dBFS) at 0:0:0.100000
LPF transition frequency: 20045.45 Hz (90.91 %)
Conversion ratio: 0.459375 (147:320)
Writing Metadata
Converting (multi-stage) ...
Writing to output file ...
Done
Peak output sample: 0.500000 (-6.020597 dBFS)
Time=333 ms [24.0x]

$ mediainfo out-res.wav
Duration                                 : 7 s 997 ms

If I add --singleStage, then Duration is still not 8 s, but 7 s 999 ms.

Other resamplers I know of keep the sound duration intact.

jniemann66 commented 7 months ago

Yes, this is a manifestation of the same problem as Issue #34

The good news is that I actually fixed it (in the source code). The bad news is that I neglected to compile and release the new binaries for it ! (my apologies)

I'm building a new set of binaries now, and will upload a new release shortly, once I am satisfied that it's all good.

here is what happens when I repeat your test above:

$ ReSampler -i /c/Users/juddn/Documents/infinitewave-test-signals/Swept_24.wav -o ass.wav -r 44100
2.1.0 64-bit version
Input file: C:/Users/juddn/Documents/infinitewave-test-signals/Swept_24.wav
Output file: ass.wav
input bit format: 24
source file channels: 1
input sample rate: 96000
output sample rate: 44100
Scanning input file for peaks ...Done
Peak input sample: 0.500000 (-6.020598 dBFS) at 0:0:0.100000
LPF transition frequency: 20045.45 Hz (90.91 %)
Conversion ratio: 0.459375 (147:320)
Writing Metadata
Converting (multi-stage) ...
Writing to output file ...
Done
Peak output sample: 0.500000 (-6.020595 dBFS)
Time=209 ms [38.3x]

$ /c/bin/MediaInfo.exe ass.wav
General
Complete name                            : ass.wav
Format                                   : Wave
Format settings                          : PcmWaveformat
File size                                : 1.01 MiB
Duration                                 : 8 s 0 ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 1 058 kb/s

Audio
Format                                   : PCM
Format settings                          : Little / Signed
Codec ID                                 : 1
Duration                                 : 8 s 0 ms
Bit rate mode                            : Constant
Bit rate                                 : 1 058 kb/s
Channel(s)                               : 1 channel
Sampling rate                            : 44.1 kHz
Bit depth                                : 24 bits
Stream size                              : 1.01 MiB (100%)
jniemann66 commented 7 months ago

@sergeevabc I have published a pre-release of 2.1.1 Can you please see if you can get it running, and verify whether it has addressed the issue ? Many Thanks, Judd

sergeevabc commented 7 months ago

Judd, I confirm that it works on my end.

By the way, why are the files created with the --singleStage flag slightly different in size?