rust-jack icon indicating copy to clipboard operation
rust-jack copied to clipboard

Loopback

Open nestarz opened this issue 2 years ago • 1 comments

Hello,

I would like to process the audio playback from my system only using Rust, without other configurations, I am trying with Jack bindings to do so. But I can't make it work I have this error that pop up:

Source port in attempted (dis)connection of system:playback_1 and rust_jack_loopback:rust_in is not an output port

using this code, an adaptation of your playback_capture.rs example

  let (client, _status) =
      jack::Client::new("rust_jack_loopback", jack::ClientOptions::NO_START_SERVER).unwrap();
    let input = client
        .register_port("rust_in", jack::AudioIn::default())
        .unwrap();
  client.connect_ports_by_name("system:playback_1", "rust_jack_loopback:rust_in");
  client.connect_ports_by_name("rust_jack_loopback:rust_in", "external:xxx");

Do you know if there is a way to process the audio playback ? and not the audio input ? without tweaking the card so that the audio playback becomes an audio input.

It's related to this issue https://superuser.com/questions/1495091/pyaudio-in-docker-on-cloud-server-alsa-jack and I am asking this mainly because I can't run modprobe snd-aloop to create a loopback in my environment (bc its a linux container on an arbitrary kernel that will not support module snd-aloop and neither its host).

Thank you for your work !

nestarz avatar Oct 17 '21 02:10 nestarz

system:playback_1 is a jack input that happens to output sound to your speakers. Being an input, you cannot connect it to another input like rust_jack_loopback:rust_in.

If all your audio is in JACK, I would suggest using jack::Client to check every output that is connected to system:playback_1 and also route it to rust_jack_loopback:rust_in.

wmedrano avatar Nov 14 '21 20:11 wmedrano