Skip to content

Commit

Permalink
trying quantity mode
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderPavlenko committed Nov 30, 2021
1 parent 01ce38b commit 748879a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 75 deletions.
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pi: ssh -S none pi@pi4 'killall -v -s SIGKILL reaper jackd; sudo nice -n -20 sudo -u pi /home/pi/reaper_linux_armv7l/REAPER/reaper /home/pi/stream.RPP'
pi: ssh -S none pi@pi4 'killall -v -s SIGKILL reaper jackd; sudo nice -n -20 sudo -u pi /home/pi/reaper_linux_armv7l/REAPER/reaper -nosplash /home/pi/stream.RPP'
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
This code allows to use [Raspberry Pi 4](https://www.raspberrypi.com/products/raspberry-pi-4-model-b/) as a USB gadget
composite of Ethernet and multichannel Audio input/output.

The Pi 4 is powerful enough to run [Reaper (armv7l)](https://www.reaper.fm/download.php) and its [ReaStream](https://www.reaper.fm/reaplugs/) plugin with low latency over the built-in Ethernet.
composite of multichannel Audio input/output and Ethernet, meaning it can transform an iPad (or any other [UAC2](https://en.wikipedia.org/wiki/USB#Audio_streaming) compatible device) into a VST effect/instrument integrated into a desktop DAW – the Pi 4 is powerful enough to run [Reaper (armv7l)](https://www.reaper.fm/download.php) and its [ReaStream](https://www.reaper.fm/reaplugs/) plugin with low latency over the built-in Ethernet.

### Other versions
* [Pi Zero](https://github.com/AlexanderPavlenko/pi-audio-duplex/tree/zero-v1)
Expand Down Expand Up @@ -58,7 +56,7 @@ apt install jackd2 xserver-xorg fontconfig libgtk-3-dev
open -a xquartz # "Allow network" in Preferences / Security
scp ~/.Xauthority pi@pi4:.
export DISPLAY=:0 ; ssh -v -X -S none pi@pi4
reaper_linux_armv7l/install-reaper.sh # [R]un REAPER
sudo nice -n -20 sudo -u pi reaper_linux_armv7l/install-reaper.sh # [R]un REAPER
```

#### Preferences
Expand Down
2 changes: 1 addition & 1 deletion jack.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh
export JACK_NO_AUDIO_RESERVATION=1
exec jackd -P70 -p16 -t2000 -dalsa -p256 -n3 -r48000 -s -dhw:CARD=UAC2Gadget,DEV=0
exec jackd -P70 -p16 -t2000 -dalsa -p256 -n4 -r48000 -s -dhw:CARD=UAC2Gadget,DEV=0
68 changes: 8 additions & 60 deletions stream.RPP
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<REAPER_PROJECT 0.1 "6.42/linux-armv7l" 1638014096
<REAPER_PROJECT 0.1 "6.42/linux-armv7l" 1638268407
RIPPLE 0
GROUPOVERRIDE 0 0 0
AUTOXFADE 1
Expand Down Expand Up @@ -86,58 +86,8 @@
>
<PROJBAY
>
<TRACK {71441B9C-1C9B-E19B-B6D7-7382FAE4D9D3}
NAME "c 1-2"
PEAKCOL 16576
BEAT -1
AUTOMODE 0
VOLPAN 1 0 -1 -1 1
MUTESOLO 0 0 0
IPHASE 0
PLAYOFFS 0 1
ISBUS 0 0
BUSCOMP 0 0 0 0 0
SHOWINMIX 1 0.6667 0.5 1 0.5 0 -1 0
FREEMODE 0
SEL 0
REC 1 1024 1 2 0 0 0
VU 2
TRACKHEIGHT 0 0 0 0 0 0
INQ 0 0 0 0.5 100 0 0 100
NCHAN 2
FX 1
TRACKID {71441B9C-1C9B-E19B-B6D7-7382FAE4D9D3}
PERF 0
MIDIOUT -1
MAINSEND 0 0
>
<TRACK {2F4524E5-85D0-28CB-9954-87ED917D2777}
NAME "c 3-4"
PEAKCOL 16576
BEAT -1
AUTOMODE 0
VOLPAN 1 0 -1 -1 1
MUTESOLO 0 0 0
IPHASE 0
PLAYOFFS 0 1
ISBUS 0 0
BUSCOMP 0 0 0 0 0
SHOWINMIX 1 0.6667 0.5 1 0.5 0 -1 0
FREEMODE 0
SEL 0
REC 1 1026 1 2 0 0 0
VU 2
TRACKHEIGHT 0 0 0 0 0 0
INQ 0 0 0 0.5 100 0 0 100
NCHAN 2
FX 1
TRACKID {2F4524E5-85D0-28CB-9954-87ED917D2777}
PERF 0
MIDIOUT -1
MAINSEND 0 0
>
<TRACK {5150BA6C-793A-78BE-8ED1-4CA9C481A85E}
NAME "c stream"
NAME "capture stream"
PEAKCOL 16576
BEAT -1
AUTOMODE 0
Expand All @@ -149,17 +99,15 @@
BUSCOMP 0 0 0 0 0
SHOWINMIX 1 0.6667 0.5 1 0.5 0 -1 0
FREEMODE 0
SEL 0
REC 0 0 1 2 0 0 0
SEL 1
REC 1 2048 1 2 0 0 0
VU 2
TRACKHEIGHT 0 0 0 0 0 0
INQ 0 0 0 0.5 100 0 0 100
NCHAN 4
FX 1
TRACKID {5150BA6C-793A-78BE-8ED1-4CA9C481A85E}
PERF 0
AUXRECV 0 1 1 0 0 0 0 0 0 -1:U 0 -1 ''
AUXRECV 1 1 1 0 0 0 1 0 2 -1:U 0 -1 ''
MIDIOUT -1
MAINSEND 0 0
<FXCHAIN
Expand All @@ -182,7 +130,7 @@
>
>
<TRACK {21087289-D58D-E5C1-9654-0FE16C4BD7C0}
NAME "p stream"
NAME "playback stream"
PEAKCOL 16576
BEAT -1
AUTOMODE 0
Expand All @@ -204,7 +152,8 @@
TRACKID {21087289-D58D-E5C1-9654-0FE16C4BD7C0}
PERF 0
MIDIOUT -1
MAINSEND 1 0
MAINSEND 0 0
HWOUT 0 3 1 0 0 0 0 -1:U -1
<FXCHAIN
WNDRECT 199 277 672 256
SHOW 0
Expand All @@ -216,9 +165,8 @@
BAAAAAAAAAAIAAAAAAAAABAAAAAAAAAAIAAAAAAAAABAAAAAAAAAAIAAAAAAAAAArAAAAAEAAAAAABAA
AAAAAAIAAAABAAAAcGkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==
AFByb2dyYW0gMQAQAAAA
AAAQAAAA
>
PRESETNAME "Program 1"
FLOATPOS 0 0 0 0
FXID {BB35DE4B-39EA-A31A-65E5-C3975CEB496B}
WAK 0 0
Expand Down
24 changes: 15 additions & 9 deletions usb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

cd /sys/kernel/config/usb_gadget/ || fail
mkdir -p lexi && cd lexi || fail
#rm -rf configs/c.1/*.usb0

echo 0x1d6b > idVendor # Linux Foundation
echo 0x0104 > idProduct # Multifunction Composite Gadget
Expand All @@ -26,19 +27,24 @@ 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 48000 > functions/uac2.usb0/c_srate
echo 48000 > functions/uac2.usb0/p_srate

# USB Device Class Definition for Audio Devices: 4.1 Audio Channel Cluster Descriptor
# fail: "11011110011".to_i(2) = 1779 # Side Right, Side Left, -, Front Right of Center, Front Left of Center, Back Right, Left, -, -, Front Right, Left
# fail: "111110111".to_i(2) = 503 # Back Center, Front Right of Center, Front Left of Center, Back Right, Left, -, Front Center, Front Right, Left
# fail: "11111111".to_i(2) = 255
# fail: "1111111111".to_i(2) = 1023
# works: "11110011".to_i(2) = 243 # Front Right of Center, Front Left of Center, Back Right, Left, -, -, Front Right, Left
# but ALSA fails: "cannot set period size to 256 frames for capture"
echo 51 > functions/uac2.usb0/c_chmask

## Quality: 24 bit, 4 input + 2 output channels
echo 51 > functions/uac2.usb0/c_chmask # "110011".to_i(2)
echo 3 > functions/uac2.usb0/p_chmask
echo 3 > functions/uac2.usb0/c_ssize
echo 3 > functions/uac2.usb0/p_ssize

## Quantity: 16 bit, 8 input + 8 output channels
# fixme: 0 inputs in Reaper...
#echo 1779 > functions/uac2.usb0/c_chmask # "11011110011".to_i(2)
#echo 1779 > functions/uac2.usb0/p_chmask
#echo 2 > functions/uac2.usb0/c_ssize
#echo 2 > functions/uac2.usb0/p_ssize

ln -s functions/uac2.usb0 configs/c.1/

# End functions
Expand Down

0 comments on commit 748879a

Please sign in to comment.