diff --git a/Brewfile b/Brewfile index 4277283..cc58f3f 100644 --- a/Brewfile +++ b/Brewfile @@ -1,4 +1,5 @@ brew "overmind" brew "sox" -cask "blackhole-16ch" -cask "blackhole-2ch" +brew "mpv" +# cask "blackhole-16ch" +# cask "blackhole-2ch" diff --git a/Brewfile.lock.json b/Brewfile.lock.json index 66106c4..66284b8 100644 --- a/Brewfile.lock.json +++ b/Brewfile.lock.json @@ -7,11 +7,21 @@ "rebuild": 0, "root_url": "https://ghcr.io/v2/homebrew/core", "files": { + "arm64_monterey": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/overmind/blobs/sha256:1d59fd1eadd4029ec88ef668d7eeaf790c3db3137a9e5dafa7948ccd684c4dc2", + "sha256": "1d59fd1eadd4029ec88ef668d7eeaf790c3db3137a9e5dafa7948ccd684c4dc2" + }, "arm64_big_sur": { "cellar": ":any_skip_relocation", "url": "https://ghcr.io/v2/homebrew/core/overmind/blobs/sha256:00af66eeee076ae3bccba58a690dc73f908b6af7ea0bfebf1fc6b81c5a88c445", "sha256": "00af66eeee076ae3bccba58a690dc73f908b6af7ea0bfebf1fc6b81c5a88c445" }, + "monterey": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/overmind/blobs/sha256:9fbe36f34b548c9945aa64d3ff72bfd7e1398be8f06dc12392e25de3ac0e0988", + "sha256": "9fbe36f34b548c9945aa64d3ff72bfd7e1398be8f06dc12392e25de3ac0e0988" + }, "big_sur": { "cellar": ":any_skip_relocation", "url": "https://ghcr.io/v2/homebrew/core/overmind/blobs/sha256:f0a2458bfe0cbe0a38ca8579b774e45262f68bf8a9f9d1d2ff70a9c388c21446", @@ -41,11 +51,21 @@ "rebuild": 0, "root_url": "https://ghcr.io/v2/homebrew/core", "files": { + "arm64_monterey": { + "cellar": ":any", + "url": "https://ghcr.io/v2/homebrew/core/sox/blobs/sha256:f006a58fcfffdff435bcdf79c10249b1ad979cd82a64a99d081b651ca4ea70a7", + "sha256": "f006a58fcfffdff435bcdf79c10249b1ad979cd82a64a99d081b651ca4ea70a7" + }, "arm64_big_sur": { "cellar": ":any", "url": "https://ghcr.io/v2/homebrew/core/sox/blobs/sha256:8070949420a9a02f3d5e1a99bd460d064e34c361798bae5c4554ac8e1aeb2d49", "sha256": "8070949420a9a02f3d5e1a99bd460d064e34c361798bae5c4554ac8e1aeb2d49" }, + "monterey": { + "cellar": ":any", + "url": "https://ghcr.io/v2/homebrew/core/sox/blobs/sha256:9384cdaee989d5ec7ffcf1585b81a2197d7d8ce68cc0c4134c56b204099f6b32", + "sha256": "9384cdaee989d5ec7ffcf1585b81a2197d7d8ce68cc0c4134c56b204099f6b32" + }, "big_sur": { "cellar": ":any", "url": "https://ghcr.io/v2/homebrew/core/sox/blobs/sha256:e3f62a35b06c9e79516f575a923b3aafc5357f370f4ae5c2812c67c8862ae11c", @@ -78,13 +98,49 @@ } } } - } - }, - "cask": { - "blackhole-16ch": { - "version": "0.2.10", - "options": { - "full_name": "blackhole-16ch" + }, + "mpv": { + "version": "0.33.1", + "bottle": { + "rebuild": 0, + "root_url": "https://ghcr.io/v2/homebrew/core", + "files": { + "arm64_monterey": { + "cellar": "/opt/homebrew/Cellar", + "url": "https://ghcr.io/v2/homebrew/core/mpv/blobs/sha256:c3ef442c5e83fd6540a01fc6376c5cade89b7bd5f07abf7811f1a06fdc664d81", + "sha256": "c3ef442c5e83fd6540a01fc6376c5cade89b7bd5f07abf7811f1a06fdc664d81" + }, + "arm64_big_sur": { + "cellar": "/opt/homebrew/Cellar", + "url": "https://ghcr.io/v2/homebrew/core/mpv/blobs/sha256:dd487a80e5586c93ccde6942170d026e9eba5b403d95e409ad55282cea818790", + "sha256": "dd487a80e5586c93ccde6942170d026e9eba5b403d95e409ad55282cea818790" + }, + "monterey": { + "cellar": "/usr/local/Cellar", + "url": "https://ghcr.io/v2/homebrew/core/mpv/blobs/sha256:48cff8a1e5ce3e63982e586a114d3ebee3d689e8bd5b23ad1db78323c1e088b0", + "sha256": "48cff8a1e5ce3e63982e586a114d3ebee3d689e8bd5b23ad1db78323c1e088b0" + }, + "big_sur": { + "cellar": "/usr/local/Cellar", + "url": "https://ghcr.io/v2/homebrew/core/mpv/blobs/sha256:76b0fc9d207aee16f65b8b1782bc35dec5a870952ebba6ae7a74e6ede9bdd34a", + "sha256": "76b0fc9d207aee16f65b8b1782bc35dec5a870952ebba6ae7a74e6ede9bdd34a" + }, + "catalina": { + "cellar": "/usr/local/Cellar", + "url": "https://ghcr.io/v2/homebrew/core/mpv/blobs/sha256:8ab98fffc330dea03f2732fa17c7f53753601c49c3f9dec2a7d727bdc901c484", + "sha256": "8ab98fffc330dea03f2732fa17c7f53753601c49c3f9dec2a7d727bdc901c484" + }, + "mojave": { + "cellar": "/usr/local/Cellar", + "url": "https://ghcr.io/v2/homebrew/core/mpv/blobs/sha256:87df95e8f4f723a5b6fe163d5ac740fef9f5ffa9c318c82c9a6b0844aa7203b9", + "sha256": "87df95e8f4f723a5b6fe163d5ac740fef9f5ffa9c318c82c9a6b0844aa7203b9" + }, + "x86_64_linux": { + "cellar": "/home/linuxbrew/.linuxbrew/Cellar", + "url": "https://ghcr.io/v2/homebrew/core/mpv/blobs/sha256:6a037de38402f73783c5b403e6aada7388373eda6593b21e43844043cf6496d6", + "sha256": "6a037de38402f73783c5b403e6aada7388373eda6593b21e43844043cf6496d6" + } + } } } } @@ -92,12 +148,12 @@ "system": { "macos": { "big_sur": { - "HOMEBREW_VERSION": "3.2.17-63-g5a5a8d5", + "HOMEBREW_VERSION": "3.3.2-64-gcb24983", "HOMEBREW_PREFIX": "/opt/homebrew", - "Homebrew/homebrew-core": "df940f25efdeaec9913a76c9119e6cb44b7632cf", + "Homebrew/homebrew-core": "549b4d59ef5ad82918a323313f9db3bb8dbb84a4", "CLT": "12.5.0.22.9", - "Xcode": "13.0", - "macOS": "11.6" + "Xcode": "13.1", + "macOS": "11.6.1" } } } diff --git a/Procfile b/Procfile index ec904de..1418197 100644 --- a/Procfile +++ b/Procfile @@ -1,9 +1,2 @@ -host: PI_IP=apaw.local; sleep 3; sox -V1 --type coreaudio "BlackHole 16ch" --type raw --rate 44100 --encoding signed-integer --bits 24 --channels 2 - remix 1 2 | nc $PI_IP 2150 | sox -V1 --type raw --rate 44100 --encoding signed-integer --bits 24 --channels 2 - --type coreaudio "BlackHole 2ch" -pi: ssh -S none root@pi 'killall -v -s SIGKILL nc arecord aplay; nice -n -20 arecord --verbose --disable-resample --disable-channels --disable-format --disable-softvol --mmap --nonblock --rate 44100 --format S24_3LE --channels 2 --file-type raw --device hw:CARD=UAC2Gadget,DEV=0 --buffer-time 75000 - | nice -n -20 nc -l 2150 -k | nice -n -20 aplay --verbose --disable-resample --disable-channels --disable-format --disable-softvol --mmap --nonblock --rate 44100 --format S24_3LE --channels 2 --file-type raw --device hw:CARD=UAC2Gadget,DEV=0 --buffer-time 75000 -' - -# an attempt of monitoring via HDMI output -# fixme: still too much latency... -#pi: ssh -S none root@pi 'killall -v -s SIGKILL nc arecord aplay; nice -n -20 arecord --verbose --disable-resample --disable-channels --disable-format --disable-softvol --mmap --nonblock --rate 44100 --format S24_3LE --channels 2 --file-type raw --device hw:CARD=UAC2Gadget,DEV=0 - | nice -n -20 stdbuf -i0 -o0 -e0 tee >(nice -n -19 nc -l 2150 -k | nice -n -19 aplay --verbose --disable-resample --disable-channels --disable-format --disable-softvol --mmap --nonblock --rate 44100 --format S24_3LE --channels 2 --file-type raw --device hw:CARD=UAC2Gadget,DEV=0 -) >(nice -n -20 stdbuf -i0 -o0 -e0 aplay --verbose --disable-resample --disable-channels --disable-softvol --mmap --nonblock --rate 44100 --format S24_3LE --channels 2 --file-type raw --device plughw:CARD=b1,DEV=0 --buffer-time 50000 -) > /dev/null' - -# fixme: why sshd suddenly exits? -#ipad: trap 'ssh ipad "killall cat socat"' EXIT > /dev/null; ssh ipad ./pi-socat.sh \ No newline at end of file +host: PI_IP=apaw.local; sleep 5; sox -V1 --type coreaudio "RpIn" --type wav --rate 44100 --encoding signed-integer --bits 24 --channels 2 - | nc $PI_IP 2150 | mpv --no-config --audio-device=coreaudio/RpOut_UID --profile=low-latency - +pi: ssh -S none root@pi 'killall -v -s SIGKILL nc arecord aplay; nice -n -20 arecord --verbose --disable-resample --disable-channels --disable-format --disable-softvol --mmap --nonblock --rate 44100 --format S24_3LE --channels 2 --file-type wav --device hw:CARD=UAC2Gadget,DEV=0 --buffer-time 100000 - | nice -n -20 nc -l 2150 | nice -n -20 aplay --verbose --disable-resample --disable-channels --disable-format --disable-softvol --mmap --nonblock --rate 44100 --format S24_3LE --channels 2 --file-type wav --device hw:CARD=UAC2Gadget,DEV=0 --buffer-time 100000 -' \ No newline at end of file diff --git a/README.md b/README.md index 9d91651..5529686 100644 --- a/README.md +++ b/README.md @@ -38,3 +38,5 @@ pass: raspberry # after deploy.sh change cmdline.txt: modules-load=dwc2,libcomposite ``` + +`RpIn` and `RpOut` are [BlackHole Drivers](https://github.com/ExistentialAudio/BlackHole/wiki/Running-Multiple-BlackHole-Drivers). \ No newline at end of file diff --git a/deploy.sh b/deploy.sh index 7e195da..6f7a66f 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,5 +1,6 @@ #!/bin/zsh -scp rc.local root@pi:/etc/rc.local -scp usb.sh root@pi:/root/usb.sh -ssh root@pi reboot \ No newline at end of file +PI=root@pi +scp rc.local $PI:/etc/rc.local +scp usb.sh $PI:/root/usb.sh +ssh $PI reboot \ No newline at end of file diff --git a/iSH-socat.sh b/iSH-socat.sh index a7c479c..c8e8210 100644 --- a/iSH-socat.sh +++ b/iSH-socat.sh @@ -1,5 +1,5 @@ #!/bin/sh # run via https://ish.app cat /dev/location > /dev/null & # granting "allow always" enables running in background -socat TCP-LISTEN:2122,bind=0.0.0.0,fork,su=nobody,reuseaddr TCP:169.254.1.1:22 & -socat TCP-LISTEN:2150,bind=0.0.0.0,fork,su=nobody,reuseaddr TCP:169.254.1.1:2150 +socat TCP-LISTEN:2122,bind=0.0.0.0,fork,su=nobody,reuseaddr,nodelay TCP:169.254.1.1:22,nodelay & +socat TCP-LISTEN:2150,bind=0.0.0.0,fork,su=nobody,reuseaddr,nodelay TCP:169.254.1.1:2150,nodelay & diff --git a/usb.sh b/usb.sh index d1572e5..b737a06 100755 --- a/usb.sh +++ b/usb.sh @@ -16,6 +16,7 @@ echo "ECM + UAC2" > configs/c.1/strings/0x409/configuration echo 250 > configs/c.1/MaxPower # Ethernet +# https://www.kernel.org/doc/html/latest/usb/gadget-testing.html#ecm-function mkdir -p functions/ecm.usb0 # first byte of address must be even echo "48:6f:73:74:50:43" > functions/ecm.usb0/host_addr @@ -23,11 +24,18 @@ echo "42:61:64:55:53:42" > functions/ecm.usb0/dev_addr ln -s functions/ecm.usb0 configs/c.1/ # UAC2 audio +# https://www.kernel.org/doc/html/latest/usb/gadget-testing.html#uac2-function mkdir -p functions/uac2.usb0 echo 3 > functions/uac2.usb0/c_ssize echo 3 > functions/uac2.usb0/p_ssize echo 44100 > functions/uac2.usb0/c_srate echo 44100 > functions/uac2.usb0/p_srate +echo 3 > functions/uac2.usb1/с_chmask +echo 3 > functions/uac2.usb1/p_chmask +# todo: capture more channels via the Raspberry Pi Zero 2 +# USB Device Class Definition for Audio Devices: 4.1 Audio Channel Cluster Descriptor +# "110011".to_i(2) = 51 +#echo 51 > functions/uac2.usb0/c_chmask ln -s functions/uac2.usb0 configs/c.1/ # End functions