Skip to content

SampleRateConverter converts frames at wrong rate #316

@TonalidadeHidrica

Description

@TonalidadeHidrica

When I played a 48000Hz mono-channel ogg file converted by UniformSourceIterator, in which the sample rate is converted in SampleRateConverter, the conversion rate seems to be slightly wrong.

First I generated a 48000Hz mono-channel ogg file which includes a metronome sound at 120 BPM for 400 beats with Audacity. Then I played it by this library, output the sound from the speaker, where the device output sample rate is set to 44100Hz, and record the sound from the speaker with the microphone via Audacity again. Then, the duration between the 0th and 200th beat was exactly 100.050 seconds. When I synthesize the wave derived from the ogg file with another tone constantly made 22050 samples, the 0th and 200th beat has the exact elapsed time of 100.000 seconds. The gap between the two source was becoming proportionally larger.

When I did the same experiment with 44100- and 22050-Hz ogg file, this gap didn't happen. We can infer that there is something wrong with conversion of sample rate. I have not made an in-depth inspection on the code though.

Since I found several other issues in SampleRateConverter other than this, I didn't fix the converter. That's why I'm just submitting an issue. FWIW, this is an alternative implementation I wrote. In this converter, I used floating-point operations to make a linear interpolation, so it may not be as concise as the converter in this library. Nevertheless my code does not have the issue of conversion error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions