Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 592214 - >=media-sound/audacity-2.4.2-r1: Recording device list duplicates items from card 0
Summary: >=media-sound/audacity-2.4.2-r1: Recording device list duplicates items from ...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Professional Audio Applications Maintainers
Depends on:
Reported: 2016-08-27 00:01 UTC by Sophie Hamilton
Modified: 2021-04-14 01:30 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---

Output of /usr/sbin/ (as root) (alsa-info.txt,70.89 KB, text/plain)
2016-08-27 00:01 UTC, Sophie Hamilton
Screenshot of Audacity's recording devices list with PCH as card 0 (audacity-record-devices.png,235.31 KB, image/png)
2016-08-27 00:03 UTC, Sophie Hamilton
Screenshot of Audacity's recording devices list with Loopback as card 0 (audacity-record-devices-2.png,120.37 KB, image/png)
2016-08-27 00:04 UTC, Sophie Hamilton

Note You need to log in before you can comment on or make changes to this bug.
Description Sophie Hamilton 2016-08-27 00:01:43 UTC
Created attachment 444212 [details]
Output of /usr/sbin/ (as root)

This *might* be a PortAudio bug, but I'm not entirely certain as I don't know of any simple way to list devices with PortAudio. (Relevant versions of software are listed at the bottom of this bug description.)

In Audacity, when I open up the recording devices list, I would normally expect to see a fairly short list. However, what I actually see is that each of the choices I would normally have on the list is duplicated six times, with the following after each:

> Front Mic:0
> Rear Mic:0
> Line:0
> Front Mic:1
> Rear Mic:1
> Line:1

I've uploaded a screenshot showing this at . In this screenshot I've opened up the recording devices list as if I was going to select one. Notice that it extends to *everything*, including the loopback devices offered by the snd-aloop kernel module, which should not have these inputs.

In this configuration, my regular card (an onboard Realtek ALC1150) is ALSA card 0, as seen in my /proc/asound/cards:

>  0 [PCH            ]: HDA-Intel - HDA Intel PCH
>                       HDA Intel PCH at 0xfa230000 irq 43
>  1 [NVidia         ]: HDA-Intel - HDA NVidia
>                       HDA NVidia at 0xfa080000 irq 42
>  2 [UX16           ]: USB-Audio - UX16
>                       Yamaha UX16 at usb-0000:00:14.0-13, full speed
>  3 [Loopback       ]: Loopback - Loopback
>                       Loopback 1

I've been trying to track down this bug and I think I finally worked out what's happening - for whatever reason, Audacity (or PortAudio, or *something*) is duplicating the inputs found on card 0 to every other card. (Card 0 does indeed have Front Mic, Rear Mic and Line inputs.) If I rejig the module loading so that my Loopback 'card' appears in slot, so that my /proc/asound/cards looks like this:

>  0 [Loopback       ]: Loopback - Loopback
>                       Loopback 1
>  1 [PCH            ]: HDA-Intel - HDA Intel PCH
>                       HDA Intel PCH at 0xfa230000 irq 42
>  2 [NVidia         ]: HDA-Intel - HDA NVidia
>                       HDA NVidia at 0xfa080000 irq 43
>  3 [UX16           ]: USB-Audio - UX16
>                       Yamaha UX16 at usb-0000:00:14.0-13, full speed

then the problem no longer appears, as can be seen in this screenshot with a much smaller list: . (I'm not entirely sure why 'surround21' suddenly appears in this screenshot when it wasn't in the first; that might be another bug, perhaps related to this one somehow.)

In both of these configurations, I have no ~/.asoundrc file. (I normally do, but I renamed it away for this bug so that it couldn't affect the results.) Creating a new ~/.asoundrc file to define a new default PCM using 'pcm.!default' does not change anything, so it definitely appears to be related to the inputs on card 0.

I've uploaded as an attachment the alsa-info.txt file generated by running /usr/sbin/ (from media-sound/alsa-utils) when the ALC1150 is in card 0's position (at which point the bug is observable in Audacity).

If I can help at all in any other way, please let me know!

Relevant software versions installed:

* media-libs/alsa-lib-1.0.29
    (no extra USE flags)

* media-libs/portaudio-19_pre20140130
    (USE flags: alsa cxx)

* media-plugins/alsa-plugins-1.0.29
    (no extra USE flags)

* media-sound/alsa-tools-1.0.29 -
    (USE flags: gtk alsa_cards_emu10k1x)
    (I'm not entirely sure why alsa_cards_emu10k1x is enabled; I didn't add it)

* media-sound/alsa-utils-1.0.29
    (USE flags: doc libsamplerate ncurses nls)

* media-sound/audacity-2.0.5
    (USE flags: alsa flac id3tag ladspa libsamplerate libsoxr mp3 sbsms twolame vamp vorbis)

emerge --info:

Portage 2.2.28 (python 2.7.10-final-0, default/linux/amd64/13.0, gcc-4.9.3, glibc-2.22-r4, 4.7.0-gentoo x86_64)
System uname: Linux-4.7.0-gentoo-x86_64-Intel-R-_Core-TM-_i7-5820K_CPU_@_3.30GHz-with-gentoo-2.2
KiB Mem:    32859668 total,  25904120 free
KiB Swap:    8191996 total,   8191996 free
Timestamp of repository gentoo: Wed, 24 Aug 2016 17:30:01 +0000
sh bash 4.3_p42-r1
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p42-r1::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.10-r1::gentoo, 3.4.3-r1::gentoo
dev-util/cmake:           3.3.1-r1::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.21.3::gentoo
sys-apps/sandbox:         2.10-r1::gentoo
sys-devel/autoconf:       2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.9.3::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.3::gentoo (virtual/os-headers)
sys-libs/glibc:           2.22-r4::gentoo

    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://
    priority: -1000

    location: /var/lib/layman/x11
    masters: gentoo
    priority: 0

    location: /opt/portage-overlay
    masters: gentoo
    priority: 1

CFLAGS="-march=native -O2 -pipe"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
USE="X a52 aac aacplus acl alsa amd64 amr berkdb bluray bzip2 cdda cddb cdio cdparanoia cli cracklib crypt cxx dbus dri dts dvd flac fontconfig fortran gdbm gpm gtk iconv ipv6 jpeg libnotify mmx mmxext modplug modules mp3 mtp ncurses nls nptl ogg opencl opengl openmp pam pcre png qt5 readline seccomp session sound sse sse2 ssl tcpd truetype unicode v4l vdpau vim-syntax vorbis xattr xv xvmc zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" L10N="en en_GB" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_GB" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="nouveau fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Comment 1 Sophie Hamilton 2016-08-27 00:03:41 UTC
Created attachment 444214 [details]
Screenshot of Audacity's recording devices list with PCH as card 0
Comment 2 Sophie Hamilton 2016-08-27 00:04:13 UTC
Created attachment 444216 [details]
Screenshot of Audacity's recording devices list with Loopback as card 0
Comment 3 Sophie Hamilton 2016-08-27 00:13:59 UTC
Oh, I forgot to mention - note too that in the 'fixed' screenshot with Loopback as card 0, the "Front Mic", "Rear Mic" and "Line" inputs don't show up even when they should on the ALC1150 devices, so it's easy to see that card 0's inputs are just being copied.
Comment 4 Sophie Hamilton 2016-09-30 03:57:35 UTC
I've been attempting to debug this and find out exactly where things are going wrong. Unfortunately, I've hit the limit of my knowledge.

I've managed to find out that when Audacity initialises its Device Manager (DeviceManager.cpp), it uses an interesting method of finding the sources for input devices - it temporarily opens a stream to each device, and then queries PortMixer (part of PortAudio AFAIK, though for some reason it uses included source code from Audacity's tarball) by calling Px_OpenMixer on the stream and using the resulting Px object.

It seems that this is where the problem is occurring. On ALSA (OpenMixer_Linux_ALSA(), lib-src/portmixer/src/px_linux_alsa.c), the Px object is initialised and PaAlsa_GetStreamInputCard is called in order to get the card number from the previously-opened stream. However, this appears to always be returning 0 (at least, it is on my system), which of course means that the sources Audacity eventually gets are from the mixers on card 0.

I believe that the streams themselves are constructed properly - they certainly seem to have the right parameters in the source code, but I've not yet broken out the debugger so I can break and check the various /proc files to make sure that the right devices are being opened. That's something I'll try next time I get some time to work on this, though for now I'm shattered.

I hope this helps a bit in trying to find the issue. Unfortunately I don't know PortAudio's internals well enough to really go deeper then PaAlsa_GetStreamInputCard, but if anybody needs me to give any more data or to patch some code, please let me know.
Comment 5 Sophie Hamilton 2016-09-30 04:00:12 UTC
(To be clear, when I say that PaAlsa_GetStreamInputCard is always "returning 0", I mean that it's always setting the 'card' variable to 0.)
Comment 6 Sophie Hamilton 2017-06-14 18:14:47 UTC
I just tested media-sound/audacity-2.1.3 (marked unstable at the moment), and this bug appears to still be present.

I haven't been able to look into this bug any further since the last time I updated; I apologise!
Comment 7 Pacho Ramos gentoo-dev 2017-07-15 09:40:21 UTC
(In reply to Sophie Hamilton from comment #6)
> I just tested media-sound/audacity-2.1.3 (marked unstable at the moment),
> and this bug appears to still be present.
> I haven't been able to look into this bug any further since the last time I
> updated; I apologise!

Can you please report it to upstream then?

Comment 8 Miroslav Šulc gentoo-dev 2020-09-19 11:51:33 UTC
please test it with 2.4.2-r1 and report back
Comment 9 Miroslav Šulc gentoo-dev 2020-09-26 12:32:46 UTC
no reports, so closing.
Comment 10 Sophie Hamilton 2020-09-26 13:22:42 UTC
Sorry, I intended to reply when I had installed it but I haven't had the time to update yet.

I'll update when I can and get back to you.
Comment 11 Sophie Hamilton 2020-10-22 18:14:19 UTC
Sorry for the delay. I've finally been able to test this.

Unfortunately, =media-sound/audacity-2.4.2-r1 still exhibits the issue as documented. (I'm also experiencing a weird bug where the X mouse cursor and the where Audacity thinks the mouse cursor is do not agree and are offset from each other, which is partly why this bug took so long to reopen, but that's a story for another bug - possibly #736192, but I don't know.)

I'm sorry to have to reopen this, especially after such a long time, and I'm especially sorry because I never reported this upstream as suggested; IIRC I was having trouble finding where I needed to do so, and I'm sorry I never said this.

I can see now from that the forum is the place to report bugs so I'll try giving that a go if it's still desired.

Once again, I'm so sorry.
Comment 12 Miroslav Šulc gentoo-dev 2020-10-23 07:15:58 UTC
Sophie, thank you for the update :-)
Comment 13 Jonas Stein gentoo-dev 2021-04-14 01:30:11 UTC
please paste the link to your upstream ticket here.