Running Audacity switch PulseAudio to 44100 until PC restart

Hi. I have Audigy 2 ZS sound card, which poorly played 44100 Hz because of bad quality hardware resampling. Only 48000 Hz plays normally. Therefore I set up /etc/pulse/daemon.conf

default-sample-format = s16le
default-sample-rate = 48000
alternate-sample-rate = 48000
default-sample-channels = 2
default-channel-map = front-left,front-right

And now PulseAudio does resampling. I attached a test file to check resampling. No distortion. However, when I run Audacity looks like PulseAudio force switching to 44100 Hz because then I hear distortion in all applications on 44100 and 48000 files. Looks like Audacity test and break sound system when loading. Closing Audacity does not help. Only restart computer.
I use Xubuntu 16.04 LTS 32 bit. Audacity 2.1.2-1 from repo. On Windows XP there is no problem, only on Linux.
How can prevent samplerate switch?

You can set the default sample rate in “Edit menu > Preferences > Quality”.

Note that importing a file into a new, empty project may override the default sample rate. You can see when this occurs because the project sample rate (the “Project Rate”) is displayed in the lower left corner of the main Audacity window.

Note also that the sample rate of exported files is taken from the “Project Rate”. If you want to export with a different sample rate (for example, if you want to export as 44100 Hz for making an audio CD), then you will need to temporarily change the “Project Rate” setting before exporting.

I set 48000 in project, it does not matter, unfortunately.

default sample rate in “Edit menu > Preferences > Quality”

Does not affect either. Distortions remain.

I set up Pulse resampler. But, if you output directly to alsa (bypassing Pulse), you need to configure resampler in alsa too. I believe in alsa default 44100. Therefore input 44100 and 48000 will be resampled to 44100, and afterwards hardware resampled to 48000 again = distortion every time.
Maybe Audacity at boot disables Pulse or change it into a strange mode and only work alsa before rebooting?

Audacity changes the sound settings at startup, it’s not normal. If your sound card has a high quality resampler - you will not notice a problem. But Audigy 2 ZS is a litmus test. You can configure alsa to 48 kHz I suppose. But this does not change the strange behavior of Audacity.

I suggest test: Set up Pulse resampler to 48 kHz. Run Audacity and close. Open audio file RMAA tones 48 kHz in audio player like Audacious. Connect the line output - to the line input of another sound card of another computer, record and check the spectrum. 22 kHz (44.1 kHz) or 24 kHz (48 kHz) actually plays the computer with Audacity.

Yes, there are well known problems with several of the Audigy cards on Linux. Unfortunately, if the manufacturer don’t supply drivers or enough technical information for the Linux community to develop good drivers, then we’re stuck with (sometimes buggy) reverse engineered drivers.

What exactly are those files?

I don’t understand your logic.
If you set preferences in Audacity to 48000Hz sample rate, then Audacity will send audio data to the selected audio device at 48000Hz, provided that the device reports that it supports that rate.

Let’s have a look at what your sound system looks like to Audacity:

There are well known problems with several of the Audigy cards on Linux

I have no problems with Audigy 2 ZS in other applications, except Audacity. Therefore I had to go in Ocenaudio and Ardour for synchronize tracks in films and audio processing.

What exactly are those files?

Shows quality of resampling (if used) 44.1>48 and 48>44.1. If resampling is high-quality or not used, you will hear only pure tones. If resampling is bad-quality, you will hear tones and distortions (jingle or screech).

Attach the txt file to your reply

Attached, but there is nothing interesting. Sound card reports that it supports 44100, but in very bad quality actually.

If you set preferences in Audacity to 48000Hz sample rate, then Audacity will send audio data to the selected audio device at 48000Hz, provided that the device reports that it supports that rate.

It is not true. 44100 is always used. That’s the point. Let me tell you in bug report style:

Description:

  • Audacity 2 ZS sound card support 44100 in very bad quality.
  • Therefore I set up /etc/pulse/daemon.conf sample-rate=48000
  • I’m using Audacious (not to be confused with Audacity) audio player with PulseAudio output plugin for music listening. Most of MP3 and FLAC 44.1, a little bit Opus 48.
  • Everything is great until…
  • Audacity (not to be confused with Audacious) set up at 48000, of course.

Steps to reproduce:

  1. Turn on the computer.
  2. Run Audacious (not to be confused with Audacity further) and play 44.1 and 48 audio files (for example test audio files) > no distortions, everything is great.
  3. Close Audacious (not necessary).
  4. Run Audacity.
  5. Open in Audacity 44.1 and 48 test files > distortions is always (it means sound card operating at 44100 now). I will remind you Audacity set up at 48000. In fact, it’s enough just run Audacity.
  6. Close Audacity.
  7. Run Audacious and play 44.1 and 48 audio files (for example test audio files) > distortions is always (it means sound card still operating at 44100).
  8. Audacious (and ALL other applications I suppose) operating at 44100 UNTIL PC restart.
  9. PC restart
  10. Run Audacious and play 44.1 and 48 audio files (for example test audio files) > no distortions, everything is great.
    audacity_terminal.log (3.69 KB)
    audacity.log (9.61 KB)

What’s the story with the high frequency noise in the range 19 to 20 kHz?

Unfortunately the interesting part of the log only appears with debug builds. With a debug build, Audacity prints a debug message that says exactly what sample rate is used on playback. Any chance you could try running a debug build of Audacity? (you would need to build it from the source code).

Test drive (complex material) for resampler. Noise will not be heard. I found this file a long time ago to check SB cards.

I can try if you give instructions. I was build source codes before, but the process is not pleasant.

You can get the 2.1.3 source code via this page: Audacity download latest version (ensure that you get the “Audacity 2.1.3 release” code, because the instructions are different for the beta version).

The build instructions are then basically the same as on this page: Building Audacity 2.1.2 on Ubuntu 15.10
but with the following differences:

  1. Configure Audacity:
../configure --disable-dynamic-loading --enable-debug
  1. Install
    Don’t do this step. You can run the debug version from the command line without installing it.

  2. Additional step for testing purposes.
    Create a new folder inside the “build” folder and name it “Portable Settings”.
    Your debug build will now use this folder to save its settings rather than interfering with your regular installed version.

Don’t build the “Optional Nyquist Workbench Module”. That is not required.

To launch the new debug build, open a terminal window and navigate to the “build” folder, then enter:

./audacity

Build Audacity. Attached log. Report 48000, but I still hear distortions. So someone after convert frequency to 44100 (and then Audigy 2 ZS bad-quality resampled 44.1>48 again). And initiator of this is Audacity. When Audacity run, it tests something and changes the system. Even volume notification appears in tray.
I recorded to dictophone how Audacious plays WAV 48 kHz before (first) and after (next) Audacity run.

audacity.log (3.88 KB)

Could you post the actual test file that you are using, I’d like to try it on my machine to see what happens.

It’s in first post SB test 48.wav
But you probably will not hear any distortion, even if there is resampling(s) because of high quality of resampling in modern sound cards.
I suggested in this post test with RMAA to find out actually playing sample rate and level of distortion. To do this, you need 2 PC, one of them with Windows.

When you import it into Audacity, does it look like this:


and the track spectrogram view like this:

The point is to play in 48 kHz sample rate a tone of 23-24 kHz (>44.1/2…<48/2) and record. If there is 48>44.1 resampling, there will be no frequencies in the recorded signal above 22 kHz (44.1/2). You can run RMAA in Wine and record a digital loopback. It’s not very reliable though. You can play and record digital loopback directly in Audacity I suppose. RMAA can generate a test WAV file. Tomorrow, I delete Linux and return to Windows. If you still have tests, hurry up.

If your sound card works well at 48000 Hz, you could always set up Jack Audio System and configure it to 48000 Hz. That would guarantee that everything is running at 48000 Hz (Jack does not do resampling).

What about browsers, for example? They do not have sound settings. Maybe I’ll install ArchLinux without PulseAudio and check Audacity on motherboard sound card.

What is your sound card? I’m just curious.

“pulseaudio-module-jack” can look after applications that don’t support Jack.

Since Ubuntu 16.04, running Jack has got a whole lot easier:
Install qjackctl and pulseaudio-module-jack
and add the following command to run after startup:

pacmd set-default-sink jack_out

Start Jack with QjackCtl, then use the normal “Sound Settings” (pavucontrol) to direct sound from web browsers and other non-Jack applications to play through “PulseAudio Jack Sink”


On this laptop, there is on-board sound from HDA Intel PCH (ALC269VC Analog), HDA Intel PCH HDMI (not used), and a Behringer UCA 202 USB (external).

Audacity 2.2.1 can be installed in CrossOver 16.2.5 (Wine). There is no bug.
And also there is no bug in Flatpak version, but it takes 1 Gb and a lot of files.