Page MenuHomePhabricator

Recording: Some audio recordings have "click" noises / distortion
Open, In Progress, HighPublicBUG REPORT

Description

This issue is critical : affected audios are corrupted, and corrupts by proximity their whole datasets.
This issue is widespread : vague estimate of one in 5 devices affected. In them, one in 6 audios corrupted.
This issue is replicable: we identified a device causing the bug and store it at Wikimedia France office. See here.
This issue is well documented: all discussion gathered , all discussion moved to LinguaLibre:Technical_board/Audio_click_bug
This issue is diagnosed: see below, thanks to @tstarling . @0x010C , the author of the JS code handling audio recording, came to similar conclusions.
This issue's origine is suspected: likely the js library is involved. See github.com/lingua-libre/LinguaRecorder

See also https://phabricator.wikimedia.org/T256663

A skilled, dedicated, professional developer is required to tackle this bug.

Event Timeline

Pamputt triaged this task as Unbreak Now! priority.Apr 25 2021, 6:13 PM

I think some samples are missing. I looked at LL-Q150_(fra)-Hélène_(Hsarrazin)-corné.wav in Audacity. There's a discontinuity at 0.3405s which could be explained by about 1ms of missing samples:

ll pop.png (353×1 px, 14 KB)

The discontinuity is easily visible in the spectrogram view. Once you zoom in, you can find it in the waveform view.

Similarly, here's one of at least two pops in LL-Q188 (deu)-Natschoba-der Wunsch.wav. The amplitude is modest, but again, the spectrogram (and the ear) easily picks it up.

ll pop2.png (510×1 px, 17 KB)

It looks a bit like a duplicate of T197599, although I can confirm that the commit which is supposed to have fixed that issue is live on lingualibre.org. And my understanding of T197599 is that it can only cause one pop per recording, whereas e.g. LL-Q7913 (ron)-Andreea Teodoraa-ofițer.wav seems to have four.

Aklapper lowered the priority of this task from Unbreak Now! to High.EditedAug 1 2021, 8:54 PM
Aklapper subscribed.

Three months without updates; does not seem to qualify for UBN priority

Yug renamed this task from Audio recording has "clicks" half the time to Recording: "audios click bug" corrupts recordings.Jul 7 2022, 10:35 AM
Yug updated the task description. (Show Details)

@tstarling , @Aklapper , @Pamputt : I gathered resources around this bug for 2 months, and I've been able to replicate it on some specific devices. I revamped this ticket's issue accordingly. This prepare the venue of a dedicated developer, so this person can start working right away, with corrupt audio samples at hand, hardware to replicate the bug, and suitable pointers.
@tstarling, please check these recording serie, where ~30% of the files are corrupted in a recording session just a month ago. If you could share with us those audio profile images and your reading, it could be be one more pointer for the developer who will attack this bug.
Wikimedia France is now on this issue as well. We are getting closer to solving this core issue.

Aklapper renamed this task from Recording: "audios click bug" corrupts recordings to Recording: Some audio recordings have "click" noises / distortion.Jul 7 2022, 12:13 PM
0x010C changed the task status from Open to In Progress.EditedAug 14 2023, 12:42 AM
0x010C claimed this task.

I may have found the source of the missing samples. A bugfix has been made in the commit 88444f2d.

TL;DR: This may be due to an error in the implementation of the LinguaRecorder library's cutting of audio recordings.

To go into details :
When recording, the LinguaRecorder library retrieves and stores audio samples in groups (blocs) of 4096 in a large array. Once the recording is complete, this array is flattened to a single dimension so that it can be converted to WAV and used. But before doing so, the recorder may need to trim the beginning and/or the end.

For example, when trimming the beginning, the ltrim function removes the first x blocks one after the other. There comes a time when fewer samples need to be removed than a complete block, and that's when the problem arise. At this point, ltrim was removing the last y samples of the bloc instead of the first y, creating a discontinuity of up to [4096 (usual samples bloc length) - 1] / 48000 (usual sample rate) = 0,085 seconds. And the same thing happens but reversed for the end cut.

As the bug is not easily reproducible, it's hard to say for sure, but it would explain the loss of samples on the defective files analyzed above.