No sound with aplay

There is no sound with aplay.
System: Vero4K
OSMC: latest update
Sound output: HDMI. Sound is working for Kodi, movies etc.
Logs: http://paste.osmc.io/gutibotori

Steps:
osmc@osmc-v4k:~$ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
pulse
PulseAudio Sound Server
default:CARD=AMLM8AUDIO
AML-M8AUDIO,
Default Audio Device
sysdefault:CARD=AMLM8AUDIO
AML-M8AUDIO,
Default Audio Device
front:CARD=AMLM8AUDIO,DEV=0
AML-M8AUDIO,
Front speakers
surround51:CARD=AMLM8AUDIO,DEV=0
AML-M8AUDIO,
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=AMLM8AUDIO,DEV=0
AML-M8AUDIO,
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
hdmi:CARD=AMLM8AUDIO,DEV=0
AML-M8AUDIO,
HDMI Audio Output
dmix:CARD=AMLM8AUDIO,DEV=0
AML-M8AUDIO,
Direct sample mixing device
dmix:CARD=AMLM8AUDIO,DEV=1
AML-M8AUDIO,
Direct sample mixing device
dmix:CARD=AMLM8AUDIO,DEV=2
AML-M8AUDIO,
Direct sample mixing device
dsnoop:CARD=AMLM8AUDIO,DEV=0
AML-M8AUDIO,
Direct sample snooping device
dsnoop:CARD=AMLM8AUDIO,DEV=1
AML-M8AUDIO,
Direct sample snooping device
dsnoop:CARD=AMLM8AUDIO,DEV=2
AML-M8AUDIO,
Direct sample snooping device
hw:CARD=AMLM8AUDIO,DEV=0
AML-M8AUDIO,
Direct hardware device without any conversions
hw:CARD=AMLM8AUDIO,DEV=1
AML-M8AUDIO,
Direct hardware device without any conversions
hw:CARD=AMLM8AUDIO,DEV=2
AML-M8AUDIO,
Direct hardware device without any conversions
plughw:CARD=AMLM8AUDIO,DEV=0
AML-M8AUDIO,
Hardware device with all software conversions
plughw:CARD=AMLM8AUDIO,DEV=1
AML-M8AUDIO,
Hardware device with all software conversions
plughw:CARD=AMLM8AUDIO,DEV=2
AML-M8AUDIO,
Hardware device with all software conversions

osmc@osmc-v4k:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: AMLM8AUDIO [AML-M8AUDIO], device 0: I2S.38 T9015-audio-hifi-0
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: AMLM8AUDIO [AML-M8AUDIO], device 1: SPDIF.39 dit-hifi-1
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: AMLM8AUDIO [AML-M8AUDIO], device 2: PCM.40 pcm2bt-pcm-2
Subdevices: 1/1
Subdevice #0: subdevice #0

osmc@osmc-v4k:~$ aplay a2002011001-e02-ulaw.wav
ALSA lib pcm_direct.c:896:(snd1_pcm_direct_initialize_slave) slave plugin does not support mmap interleaved or mmap noninterleaved access
ALSA lib pcm_dmix.c:1034:(snd_pcm_dmix_open) unable to initialize slave
aplay: main:722: audio open error: Invalid argument

(I got the same mmap error if running librespot).

Regards

Does that same file play in Kodi?

Can not test right now.
Tested sound file:

Other sound samples:
http://www.music.helsinki.fi/tmt/opetus/uusmedia/esim/index-e.html

librespot ends up with the same error.

You should pass -D plughw:0,0 to aplay to play it correctly.

If ALSA is configured correctly, then speaker-test -c 2 -D plughw:0,0 should also be working fine. Also check if Kodi can play back your files OK.

You may need to install the alsa-utils package first.

We may need to change some of the sample rates exposed as supported by the kernel: features like passthrough in Kodi use amcodec rather than ALSA directly.

Sam

Example wav files from the link I have provided. They all play just fine under Kodi and with other Linux boxes using aplay.
$ file a2002011001-e02*
a2002011001-e02-16kHz.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 16000 Hz
a2002011001-e02-8kHz.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 8000 Hz
a2002011001-e02-ulaw.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 8 bit, stereo 44100 Hz
a2002011001-e02.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz

When playing wav files with Kodi kernel dmesg output http://pastebin.com/9umTCGpX

Using aplay only a2002011001-e02.wav plays fine. Logs http://pastebin.com/bfarjPpr

regards

Okay – is there a specific application you need that uses ALSA that isn’t working as you would expect?

I hope to improve default aplay functionality in future, but for now this is low priority and aplay is behaving as we would expect. If Kodi is working well too then this is low on the list of priorities. It will be looked at soon enough however.

Sam

librespot is the only one I need badly as Spotify Connect is something I use daily :slight_smile:
regards

Have you tried it out? If you run in to any problems please let me know.

Sam

Yes I have. There is just no sound and libresport got error from alsa.
NB! librespot plays very well on my PI 2 and OSMC :slight_smile:

librespot:
osmc@osmc:~$ /home/osmc/opt/librespot/bin/librespot -n livingroom -b 320 --backend alsa -c /home/osmc/.cache/librespot --device “plughw:0,0”
INFO:librespot: librespot 6a0657f (2017-02-22). Built on 2017-02-24.
INFO:librespot::player: Track “Didn’t I (Guts Remix)” loaded
ALSA lib pcm.c:7946:(snd_pcm_set_params) Unable to set period time 125000 for PLAYBACK: Invalid argument
thread ‘’ panicked at ‘called Option::unwrap() on a None value’, /buildslave/rust-buildbot/slave/stable-dist-rustc-cross-host-linux/build/src/libcore/option.rs:323
note: Run with RUST_BACKTRACE=1 for a backtrace.

from dmesg
Mar 10 09:36:16 osmc systemd[1]: librespot.service holdoff time over, scheduling restart.
Mar 10 09:36:16 osmc systemd[1]: Stopping Librespot Spotify Connect…
Mar 10 09:36:16 osmc systemd[1]: Starting Librespot Spotify Connect…
Mar 10 09:36:16 osmc systemd[1]: Started Librespot Spotify Connect.
Mar 10 09:36:16 osmc librespot[2399]: INFO:librespot: librespot 6a0657f (2017-02-22). Built on 2017-02-24.
Mar 10 09:36:16 osmc librespot[2399]: WARN:mdns: Failed to register IPv6 receiver: Error { repr: Os { code: 19, message: “No such device” } }
Mar 10 09:36:16 osmc librespot[2399]: INFO:librespot::session: Connecting to AP “lon6-accesspoint-a35.ap.spotify.com:4070
Mar 10 09:36:17 osmc librespot[2399]: INFO:librespot::session: Authenticated as “*****” !
Mar 10 09:36:17 osmc librespot[2399]: INFO:librespot::audio_backend::alsa: Using alsa sink
Mar 10 09:37:12 osmc kernel: aml_spdif_dai: share the same clock
Mar 10 09:37:12 osmc kernel: aml_audio_hw: IEC958 16bit
Mar 10 09:37:12 osmc kernel: hdmitx: audio: aout notify rate 48000
Mar 10 09:37:12 osmc kernel: hdmitx: audio: aout notify size 16
Mar 10 09:37:12 osmc kernel: hdmitx: audio: no update

Okay, I’ll take a look at this soon