Replies: 37 comments 31 replies
-
Hello everyone, I have exactly the same problem (recording at one tenth of speed and replay at ten times the speed) here with audacity 2.4.2 on a Debian 11 machine ; I don't have arecord here but I could reproduce exactly the same behaviour with gnome-sound-record : The help that I got directed me towards settings in pulseaudio: those demanded by audacity were said to be incompatible with those demanded by other programmes like gnome-sound-record. I'm still loking where I should start changing settings. I'm ready to give any help in testing as required. Cheers. Ludo |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Hi everyone, Final word? I found something unexpectedly ... weird? in the applications menu, sub-section "Sound and Video" where audacity's shortcut is placed, when I right-clicked on the audacity shortcut, and selected "Properties" and in the properties window, then "desktop entry": there stood a very surprising entry line: env UBUNTU_MENUPROXY=0 GDK_BACKEND=x11 audacity %F I hope this could help... Cheers. Ludo |
Beta Was this translation helpful? Give feedback.
-
(that said, I have no idea what's causing this bug or how to fix it) |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, After testing for a few days, I can confirm what I suspected and wrote in my previous message: a plain "audacity" command in the --> applications menu --> sub-section "Sound and Video" --> audacity shortcut (--> right click) --> "Properties" --> "desktop entry" instead of the "original" entry (see above) definitely does the job. Best regards to all of you. Ludo |
Beta Was this translation helpful? Give feedback.
-
Hi Ludo, I'm happy you found a workaround ( I haven't had time to try yet), but I disagree that this is "solved" . The fact that Audacity, with default settings, can put our audio devices in a broken (unrecoverable) state, should be investigated... |
Beta Was this translation helpful? Give feedback.
-
Hi fenugrec, As far as I'm concerned: But I trust developers will know what to do there. I hope you get the same satisfaction as I did by using this knowledge. Cheers Ludo |
Beta Was this translation helpful? Give feedback.
-
Hi there, So I have the same hardware, a Realtek ALC1220, and also observe that the volume indicator of the microphone in both And yes, even something as Interestingly, Firefox is unaffected even while the audio appears broken through ALSA. Not sure why, maybe because of JACK?. On the other hand, if Next time I'm trying pipewire, I'll have a look at this again. |
Beta Was this translation helpful? Give feedback.
-
PS this is probably related to #659 which I hadn't noticied initially. There's something about how Audacity opens / configures its sound layer that puts the device into an unrecoverable state, and this should really be investigated. It's been going on for years and isn't disappearing on its own. So I would ask again - is there a way to log/record/trace whatever API calls audacity makes on startup ? Between #2724, #659 and the comments here, I think we have enough independent reports to rule out user error, bad builds, and the usual low-hanging fruit. |
Beta Was this translation helpful? Give feedback.
-
Relieved I found this report! I'm seeing the exact same issue as @LudoOSGS reports with almost the exact same hardware (Asus PRIME X370/PRO) and OS release (Debian 11 Bullseye). And as various reports have mentioned, it also seems to affect I find interesting the suggestion that some configuration gets set incorrectly - that makes sense. With these pointers I'll dig in to the code and see what I can discover. Seems like the first thing to try is a fresh start from power-off, no GUI, and just using |
Beta Was this translation helpful? Give feedback.
-
Cold power-off reboot with
Start the display-manager and open the terminal emulator,
Audacity plays the file correctly. Close. Re-open. Play. All good.
And instead of stopping after 5 seconds it takes approximately 50 seconds. The resulting recording plays for approximately 5 seconds but sounds to be speeded up massively. Load it into audacity and it needs playing at 0.08x speed to get anything like the original - albeit sounds like its gone through a low-pass filter (muffled and head-in-bucket effect). I tested logging out from GUI and using
So, this seems to happen just due to playing the file, not even accessing the input source, from audacity. The next test is to see if it happens without even loading a file or using sources or sinks. Yes, it does. Simply starting and then exiting audacity is enough to cause the next After that I can instrument audacity to determine what is going on. |
Beta Was this translation helpful? Give feedback.
-
Working on the source-code now. First step is to examine any effect the Debian specific patches might have:
Of those
So my next step is to try to build without this and the other PortAudio patch on Debian! |
Beta Was this translation helpful? Give feedback.
-
PortAudio project has a recent discussion around using |
Beta Was this translation helpful? Give feedback.
-
In trying to rule in or out PortAudio I looked for other applications that use it. In Debian I found |
Beta Was this translation helpful? Give feedback.
-
Separate note on how to edit and rebuild conan package source-code. For this example I'm adding a debug line to PortAudio's
With that in place conan can do a rebuild. It has to be given both the source and build directories:
TO BE CONTINUED (once I've solve it not rebuilding the shared library!) |
Beta Was this translation helpful? Give feedback.
-
And here is the smoking gun! Using the pulse device
|
Beta Was this translation helpful? Give feedback.
-
After a day of diversions trying to master
So that confirms my hypothesis that when using PulseAudio backend PortAudio gets synthesised sample rates, not device specific. What I do not understand is how this appeared to work correctly when run under I'm not really sure how you'd cope with this when 'pulse' is the default. Maybe PortAudio has a way to coerce digging for the underlying hardware rates, but that doesn't help in preventing PortAudio seemingly affecting the hardware device sample rate. I'm wondering if this a subtle bug in PortAudio whereby when the client (in this case Audacity) requests a specific sample rate (in this case 384000) PortAudio probes all devices, not just the default ("pulse") and uses the requested sample rate (384000) in the probe of the hardware regardless of what the hardware's maximum supported rate might be. |
Beta Was this translation helpful? Give feedback.
-
I thought to try and reproduce the bug manually using
HOWEVER, notice how long the last recording took - twice as long as requested (4 seconds instead of 2) presumably because the sample rate actually used was half of what was requested. Indirectly that tells us there's a subtle bug in |
Beta Was this translation helpful? Give feedback.
-
I've confirmed that when stepping into the process with |
Beta Was this translation helpful? Give feedback.
-
@iam-TJ , I've been reading your progress with much interest. Great work and thanks for the updates !
Have you looked at |
Beta Was this translation helpful? Give feedback.
-
Suddenly recalled that |
Beta Was this translation helpful? Give feedback.
-
The Helgrind logs seem to indicate that all the early rush of ~ 70 threads is triggered by PortAudio or ALSA when probing devices. PortAudio probes for Jack and ALSA, and we know that PortAudio's In that case when running at full speed I wonder if both ALSA and Pulseaudio are both using the same ALSA functions at the same time to access the same hardware device - neither would be aware of the other and those functions may not be thread-safe. If they try to determine supported sample rates by actually setting it and trying to open the stream then overlap between them might explain the symptoms we see. After all, we have shown that if Pulseaudio is disabled the issue doesn't happen. In my next session I'm going to look at PortAudio to see if it is responsible for creation of those ~ 70 threads during initialisation. If it is, then an obvious fix would be to serialise the ALSA and And PortAudio seems to confirm this could be it: |
Beta Was this translation helpful? Give feedback.
-
Enabling verbose debugging for Pulseaudio's user service:
Now add the following overrides. When saved it will be written as a "drop-in" (fragment) to the path shown:
Then to restart and monitor the logging:
|
Beta Was this translation helpful? Give feedback.
-
I tried for myself here with rr-5.6 , also did a few runs with "chaos mode" enabled (randomizes some scheduling), with the same results as you : can't reproduce when running under rr. Thanks for your earlier explanation of how to remove + rescan the device , I'm never sure how to do that. It succesfully restores function without a reboot. Good to know ! |
Beta Was this translation helpful? Give feedback.
-
For some reason after so much messing about, including playing with ALSA and PulseAudio configuration, I could no longer reproduce the issue last time I tried, even after reverting the configuration changes. I've put my investigation on suspend for now - it ate up far too much time and needs someone much more familiar with the inner workings and interactions. The one thing that does seem to be clear is that Audacity is doing something weird (or its use of PortAudio is) but without other similar applications that also use Portaudio it is difficult to compare 'good' from 'bad'. I suspect the debuggers affect the parallelisation of threads to the extent they become serialised and therefore avoid the race. As to what is able to lock the hardware device itself into a sample rate (as seems to be the effect of this issue) - I struggle to imagine how the userspace libraries above |
Beta Was this translation helpful? Give feedback.
-
Agreed. |
Beta Was this translation helpful? Give feedback.
-
I've just revisited this after reading latest kernel ALSA commits, and that made me look at latest Note: this does require patching the
And in another shell:
|
Beta Was this translation helpful? Give feedback.
-
Hello eveyone, A problem without an end? But with evolution... as time and OSes go by... Still sporting the same hardware as almost two years ago (#3269 (comment)) : Asus Prime X570 Pro with an AMD Ryzen 3900X CPU . ~$ pacmd list cards | nc termbin.com 9999 https://termbin.com/5zo3 This time round with GNU-Linux Debian 12 Bookworm and Linux kernel 6.1.0-18-amd64, PulseAudio 16.1+dfsg1-2+b1, PortAudio 19.6.0-1.2, (only alsa-utils 1.2.8-1) and Audacity 3.2.4+dfsg-1. The evolution is that, to avoid running one more time against the wall, and in order to try and get Audacity to record anything at all from the microphone (and not just donaldducks), I decided to follow the same procedure as at that time (#3269 (comment)) , but apparently the procedure had to be overhauled:
I still haven't checked what happens when pavucontrol is launched... Cheers and thanks for the support... hoping that, one day, this problem will be taken care of... Best regards. ludo |
Beta Was this translation helpful? Give feedback.
-
Hello everyone, Well, this is the second part of the test: checking the role of pavucontrol in this precarious environment. As it was to be expected, having pavucontrol launched and running, when you launch Audacity, you literally see the collision happen: immediately pavucontrol reacts to the start of Audacity as if it were recording an explosion - a burst in tone is displayed, and then the level of recording is always very high: middle to two thirds, even at "base" level (10%, -60 dB) athough nothing is recorded, reactions to sounds and silence is displayed to be very sluggish. The only way I can get things back to fully functional (see the comment just above) is with a reboot. Hope this can help. Cheers and keep it up! ludo |
Beta Was this translation helpful? Give feedback.
-
Hi,
Describe the bug
Starting audacity puts my builtin audio card into a (so far unrecoverable) state where it records at roughly 1/10 normal speed, i.e. playing back the audio sounds 10x too fast. This happens regardless of sample rate & format I select.
I currently believe this is an alsa-lib bug , but I'm looking for ideas here to isolate the problem since I haven't found a way to reproduce the problem outside audacity, and unsure what it does differently than, say,
arecord
.To Reproduce
arecord
,parecord
, orobs-studio
works fineAdditional information (please complete the following information):
card 1: Generic [HD-Audio Generic], device 0: ALC1220 Analog [ALC1220 Analog]
So, specifically, I'm looking for some or all of this info :
arecord
or some other simple method ?strace
is not very helpful because of the tons of data it produces, since I don't know what to look for.Beta Was this translation helpful? Give feedback.
All reactions