spell-music / csound-expression

Haskell Framework for Electronic Music
320 stars 31 forks source link

how do setJack, setJackConnect work with pipewire? #66

Open jwaldmann opened 2 years ago

jwaldmann commented 2 years ago

On Fedora 35, with pipewire for audio routing: I wanted to apply https://github.com/spell-music/csound-expression/issues/61#issuecomment-737122525 but is does no longer work.

Standard operation is fine: When I just run dac $ osc 300, output ports csound:output_FL csound:output_FR do appear (visible with jack_lsp, and in qjackctl). I can connect them manually from the command line jack_connect 'csound:output_FL' 'Firefox:input_FL'.

But when I try this connection from within c-s-e, I get

Prelude Csound.Base> dacBy (setJackConnect [("csound:output_FL","Firefox:input_FL")]) $ osc 300
ERROR csound:output_FL not a valid port
^C

same with extra single quotes, and your suggested at (delaySig 1).

When I try to just re-name the output,

Prelude Csound.Base> dacBy (setJack "cse") $ osc 300

I expect it to produce sound as in the standard case, just with renamed csound ports. But I hear no sound at all, and there are no ports visible.


Hi Anton, I am again using csound-expression in my lecture. Because COVID, we switch to remote teaching, right this week, and all sorts of technical problems re-appear ... This thing here is not a blocker, as I can connect the ports manually, but that's quite inconvenient. What can I do to debug the above behaviour?

anton-k commented 2 years ago

Sorry for late reply, thanks for reaching out. I've tried your example on Manjaro with JACK setup over Cadence. And it works fine:

Prelude Csound.Base> bwsPort1 = "'Bitwig Studio:Stereo In-L'"
Prelude Csound.Base> bwsPort2 = "'Bitwig Studio:Stereo In-R'"
Prelude Csound.Base> csPort1 = "cse:output1"
Prelude Csound.Base> csPort2 = "cse:output2"
Prelude Csound.Base> connect = setJackConnect [(csPort1, bwsPort1), (csPort2, bwsPort2)]
Prelude Csound.Base>  dacBy (setJack "cse" <> connect) $ fromMono $ uosc 0.5 * sqr 300

Here I connect it to BitwigStudio DAW. My Csound is v6.16

anton-k commented 2 years ago

I can not help with pipewire since it's not installed on my PC. I've tried it once out of curiocity and could not make it work. The general rule for config problems is to ask on Csound forum and then render simple sound (osc 200) and try to find csound flags that work as raw string invoking Csound directly and then adapt that with Haskell dacBy routine flags

anton-k commented 2 years ago

Your question stirred an idea for me to read runtime jack info and setup that for user. For example samplerate can be set only in the way that jack uses. If the user does not provide that over daBy we probably should query jack instance for that info. As it's tedious to match them up

georgefst commented 2 years ago

I'm running Manjaro with Pipewire, and the pedalboard example crashed until I removed setJack completely (and connected an amp, in my case Guitarix with default settings, to make levels audible).

It shows up like this in Helvum: image

jwaldmann commented 2 years ago

I think I worked around by using the patchbay of qjackctrl ( https://www.rncbc.org/drupal/node/76 )

But still it'd be nice to be able to set things programmatically, instead of manually.

georgefst commented 2 years ago

But still it'd be nice to be able to set things programmatically, instead of manually.

Indeed. My current solution is to spin up a parallel thread that waits 0.1 seconds, then runs a shell script consisting of a load of calls to pw-link. But obviously, that's horrible.

jwaldmann commented 2 years ago

to clarify: patchbay needs manual config just once, to make a "profile", that can be set as default, and then works for each instance of csound running. (depends on the condition that ports always have the same name.)

georgefst commented 2 years ago

Yes, unfortunately Helvum (basically the new, PipeWire-native, equivalent of the Qjackctl patchbay) doesn't yet persist anything: https://gitlab.freedesktop.org/pipewire/helvum/-/issues/55