audio-box/docs/noxbox-phase-1-0-ArchArm-BT-Pulseaudio.md

101 lines
5.6 KiB
Markdown

# NoxBox ArchArm
- add note that users are alarm/alarm and root/root
- Configure wpa_supplicant: create config (interface specific), start temporarily, use wpa_cli to configure wifi, enable systemd service (for specific interface, which requires specific config file created earlier)
- enable and start dhcpcd (systemd service)
- Enable bluetooth stuffs. see one of the latest comments [here](https://gist.github.com/shenghaoyang/92e6dd65b9f0cc736a419f3e640663c2)
Particularly where it says:
`So put dtparam=krnbt=on in your /boot/config.txt and hci0 should come up after boot,`
Scratch this, Wat uiteindelijk in de config.txt moet staan, want anders geen sound via broadcom:
```
# See /boot/overlays/README for all available options
dtparam=audio=on
dtoverlay=vc4-kms-v3d
dtparam=krnbt=on
initramfs initramfs-linux.img followkernel
```
- install bluez and bluez-utils. start and enable bluetooth service.
- Follow this again? https://gist.github.com/yejun/2c1a070a839b3a7b146ede8a998b5495
- Interesting note: installing just pulseaudio-bluetooth this time (before it was pulseaudio as a whole?) only took 94.20MiB this time. before it was something between .5 and 1 gigabyte
-> yes the pulse user is needed or pulseaudio will complain on it not being there (when run as a system service?)
-> I did everything except for alsa stuff (just the /boot/config.txt stuff did the trick i think to resolve issues i had earlier )
-> What i also did from this (https://didier.io/post/raspberrypi-stream-sound-over-bluetooth) is:
- In /etc/bluetooth/main.conf file, add Class = 0x00041C.
All the rest i tried did not seem to have effect and was reverted
- Go through the loops and hoops to pair a bluetooth device using bluetoothctl and make sure to add it to trusted devices (power on, scan or set discover on and pair/connect, trust)
Side note: messing with wrong clock (which was confusing in journalctl), this link seems interesting for various other things: https://gist.github.com/theramiyer/cb2b406128e54faa12c37e1a01f7ae15 but nothing about the clock
Configure time: rapsberry pi does not have a proper hardware clock, so we need to sync time using the interwebs (ntpd)
pacman -S ntp
systemctl enable ntpd
systemctl start ntpd
And set the right timezone
```ln -s /usr/share/zoneinfo/Europe/Brussels /etc/localtime```
Last state:
Audio sort of works and so does auto-connect (forgot to trust the device earlier) it is however popping and lagging a lot.
We're probably not using APT-X (as that seems to be done by replacing pulseaudio-bluetooth with pulseaudio-modules-bt AUR)
See the error handling section of: https://wiki.archlinux.org/title/Bluetooth_headset#Switch_between_HSP/HFP_and_A2DP_setting
neither can we switch to a2dp_sink so we're probably running as headset (speex codec shit?)
Continuation:
- Annoyed by pulseaudio not being controllabe due to system-wide service, i skimmed the arch wiki page on pulseaudio:
```
Then enable pulseaudio.service at the system level.
# systemctl enable --now pulseaudio
You will also need to disable the user-level pulseaudio service across the whole system:
# systemctl --global mask pulseaudio.socket
```
this however does not seem to be the issue of our crackling/popping sound...
And no solution for our pactl issues, appears that installing sudo helps so we are able to do this instead:
sudo -u pulse pactl
to run pactl and thus for example
sudo -u pulse pactl list
- Installing aptX support required building 'pulseaudio-modules-bt' from AUR. Which implies installing base-devel packages to be able to do so, and some extra dependencies
Once installed it automatically works, but unfortunately does not fix the sound glitches we have (popping/crackling)
- This fixed most of the crackling/popping. sound still feels a bit off and laggy. (from the arch wiki on pulseaudio, adapted for out system-wide usage of pulse)
Glitches, skips or crackling
The newer implementation of the PulseAudio sound server uses timer-based audio scheduling instead of the traditional, interrupt-driven approach.
Timer-based scheduling may expose issues in some ALSA drivers. On the other hand, other drivers might be glitchy without it on, so check to see what works on your system.
To turn timer-based scheduling off add tsched=0 in /etc/pulse/system.pa:
```
#/etc/pulse/system.pa
load-module module-udev-detect tsched=0
```
Relevant sources:
- most of this stuff matches
https://gist.github.com/yejun/2c1a070a839b3a7b146ede8a998b5495
- Enabling bluetooth on arch arm
https://gist.github.com/shenghaoyang/92e6dd65b9f0cc736a419f3e640663c2
- generic, archwiki
https://wiki.archlinux.org/title/Bluetooth_headset
- This seems to be shit (or just totally outdated)
https://didier.io/post/raspberrypi-stream-sound-over-bluetooth
Previous side tracked on:
<!-- IGNORE THIS
=> not fully working yet, trying some of this: https://didier.io/post/raspberrypi-stream-sound-over-bluetooth
mainly added Socket in audio.confg based on 'In /etc/bluetooth/input.conf file, add Enable=Source,Sink,Media,Socket.'
and In /etc/bluetooth/main.conf file, add Class = 0x00041C.
+ reboot
Still not workin! Bluetooth service zegt
Oct 29 22:46:39 noxbox-miel bluetoothd[342]: Authentication attempt without agent
Oct 29 22:46:39 noxbox-miel bluetoothd[342]: src/profile.c:ext_auth() Headset unit rejected 3C:01:EF:70:21:BC: org.bluez.Error.Rejected
wanner ik met de phone connect (is dit een auto reconnect issue, of beuh?)
IGNORE UNTIL HERE -->
Que? 14.812470] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6