It’s probably due to the audio being buffered (required to ensure smooth playback) and that Audacity starts and stops its audio stream on demand.
For a sound system such as ASIO or Jack in which the audio stream runs continuously, Audacity should play to the very last sample of the selection. For a sound system such as MME or DirectSound playback is likely to miss the very end of the selection because the connection is closed when Audacity reaches the end of the selection, but some of the audio data may still be in the buffers. I don’t know what the situation is with WASAPI (I don’t use Windows).
If it’s a problem, the workaround is to generate a bit of silence anywhere after the end of the track, then ensure that your selection goes a bit beyond the end of the audio that you want to play. That will ensure that all of the audio that you want to play has time to pass through the buffer before the connection to the sound system is closed.
In short, it’s not really a “bug” but a limitation of some computer sound systems. However, it could possibly be “fixed” if Audacity kept the connection open all the time (this has been suggested by one of the senior developers, but I don’t know if it will ever happen as there could be a down side to this mode of operation).
I’ve just checked with Audacity 2.1.2 in Windows XP and the behaviour there appears to be that the connection to MME or DirectSound remains open until the buffer has been emptied (at least that appears to be the case on my test machine).
I’ve not tested with the latest Audacity alpha version - the behaviour “could” be different as Audacity (2.1.3 alpha) now uses a later version of portaudio. Portaudio is the library that handles communications between Audacity and the sound system.
The audio buffer trick worked in 2.1.2, if I don’t err, i.e. prior to the portaudio upgrade.
Gale, were you able to determine how much isn’t played at a very low buffer setting?
I’m actually not willing to upgrade to Windows 10–never change a winning team
Today on Windows 7, on 2.1.2 or 2.1.3-alpha, I can hear at least some of the last 50 ms of a track with WASAPI and 20 ms or lower buffer. Yesterday I could not. I have not rebooted, only gone into computer sleep and out.
So at least on Windows 7, it seems the machine state is a variable.
It may be that Windows 10 would play to the end more relaibly under WASAPI. I can only try it over the next week or so and see.
Thanks for testing.
You know, there’s full moon today at noon…
You confirm my suspicion, I also had the feeling that it sometimes works and sometimes not.
I don’t know but it seems to me that it can’t be to hard to pad the selected audio with buffer-sized silence, before the stream is opened and sent to Portaudio/Wasapi.
Weird. I wonder what they mean by “exclusive”. Perhaps the behaviour is different on different versions of Windows?
I don’t know for Windows, I was hoping that you might . On Linux with Pulse or Jack there’s tools that show the ports opening and closing.
What about if you set the sound card to exclusive mode in the control panel? Does that work with WASAPI? Does that allow one and only one application to access the sound card at a time? Does Goldwave “hang onto” the sound card once it has accessed it, or does it release it for other applications when playback is stopped?
GoldWave takes exclusive control of the audio device unless you select Shared quality. If you select Shared quality, GoldWave shares the audio device with other programs, but has no control over the sampling rate, channels, or quality used. The system sets the attributes used by all programs.
It certainly means for Goldwave playback, Goldwave will request its specified bit depth and sample rate direct from the device.
In the reverse case, with sound card Exclusive Mode on but Audacity playing audio first, starting to play in Goldwave with one of its “exclusive” choices terminates Audacity playback. Audacity can’t grab the device from Goldwave though, even using WASAPI host.
I do now vaguely recall some tool I have that may do that, but it would probably be quicker to install Jack for Windows.
When I set the sound device to Exclusive Mode in Windows Sound, then when Goldwave is playing, Foobar 2000 and Audacity cannot access the device. As soon as I stop playing in Goldwave, I can play in Foobar2000 or Audacity.
So this “short playback” problem looks a bit more like an Audacity or PortAudio bug than it did.