Csound Csound-dev Csound-tekno Search About

[Csnd] Csound on newest WSL2 (Win11, with WSLg)?

Date2022-03-07 22:52
FromThorsten Jolitz
Subject[Csnd] Csound on newest WSL2 (Win11, with WSLg)?
Hallo List,
not really a Csound question, just trying my luck, maybe somebody did manage to run Csound on WSL2 (Windows Subsystem for Linux with Debian Unstable, Windows11)?

I can  play mp3 files with MPV from the linux command line, so in general linux audio works from WSL2. 

But ALSA does not find a soundcard, and Csound uses ALSA (see PS 2): 
$ aplay -l
aplay: device_list:274: no soundcards found...

As described in PS 1, the newest version of WSL2 on WIN11 now has a 
- minimal system distribution (wslg, g for gui), with running pulseaudio server
- user distribution (wsl2 e.g. debian), with env var PULSE_SERVER= /mnt/wslg/PulseServer

Somehow MPV worked out-of-the-box without any configurations from me. I wonder if there is a trick to make Csound work too?

Cheers
Thorsten


PS 1

PS 2
$ csound instr.csd
[...]
orch now loaded
audio buffered in 256 sample-frame blocks
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default
 *** Cannot open device 'default' for audio input: No such file or directoryFailed to initialise real time audio input

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2022-03-08 19:09
FromThorsten Jolitz
SubjectRe: [Csnd] Csound on newest WSL2 (Win11, with WSLg)?
Hello List,
answering my own question, I think there were actually no special problems with WSLg/WSL2 on WIN11, it was just about making Csound run with PulseAudio instead of ALSA: 
These two links were helpful: 
Cheers 
Thorsten

PS
this works without error, and I hear sound: 

$ csound -odac:1 csound_expl1.csd -+rtaudio=pulse  -+server=unix:$PULSE_SERVER
UnifiedCSD:  csound_expl1.csd
rtaudio: pulseaudio module enabled
Elapsed time at end of orchestra compile: real: 0.004s, CPU: 0.004s
sorting score ...
        ... done
Elapsed time at end of score sort: real: 0.005s, CPU: 0.004s
--Csound version 6.17 (double samples) 2022-02-25
[commit: none]
libsndfile-1.0.31
graphics suppressed, ascii substituted
sr = 44100.0, kr = 1378.125, ksmps = 32
0dBFS level = 1.0, A4 tuning = 440.0
orch now loaded
audio buffered in 256 sample-frame blocks
PulseAudio output server unix:/mnt/wslg/PulseServer
pulseaudio output open
writing 512 sample blks of 64-bit floats to dac:1
SECTION 1:
new alloc for instr 1:
B  0.000 ..  3.000 T  3.000 TT  3.000 M:  0.70000  0.70000
B  3.000 ..  5.000 T  5.000 TT  5.000 M:  0.70000  0.70000
Score finished in csoundPerform().
inactive allocs returned to freespace
end of score.              overall amps:  0.70000  0.70000
           overall samples out of range:        0        0
0 errors in performance
Elapsed time at end of performance: real: 4.874s, CPU: 0.164s
862 512 sample blks of 64-bit floats written to dac:1

Am Mo., 7. März 2022 um 23:52 Uhr schrieb Thorsten Jolitz <tjolitz@gmail.com>:
Hallo List,
not really a Csound question, just trying my luck, maybe somebody did manage to run Csound on WSL2 (Windows Subsystem for Linux with Debian Unstable, Windows11)?

I can  play mp3 files with MPV from the linux command line, so in general linux audio works from WSL2. 

But ALSA does not find a soundcard, and Csound uses ALSA (see PS 2): 
$ aplay -l
aplay: device_list:274: no soundcards found...

As described in PS 1, the newest version of WSL2 on WIN11 now has a 
- minimal system distribution (wslg, g for gui), with running pulseaudio server
- user distribution (wsl2 e.g. debian), with env var PULSE_SERVER= /mnt/wslg/PulseServer

Somehow MPV worked out-of-the-box without any configurations from me. I wonder if there is a trick to make Csound work too?

Cheers
Thorsten


PS 1

PS 2
$ csound instr.csd
[...]
orch now loaded
audio buffered in 256 sample-frame blocks
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default
 *** Cannot open device 'default' for audio input: No such file or directoryFailed to initialise real time audio input

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here