Audacity Bug Summary
••• Introduction •••
••• Keywords •••
    Audacity 3.0.3 development began 19th April 2021

Audacity Bugzilla



Bug 1574 - Built-in generators may generate wrong length
Built-in generators may generate wrong length
Status: RESOLVED FIXED
Product: Audacity
Classification: Unclassified
Component: Built-in FX
unspecified
Per OS Linux
: P4 Repeatable
Assigned To: Steve Daulton
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-01-03 09:15 UTC by Steve Daulton
Modified: 2018-08-20 11:45 UTC (History)
6 users (show)

See Also:
Steps To Reproduce:
Generate with Tone, Chirp, Noise or DTMF, audio of length 123456 samples. The selection length after generating is 123456 samples long, but the final sample is missing. There are only 123455 samples plus 1 sample period of "white-space" selected at the end.
Release Note:
First Git SHA:
Group: ---
Workaround:
Closed: 2018-08-20 00:00:00
petersampsonaudacity: Test‑OK‑Win-
petersampsonaudacity: Test‑OK‑Mac-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Daulton 2017-01-03 09:15:08 UTC
This is repeatable on Debian stable with Tone, Chirp, Noise, and DTMF generators, but not Silence or Nyquist generators.
See Steps to reproduce.
Comment 1 Steve Daulton 2017-01-03 09:15:47 UTC
I've only tested on Linux.
Comment 2 Steve Daulton 2017-01-18 17:31:46 UTC
Assigned to myself.
Comment 3 Gale Andrews 2017-01-18 21:01:54 UTC
Is then what happens with generating 10 samples correct?  There are 10 sample dots on Linux. The selection generated extends a whole sample period beyond the end of the track, but that selection is also the same if you double-click in the track.

The selection only needs to extend half a sample period to include the last sample, AFAICT. Regardless is the issue that there are only 123455 samples of audio? What is a good way to measure the number of sample dots?
Comment 4 Steve Daulton 2017-01-19 04:20:44 UTC
(In reply to Gale Andrews from comment #3)
The Selection Toolbar shows the correct length of the selection.
Double click on a clip selects all samples in the clip.
Put the two together and you get the exact number of samples in the clip.

The bug is due to a rounding error when the Effect code converts from time in seconds to time in samples. Currently the number of samples is calculated as:
round-down(duration * sample-rate)
rather than
round-to-nearest(duration * sample-rate)
which, in the "steps to reproduce" case, gives "genLength" (the number of samples to generate) of 123455 samples.
Comment 5 Gale Andrews 2017-01-20 12:51:15 UTC
(In reply to Steve Daulton from comment #4)
> The Selection Toolbar shows the correct length of the selection.
> Double click on a clip selects all samples in the clip.
> Put the two together and you get the exact number of samples in the clip.
I see. In that case I can reproduce it on Ubuntu 14.04 but not Win 10 or Sierra.
Comment 7 Peter Sampson 2017-10-11 11:55:03 UTC
Testing on w10 Home audacity-win-4a0fbf8-2.2.0-beta-26Sep17
and on macOS 10.13 High Sierra with Paul's latest Mac build of 10Oct17

I still only get 123,455 samples rather than the requested 123,456 - but the end position of the tracks hows as 123,456 with some blank space between the 123,455th sample and the cursor when moved to track end.

Accordingly I shal mark this REOPENED
Comment 8 Steve Daulton 2017-10-13 10:16:24 UTC
(In reply to Peter Sampson from comment #7)
Testing on Sierra (and Linux) with a2a08e8 (10th Oct), I'm getting the correct 123456 samples.
Comment 9 Peter Sampson 2018-01-25 12:44:47 UTC
Testing on W10 with 2.2.2 JC008 25Jan18

I get the full set of samples  -  so on the additional basis of Steve's tests I shall mark this as resolved