Audacity is using the wrong samples

I have just ran into this issue when I installed the latest audacity version (3.4.1), where when I import an audio file, the sample time is wrong.

Take this file

I import it into audacity and it says it’s 2350409 samples long, but when I use ffprobe, it says it’s 2558268.

Here’s a screenshot in audacity
https://forum.audacityteam.org/uploads/default/original/3X/8/f/8fa6d252af43c73463a44be010b6200aa47deb9a.png

And here’s the ffprobe results

{
    "streams": [
        {
            "index": 0,
            "codec_name": "vorbis",
            "codec_long_name": "Vorbis",
            "codec_type": "audio",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "sample_fmt": "fltp",
            "sample_rate": "48000",
            "channels": 2,
            "channel_layout": "stereo",
            "bits_per_sample": 0,
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/48000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 2558268,
            "duration": "53.297250",
            "bit_rate": "499821",
            "extradata_size": 4009,
            "disposition": {
                "default": 0,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0,
                "captions": 0,
                "descriptions": 0,
                "metadata": 0,
                "dependent": 0,
                "still_image": 0
            }
        }
    ],
    "format": {
        "filename": "Tour Piranha Plant Cove.ogg",
        "nb_streams": 1,
        "nb_programs": 0,
        "format_name": "ogg",
        "format_long_name": "Ogg",
        "start_time": "0.000000",
        "duration": "53.297250",
        "size": "3368359",
        "bit_rate": "505595",
        "probe_score": 100
    }
}

(the sample duration is duration_ts)

Another interesting things is that when I import the same audio file into an audacity project that was made before I had this issue, the sample duration is correct.
https://forum.audacityteam.org/uploads/default/original/3X/e/2/e2311e6f5c2130b55dd78213b49f94bddb8dbacb.png

I am extremely confused as why this could be happening, and how I could fix this.

The reason the images are links is only because of the new user restrictions

I have confirmed that this issue started in version 3.4.0. There is no issue in 3.3.3, which is what I’m gonna use for now, until this issue is fixed.

I am glad that you found a work-around for your issue. Curiously, 3.2.5 indicates the same as 3.4.1:
image

I have a feeling the problem has to do with the project file, because when I open a project that was made in version 3.4.1 in 3.3.3, the issue is there, even though when I create a new project and import the audio file, the samples are correct.

Before 3.4.0, if the first audio track in a project was created by opening or importing a file, then the project’s sample rate was automatically changed to be the sample rate of this track.
In 3.4.0, the project’s sample rate remains unchanged.
The samples in the selection start and end controls use the project’s sample rate.
So you may need to adjust the project’s sample rate to get the numbers that you expect. (The audio settings page of the preferences dialog.)

1 Like

Good catch, David:

image

I did not know about that. It makes so much sense that I’m just setting that as the solution before I actually test it out (and @jademan has already proved it).

I finally was able to test it out, and yes, that was in fact the problem.