Skip to content

Commit

Permalink
added info on alsa dmix #534
Browse files Browse the repository at this point in the history
  • Loading branch information
karlstav committed Nov 24, 2023
1 parent 80814c2 commit 49a137e
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ To make it persistent across boot add the line `snd-aloop` to "/etc/modules". To

Playing the audio through your Loopback interface makes it possible for cava to capture it, but there will be no sound in your speakers. In order to play audio on the loopback interface and your actual interface you must make use of the ALSA multi channel.

Look at the included example file `example_files/etc/asound.conf` on how to use the multi channel. I was able to make this work on my laptop (an Asus UX31 running Ubuntu), but I had no luck with the ALSA method on my Raspberry Pi (Rasbian) with an USB DAC. The PulseAudio method however works perfectly on my Pi.
Look at the included example file `example_files/etc/asound.conf` on how to use the multi channel. I was able to make this work with a HDA Intel PCH sound card, but I had no luck with the an USB DAC.

Read more about the ALSA method [here](http://stackoverflow.com/questions/12984089/capture-playback-on-play-only-sound-card-with-alsa).

Expand All @@ -285,6 +285,12 @@ If you are having problems with the alsa method on Rasberry PI, try enabling `mm
dtoverlay=i2s-mmap
```

#### dmix

@reluekiss, was able to make cava work with dmix. Check out the example config in `example_files/etc/asound_dmix.conf` and issue [534](https://github.com/karlstav/cava/issues/534).



### mpd

Add these lines in mpd:
Expand Down
90 changes: 90 additions & 0 deletions example_files/etc/asound_dmix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
pcm.dmixed {
type dmix
ipc_key 1024
ipc_key_add_uid 0
slave {
pcm "hw:1,0" #your hardware speaker device
period_time 0
period_size 1024
buffer_size 4096
channels 2
}
bindings {
0 0
1 1
}
}

pcm.dsnooped {
type dsnoop
ipc_key 1025
slave {
pcm "hw:1,6" #your hardware input device (mic)
period_time 0
period_size 1024
buffer_size 4096
channels 2
}
bindings {
0 0
1 1
}
}

pcm.dmixerloop {
type dmix
ipc_key 2048
ipc_perm 0666 # allow other users
slave.pcm "hw:Loopback,0,0"
slave {
period_time 0
period_size 1024
buffer_size 4096
channels 2 # must match bindings
}
bindings {
0 0
1 1
}
}

pcm.out {
type plug
route_policy "duplicate"
slave.pcm {
type multi
slaves {
a { channels 2 pcm "dmixed" }
b { channels 2 pcm "dmixerloop" }
}
bindings {
0 { slave a channel 0 }
1 { slave a channel 1 }
2 { slave b channel 0 }
3 { slave b channel 1 }
}
}
ttable [
[ 1 0 1 0 ]
[ 0 1 0 1 ]
]
}

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

pcm.!default {
type asym
playback.pcm "out"
#capture.pcm "looprec"
capture.pcm "dsnooped"
}

ctl.!default {
type hw
card 1
}

0 comments on commit 49a137e

Please sign in to comment.