ovenwerks / studio-controls

A helper for setting up a system for audio work
GNU General Public License v2.0
73 stars 10 forks source link

autojack using pyalsaaudio interface which is "broken by design" #86

Open oe1rsa opened 1 year ago

oe1rsa commented 1 year ago

setting rates of alsa devices not working

Ubuntu version I am using: 22-04 LTS

I am trying to use rate 48000 for a USB soundcard. However the rate stays at 44100, no matter what.

I have tried to find out why and can see, that in autojack a PCM device is opened and AFTER-wards the rate is set. The author of pyalsalsaaudio has discovered that this approach will not work and has moved the parameters to the constructor of the PCM class. See this issue.

Consequently, even if the pyalsaaudio would be updated to a newer version, autojack still would suffer from the problem because it needs to be rewritten to use the constuctor parameters.

Unfortunately I cannot see a work-around since it seems not to be possible to set a default rate for devices in say asoundrc.

oe1rsa commented 1 year ago

Ok, answering my opened issue, in case someone else stumbles over the same problem:

1) The main "problem" obviously has already been fixed in a later version, because pyalsaaudio is not used with PCM devices any more.

2) My root problem, which I have not reported in the first place because I was not aware of it was a different one: The libzita-alsa-pcmi has a bug in Ubuntu 22.04 LTS, causing bad float format handling. You can read about this here. The result was a completely over driven microphone despite its gain was set to minimum.

Now, if I set my USB card to 44100 the system is usable, although, of course, I would prefer to set the USB card to 48000. The "work around" is to compile a newer version of the libzita-alsa-pcmi and link it to the system lib as described in the above mentioned thread.