Good instincts! Thanks @Jane
I always forget about raspi-config. So useful.
Anyway, raspi-config politely informed me that, apparently, I didn’t have an audio device at all. ![]()
So that sent me down a rabbit hole.
I got there in the end thanks to the pipewire docs which are just awesome.
I added this to my /boot/firmware/config.txt file.
hdmi_force_hotplug=1
hdmi_drive=2
Next, I chucked a sneaky little sudo reboot…
That got me a the hdmi0 port showing in raspberry pi config which I selected.
With an actual host device and driver, I rebooted pulse-audio which kindly gave me a sink.
systemctl --user restart pipewire pipewire-pulse
wpctl status | grep -A5 Sinks #Show me noisy things
Once I did all that cpal was satiated and her wrath turned away. ![]()
use cpal::traits::{DeviceTrait, HostTrait};
fn main() -> Result<(), Box<dyn Error>> {
// Let's ensure we have a sink before we proceed
let host = cpal::default_host();
let device = host.default_output_device().expect("no audio devices.. gross!");
let dev_conf = device.default_output_config()?;
println!("name = {}", device.name().unwrap_or_else(|_| "dead device _ do not use".into()));
println!("{:?}", dev_conf);
Ok(())
}
console
name = default
SupportedStreamConfig { channels: 2, sample_rate: SampleRate(44100), buffer_size: Range { min: 1, max: 4194304 }, sample_format: F32 }