3

I am trying to record the default audio output from raspbmc (running on a Raspberry Pi Model b) to a raw wav stream (which i want to pipe to piFM to transmit audio to an FM tuner). I did not succeed using arecord and found out that the default audio engine for raspbmc is pulseaudio, so i tried the whle thing using parecord/pacat.

My pi is connected to the TV via HDMI and sound works properly. But pactl list only gives me the following sinks/sources:

Sink #0
        State: SUSPENDED
        Name: auto_null
        Description: Dummy Output
        Driver: module-null-sink.c
        Sample Specification: s16le 2ch 44100Hz
        Channel Map: front-left,front-right
        Owner Module: 4
        Mute: no
        Volume: 0: 100% 1: 100%
                0: 0.00 dB 1: 0.00 dB
                balance 0.00
        Base Volume: 100%
                     0.00 dB
        Monitor Source: auto_null.monitor
        Latency: 0 usec, configured 0 usec
        Flags: DECIBEL_VOLUME LATENCY 
        Properties:
                device.description = "Dummy Output"
                device.class = "abstract"
                device.icon_name = "audio-card"
        Formats:
                pcm

Source #0
        State: SUSPENDED
        Name: auto_null.monitor
        Description: Monitor of Dummy Output
        Driver: module-null-sink.c
        Sample Specification: s16le 2ch 44100Hz
        Channel Map: front-left,front-right
        Owner Module: 4
        Mute: no
        Volume: 0: 100% 1: 100%
                0: 0.00 dB 1: 0.00 dB
                balance 0.00
        Base Volume: 100%
                     0.00 dB
        Monitor of Sink: auto_null
        Latency: 0 usec, configured 0 usec
        Flags: DECIBEL_VOLUME LATENCY 
        Properties:
                device.description = "Monitor of Dummy Output"
                device.class = "monitor"
                device.icon_name = "audio-input-microphone"
        Formats:
                pcm

Furthermore aplay gives me:

pi@raspbmc:~$ aplay -l
aplay: device_list:252: no soundcards found...

pi@raspbmc:~$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)

When trying to record audio from the default device, nothing is recorded. When I try playing a sound using paplay nothing is played (no errors, just no sound).

So what am I missing here? I just need to send all played sounds to another program...

I spent hours on google and in forums, wikis and blogs, but did not find a solution that works for my setup yet.

Thanks in advance!

EDIT: /dev/audio does NOT exists on raspbmc, /dev/snd does only contain the entry 'timer'

blckwngd
  • 1,858
  • 1
  • 13
  • 10

2 Answers2

2

You likely need to load the kernel module for the sound device, like this:

# modprobe snd-bcm2835

That will cause some new device files to appear in /dev/snd/ that pulseaudio will detect as Card #0. If I understand it correctly, this device is a layer that lets pulseaudio output sound through ALSA. Add it to your /etc/modules to make it load automatically at boot.

In my setup ALSA outputs sound through HDMI by default. If it doesn't, or if you wish to change this to the phono jack, you can use the amixer command:

$ amixer cset numid=3 <output>

0=auto
1=headphones
2=hdmi

Source: http://www.raspberrypi.org/forums/viewtopic.php?f=38&t=27019. In contrast to their example, I could execute this command as the unprivilegied user pi, instead of root.

Anton Eliasson
  • 923
  • 1
  • 8
  • 8
0

I've struggle for it for about a week and so. Though ALSA is enabled for snd_bcm2835 in my linux-menuconfig.

pi@raspi:~$ aplay -l
aplay: device_list:250: no soundcards found...

and

# aplay output.wav 
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function 
snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat 
returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name 
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer 
returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file 
or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
aplay: main:788: audio open error: No such file or directory

This fixed:

Try adding dtparam=audio=on to /boot/config.txt

Source: thanks a ton to fzinken >> Alsa doesn’t work on my Raspberry Pi 2/3

naveenKumar
  • 367
  • 4
  • 10