1
votes

I've set up a radio for local network, everything (Icecast2, BUTT (Broadcast Using This Tool)) is ready and working except one thing. BUTT intends to capture audio from input device, but that is not what I want, I want to stream desktop audio. I've created a loopback device using modprobe snd-aloop. I actually managed to route the audio from a specific program to that loopback device and I was able to hear it on the web player but the sound is stuttering, speeding up and getting back to normal its hard to describe. It's like decoder cannot catch up. All these are happening in less than a second.

Output from pactl list short sinks

1   alsa_output.pci-0000_00_1f.3.analog-stereo  module-alsa-card.c  s16le 2ch 48000Hz   RUNNING
3   alsa_output.platform-snd_aloop.0.analog-stereo  module-alsa-card.c  s16le 2ch 44100Hz   IDLE
11  alsa_output.pci-0000_01_00.1.hdmi-stereo    module-alsa-card.c  s16le 2ch 44100Hz   IDLE

I have created ~/.asoundrc as most of the tutorial encouraged me to do so, and I believe this problem can be solved by this file but I am not familiar enough with alsa and its features. Sample rate of sound card is 48000 Hz but BUTT is forcing me to select 44100.

Contents of ~/.asoundrc

pcm.!default {
  type asym
  playback.pcm "LoopAndReal"
  #capture.pcm "looprec"
  capture.pcm "hw:0,0"
}

pcm.looprec {
    type hw
    card "Loopback"
    device 1
    subdevice 0
}


pcm.LoopAndReal {
  type plug
  slave.pcm mdev
  route_policy "duplicate"
}


pcm.mdev {
  type multi
  slaves.a.pcm pcm.MixReale
  slaves.a.channels 2
  slaves.b.pcm pcm.MixLoopback
  slaves.b.channels 2
  bindings.0.slave a
  bindings.0.channel 0
  bindings.1.slave a
  bindings.1.channel 1
  bindings.2.slave b
  bindings.2.channel 0
  bindings.3.slave b
  bindings.3.channel 1
}


pcm.MixReale {
  type dmix
  ipc_key 1024
  slave {
    pcm "hw:0,0"
    #rate 48000
    rate 44100
    periods 128
    period_time 0
    period_size 1024 # must be power of 2
    buffer_size 8192
  }
}

pcm.MixLoopback {
  type dmix
  ipc_key 1025
  slave {
    pcm "hw:Loopback,0,0"
    #rate 48000
    rate 44100
    periods 128
    period_time 0
    period_size 1024 # must be power of 2
    buffer_size 8192
  }
}

Thanks in advance for any help.

1

1 Answers

0
votes

I've managed to pipe my desktop audio to mic input using purely pulse audio and no alsa, thanks to this thread: https://unix.stackexchange.com/questions/82259/how-to-pipe-audio-output-to-mic-input