Skip to content

Using PortAudio gives errors in precompilation while works in REPL #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
omlins opened this issue Feb 1, 2022 · 3 comments
Open

Using PortAudio gives errors in precompilation while works in REPL #103

omlins opened this issue Feb 1, 2022 · 3 comments

Comments

@omlins
Copy link

omlins commented Feb 1, 2022

In the REPL, using PortAudio and creating a stream work just fine and also the available devices seem to have been recognized without problems:

julia> using PortAudio

julia> PortAudioStream(1, 0; eltype=Int16, samplerate=44100.0, latency=0.001)
PortAudioStream{Int16}
  Samplerate: 44100.0Hz
  1 channel source: "default"

julia> PortAudio.devices()
22-element Vector{PortAudio.PortAudioDevice}:
 "C-Media USB Audio Device: - (hw:0,0)" 10
 "HDA Intel PCH: ALC285 Analog (hw:2,0)" 22
 "HDA Intel PCH: HDMI 0 (hw:2,3)" 08
 "HDA Intel PCH: HDMI 1 (hw:2,7)" 08
 "HDA Intel PCH: HDMI 2 (hw:2,8)" 08
 "HDA Intel PCH: HDMI 3 (hw:2,9)" 08
 "HDA Intel PCH: HDMI 4 (hw:2,10)" 08
 "HDA NVidia: HDMI 0 (hw:3,3)" 02
 "HDA NVidia: HDMI 1 (hw:3,7)" 08
 "HDA NVidia: HDMI 2 (hw:3,8)" 08
 
 "HDA NVidia: HDMI 6 (hw:3,12)" 08
 "sysdefault" 1280
 "spdif" 10
 "samplerate" 1280
 "speexrate" 1280
 "pulse" 3232
 "upmix" 80
 "vdownmix" 60
 "default" 3232

However, when I add using PortAudio (and nothing else!) to a package, then it this package gives many errors in precompilation:

julia> using JustSayIt
[ Info: Precompiling JustSayIt [dc137d0a-f97d-424e-bedb-455a3ba6ee67]
ALSA lib pcm_dmix.c:1035:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.USB-Audio.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5599:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.USB-Audio.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5599:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.USB-Audio.pcm.modem.0:CARD=0'
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5599:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline:CARD=0,DEV=0
ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.USB-Audio.pcm.modem.0:CARD=0'
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5599:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline:CARD=0,DEV=0
ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.USB-Audio.pcm.modem.0:CARD=0'
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5599:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM phoneline
ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.USB-Audio.pcm.modem.0:CARD=0'
ALSA lib conf.c:5111:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5599:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM phoneline
ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_jack.so (/home/omlins/.julia/artifacts/d587f48a6815c72dec4b083bf297caec7a8e3f4b/lib/alsa-lib/libasound_module_pcm_jack.so: cannot open shared object file: No such file or directory)
ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_jack.so (/home/omlins/.julia/artifacts/d587f48a6815c72dec4b083bf297caec7a8e3f4b/lib/alsa-lib/libasound_module_pcm_jack.so: cannot open shared object file: No such file or directory)
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1035:(snd_pcm_dmix_open) unable to open slave

Thus, I wonder: should PortAudio.jl move some of these initializations from precompilation time to module load time (__init__())?

NOTE: OS info:

omlins@Omlin-Lenovo:~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
@omlins omlins changed the title Using PyAudio fails in precompilation while works in REPL Using PyAudio gives errors in precompilation while works in REPL Feb 1, 2022
@omlins omlins changed the title Using PyAudio gives errors in precompilation while works in REPL Using PortAudio gives errors in precompilation while works in REPL Feb 1, 2022
@bramtayl
Copy link
Member

bramtayl commented Feb 1, 2022

Hi, thanks for the report. Those aren't errors per say, just ALSA messages about alsa trying to figure out your sound setup. We redirect them to the debug log during __init__. Ref

log = @capture_err handle_status(Pa_Initialize())
. It seems that's not working in some circumstances, but I'm not sure why.

@omlins
Copy link
Author

omlins commented Feb 2, 2022

@bramtayl, thanks a lot for your reply. I see - I also found the related issues on PortAudio... Might it be that

using libportaudio_jll: libportaudio

does already initialize some ALSA stuff and cause these error messages?

@bramtayl
Copy link
Member

bramtayl commented Feb 2, 2022

Hmm, no I don't think so. I'm guessing the issue is Pkg and error capturing don't work well together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants