Normally when I record something with the microphone, it's fine. But when I start audacity (version 2.1.2), the recording sounds like it's been sped up and the pitch has been increased, and both a lot. And it's not only while recording with audacity, but it also affects recording with other software like the command line utility arecord
. And this effect lasts even after audacity is closed. It gets fixed after restarting the PC.
Any idea why this happens and how to fix it?
This happens when the record speed (say, 11,025 Hz) is different from the default playback speed (say, 22,050 Hz). When the same data is played back at double speed, the sound plays twice as fast and sounds twice as high, leading to the standard "chipmunk" effect. If you go to 44,100 you'll get four times as high/fast.
A common cause for this is the Audacity project Hz setting is different from the setting that you are recording at. .Wav files get stamped with a particular frequency when they are saved, and so always play back at that frequency with all standard players. The Audacity project frequency is found in a small white window in the lower-left-hand corner of Audacity's window. Check that this is appropriate for what you think you're doing.
You can save existing files at a different frequency to save them.
Resampling turns a file from one frequency/speed into a different frequency/speed without changing its apparent sound. In this case, you don't want to resample, as the data is correct but the sound (speed) is wrong, not vice versa.
If this happens in recording and not simply playing back outside of Audacity, then you've got a problem with the default recording speed of your PC somehow not writing into .wav files.
Try if this command fixes your issues (you may need to vary
hw:1,2
according to your setup):pacmd unload-module module-alsa-source; pacmd load-module module-alsa-source device=hw:1,2
If this fixes the issue temporarily you can try to add the following to your /etc/pulse/default.pa or ~/.config/pulse/default.pa:
Unfortunately this fix didn't work for me (in all cases). From time to time when I start Audacity it breaks again. Running above command always fixes the issue, so my fix was to setup a key combination that executes above command. Whenever I see that my mic is broken I simply press that combination and it works again.
Since this is no real fix I would be very happy if someone would find a proper one. If you are affected by this please upvote the issue on launchpad.
Credits for the pulse config fix go to José Miguel Sarasola (alosarjos) here.
Related issue with nearly same solution:
Microphone recording approximately 12x slower than normal in certain applications (new install Ubuntu 16.04.3)