November 20, 2019, 09:42:11 pm

News:

Have you visited the Allwinner Chipset wiki? - http://linux-sunxi.org/


How to get S/PDIF on Cubietruck to work

Started by halfur, November 24, 2013, 12:00:59 pm

Previous topic - Next topic

ykanello

Thanks for all the help folks :)
- i have no home dir asound conf. The system one is:
Quote# cat /etc/asound.conf
pcm.!default {
  type hw
  card 1
  device 0
}
ctl.!default {
  type hw
  card 1
}


aplay -l gives me all the output I expect:
Quote# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sunxicodec [sunxi-CODEC], device 0: M1 PCM [sunxi PCM]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: sunxisndspdif [sunxi-sndspdif], device 0: SUNXI-SPDIF sndspdif-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0


what I find really curious is this :
Quote# cat /proc/asound/card1/pcm0p/sub0/hw_params
closed



hoffi77

Quote from: ykanello on December 03, 2013, 08:58:09 am
what I find really curious is this :
# cat /proc/asound/card1/pcm0p/sub0/hw_params
closed


..I get the same output.

I scanned my mpd log file and there I found an error message exyctly like the one you get:


Nov 30 19:43 : mixer: Failed to read mixer for 'My ALSA Device': no such mixer control: PCM


That was my first try with MPD. After I got that message I adjusted the ALSA settings in the mpd.conf file and it worked. I remember that even before I took any ajustments the mpg321 player worked like a charm.

Did you also check your TOSLINK cable and your receiver??

kevin

Quote from: ykanello on December 03, 2013, 08:58:09 am
Thanks for all the help folks :)
- i have no home dir asound conf. The system one is:
Quote# cat /etc/asound.conf
pcm.!default {
  type hw
  card 1
  device 0
}
ctl.!default {
  type hw
  card 1
}


aplay -l gives me all the output I expect:
Quote# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sunxicodec [sunxi-CODEC], device 0: M1 PCM [sunxi PCM]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: sunxisndspdif [sunxi-sndspdif], device 0: SUNXI-SPDIF sndspdif-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0


what I find really curious is this :
Quote# cat /proc/asound/card1/pcm0p/sub0/hw_params
closed



Can you play the music or not?
If you can, and while you play cat /proc/asound/card1/pcm0p/sub0/hw_params should show some info.
Showed "closed" means that you were not play anything.

ykanello

~# cat /proc/asound/card1/pcm0p/sub0/hw_params
access: RW_INTERLEAVED
format: S16_LE
subformat: STD
channels: 1
rate: 48000 (48000/1)
period_size: 6000
buffer_size: 24000

You are right when is playing I can see the hw parameters.
Too bad I am in the office and I cannot hear if it is playing at the moment or not :)

kevin

Quote from: ykanello on December 04, 2013, 04:15:39 am
~# cat /proc/asound/card1/pcm0p/sub0/hw_params
access: RW_INTERLEAVED
format: S16_LE
subformat: STD
channels: 1
rate: 48000 (48000/1)
period_size: 6000
buffer_size: 24000

You are right when is playing I can see the hw parameters.
Too bad I am in the office and I cannot hear if it is playing at the moment or not :)


If it showed like above, it's working.
And the error message you mentioned from MPD log, that because there is no HW mixer for SPDIF sound card so far as far as I know.
But you can play the music and you should control your volume etc. on your external pre-amp or power amp.

ykanello

Hell Yeah!  :)  :D  :D
I hear sounds!
very many (sic) thanks , also to the irc residents too.
respect

halfur

Just a quick note: yes, the sunxi_sndspdif doesn't have a mixer conol, but it's possible to enable the software mir of mpd, so you can control the volme anyway. Just set mixer_type "software" in the mpd.conf and restart the daemon.

ykanello

cool stuff it! i can verify it works from my client

haasis

Would be nice if you tell how you made it work. What steps die you do?

ykanello

Hi Haasis.
I have the same config as Kevin in his post: http://www.cubieforums.com/index.php?topic=1074.msg6941#msg6941
i added also the option regarding software volume under mix_type. and that works too.

It does says 'closed' on /proc/asound/card1/pcm0p/sub0/hw_params  when NOT playing but when playing:
Quote$ cat /proc/asound/card1/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 44100 (44100/1)
period_size: 4410
buffer_size: 22050

haasis

Thanks ykanello, but I don't understand the steps I have to do. Can you explain the steps you did and which packages you installed?

And: I don't have the config-file asound.conf in /etc


haasis

Okay, no I did a
touch /etc/asound.conf and filled it with

Quote
pcm.!default {
  type hw
  card 2
  device 0
}
ctl.!default {
  type hw
  card 2
}


Now when I play a file with mpg321 I get sound. But VLC produces no sound.
But I wondering about that when VLC is playing:

Quote
root@Cubian:/home/cubie# cat /proc/asound/card2/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 44100 (44100/1)
period_size: 8192
buffer_size: 32768



Any hints?

ykanello

@haasis
this is also what I did. I wrote my own file and placed it in /etc/
As for the VLC, imho you need to set the output of VLC to match the pcm device mentioned in the asound.conf.
I use mpd so the configs are a little different but here:
in asound I specify:
pcm.!default {
  type hw
  card 1
  device 0


in mpd.conf i also specify same card:
audio_output {
        type            "alsa"
        name            "Alsa"
        device          "hw:1,0"        # optional


I do not use VLC so I cannot give you specific details sorry.

haasis

Thank's ykanello,

I was already on the right way. The final thing was a setting in VLC. I had to Change the audio setting to ALSA. Now I have sound.