Page 2 of 3

Re: Octo arrived and working, potentiometer knobs?

Posted: Mon May 01, 2017 2:44 pm
by flatmax
Oh OK,

To use between 1 and 8 channels with the Octo, you need to install the .asoundrc from the setup page.

Matt

Re: Octo arrived and working, potentiometer knobs?

Posted: Mon May 01, 2017 5:22 pm
by ktb
flatmax wrote:Oh OK,

To use between 1 and 8 channels with the Octo, you need to install the .asoundrc from the setup page.

Matt
I'm already using the .asoundrc file content you posted in the "How to setup" thread. I manually set up the Octo using your instructions.

Code: Select all

pi@raspberrypi:~$ cat ~/.asoundrc
pcm.!default {
#       type hw
#       card 0
        type plug
        slave.pcm "anyChannelCount"
}

ctl.!default {
        type hw
        card 0
}

pcm.anyChannelCount {
    type route
    slave.pcm "hw:0"
    slave.channels 8;
    ttable {
           0.0 1
           1.1 1
           2.2 1
           3.3 1
           4.4 1
           5.5 1
           6.6 1
           7.7 1
    }
}

ctl.anyChannelCount {
    type hw;
    card 0;
}
From what I've read, a "hw" ALSA device should be used with shairport-sync. Perhaps the following will help you understand the problem.

This works:
hw, 8 channels:

Code: Select all

pi@raspberrypi:~$ speaker-test -D hw:0,0 -c 8 -t wav -l 1

speaker-test 1.1.3

Playback device is hw:0,0
Stream parameters are 48000Hz, S16_LE, 8 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 32 to 32768
Period size range from 16 to 16384
Using max buffer size 32768
Periods = 4
was set period_size = 8192
was set buffer_size = 32768
 0 - Front Left
 4 - Center
 1 - Front Right
 7 - Side Right
 3 - Rear Right
 2 - Rear Left
 6 - Side Left
 5 - LFE
Time per period = 10.762964
pi@raspberrypi:~$ speaker-test -D hw:0 -c 8 -t wav -l 1

speaker-test 1.1.3

Playback device is hw:0
Stream parameters are 48000Hz, S16_LE, 8 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 32 to 32768
Period size range from 16 to 16384
Using max buffer size 32768
Periods = 4
was set period_size = 8192
was set buffer_size = 32768
 0 - Front Left
 4 - Center
 1 - Front Right
 7 - Side Right
 3 - Rear Right
 2 - Rear Left
 6 - Side Left
 5 - LFE
Time per period = 10.762748
This doesn't work:
hw, 2 channels:

Code: Select all

pi@raspberrypi:~$ speaker-test -D hw:0,0 -c 2 -t wav -l 1

speaker-test 1.1.3

Playback device is hw:0,0
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)
Channels count (2) not available for playbacks: Invalid argument
Setting of hwparams failed: Invalid argument
pi@raspberrypi:~$ speaker-test -D hw:0 -c 2 -t wav -l 1

speaker-test 1.1.3

Playback device is hw:0
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)
Channels count (2) not available for playbacks: Invalid argument
Setting of hwparams failed: Invalid argument


Of course, using plughw does work...

plughw, 2 channels:

Code: Select all

pi@raspberrypi:~$ speaker-test -D plughw:0,0 -c 2 -t wav -l 1

speaker-test 1.1.3

Playback device is plughw:0,0
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 32 to 32768
Period size range from 16 to 16384
Using max buffer size 32768
Periods = 4
was set period_size = 8192
was set buffer_size = 32768
 0 - Front Left
 1 - Front Right
Time per period = 2.402073
pi@raspberrypi:~$ speaker-test -D plughw:0 -c 2 -t wav -l 1

speaker-test 1.1.3

Playback device is plughw:0
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 32 to 32768
Period size range from 16 to 16384
Using max buffer size 32768
Periods = 4
was set period_size = 8192
was set buffer_size = 32768
 0 - Front Left
 1 - Front Right
Time per period = 2.402124
plughw, 8 channels

Code: Select all

pi@raspberrypi:~$ speaker-test -D plughw:0,0 -c 8 -t wav -l 1

speaker-test 1.1.3

Playback device is plughw:0
Stream parameters are 48000Hz, S16_LE, 8 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 32 to 32768
Period size range from 16 to 16384
Using max buffer size 32768
Periods = 4
was set period_size = 8192
was set buffer_size = 32768
 0 - Front Left
 4 - Center
 1 - Front Right
 7 - Side Right
 3 - Rear Right
 2 - Rear Left
 6 - Side Left
 5 - LFE
Time per period = 10.763072
pi@raspberrypi:~$ speaker-test -D plughw:0 -c 8 -t wav -l 1

speaker-test 1.1.3

Playback device is plughw:0
Stream parameters are 48000Hz, S16_LE, 8 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 32 to 32768
Period size range from 16 to 16384
Using max buffer size 32768
Periods = 4
was set period_size = 8192
was set buffer_size = 32768
 0 - Front Left
 4 - Center
 1 - Front Right
 7 - Side Right
 3 - Rear Right
 2 - Rear Left
 6 - Side Left
 5 - LFE
Time per period = 10.762929
Now, I wanted to say that I already tried using output_device = "plughw:0"; instead of output_device = "hw:0"; in /etc/shairport-sync.conf and it didn't work or there was a problem, but I just tested it again by streaming audio from a 5th generation iPod touch and it does appear to work. So, maybe using plughw instead of hw is the solution for the Octo even if that isn't what the shairport-sync documentation and developer seems to recommend. https://github.com/mikebrady/shairport-sync/issues/419

Re: Octo arrived and working, potentiometer knobs?

Posted: Tue May 02, 2017 3:03 pm
by flatmax
Oh - are you using the .asoundrc from the setup page ? It will let any app use any number of channels.

thanks
Matt

Re: Octo arrived and working, potentiometer knobs?

Posted: Tue May 02, 2017 6:38 pm
by ktb
flatmax wrote:Oh - are you using the .asoundrc from the setup page ? It will let any app use any number of channels.

thanks
Matt
Did you read my last post? Yes, I'm using the .asoundrc config that you posted in the "How to setup" thread on this forum -- viewtopic.php?f=9&t=1222. I included that information in my last post. If you're interested, you can read more about this situation in the GitHub issue linked here -- https://github.com/mikebrady/shairport-sync/issues/419
The problem with the plughw:0 option is that is may not return the correct synchronisation.

Re: Octo arrived and working, potentiometer knobs?

Posted: Tue May 02, 2017 8:29 pm
by flatmax
You can use the default device, rather then specifying "-D", try removing that it should allow you to play any number of channels between 1 and 8.

Matt

Re: Octo arrived and working, potentiometer knobs?

Posted: Tue May 02, 2017 8:35 pm
by ktb
Correct, I could use the default device which would be "Playback/recording through the PulseAudio sound server". I just can't use the "hw" device. shairport-sync prefers ALSA and prefers "hw" ALSA devices: "Direct hardware device without any conversions."

Re: Octo arrived and working, potentiometer knobs?

Posted: Tue May 02, 2017 11:52 pm
by flatmax
Hmm,

I see your dilema !
The anyChannelCount plug device is only a route device. It doesn't change the sample rate nor word length in bits. Is it possible to use it ?

Matt

Re: Octo arrived and working, potentiometer knobs?

Posted: Wed May 03, 2017 1:26 am
by ktb
flatmax wrote:Hmm,

I see your dilema !
The anyChannelCount plug device is only a route device. It doesn't change the sample rate nor word length in bits. Is it possible to use it ?

Matt
Interesting. I think I understand. I have Audacious working like this now with ALSA:
Output plugin: ALSA Output

Bit Depth: 16
Bit Depth options:
  • 16 (works)
    24 (works)
    32 (works)
    Floating point (doesn't work, but IIRC it does work with the JACK Output plugin)
PCM device: anyChannelCount - (no description)
PCM device options:
  • default - Default PCM device
    null - Discard all samples (playback) or generate zero samples (capture)
    anyChannelCount - (no description)
    sysdefault:CARD=audioinjectoroc - audioinjector-octo-soundcard, Default Audio Device
    dmix:CARD=audioinjectoroc,DEV=0 - audioinjector-octo-soundcard, Direct sample mixing device
    dsnoop:CARD=audioinjectoroc,DEV=0 - audioinjector-octo-soundcard, Direct sample snooping device
    hw:CARD=audioinjectoroc,DEV=0 - audioinjector-octo-soundcard, Direct hardware device without any conversions
    plughw:CARD=audioinjectoroc,DEV=0 - audioinjector-octo-soundcard, Hardware device with all software conversions
    hw:0,0 -
Mixer device: default - Default mixer device (the only option that works)
Mixer device options:
  • default - Default mixer device
    sysdefault - Default control device
    anyChannelCount - (no description)
    hw:CARD=audioinjectoroc - audioinjector-octo-soundcard Direct control device
    hw:0 - audioinjector-octo-soundcard
Mixer element: Master (only option)
Mixer element options:
  • Master
So, I've now tested shairport-sync using anyChannelCount instead of plughw:0 and it does not appear to work in any of the following ways:

Code: Select all

  output_device = "anyChannelCount"; // the name of the alsa output device. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc.
//  mixer_control_name = "PCM"; // the name of the mixer to use to adjust output volume. If not specified, volume in adjusted in software.
//  mixer_device = "default"; // the mixer_device default is whatever the output_device is. Normally you wouldn't have to use this.
Results in:

Code: Select all

May 02 09:51:40 raspberrypi shairport-sync[31758]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 09:51:40 raspberrypi shairport-sync[31758]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 09:51:40 raspberrypi shairport-sync[31758]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 09:51:40 raspberrypi shairport-sync[31758]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 09:51:40 raspberrypi shairport-sync[31758]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 09:51:40 raspberrypi shairport-sync[31758]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 09:51:40 raspberrypi shairport-sync[31758]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 09:51:40 raspberrypi shairport-sync[31758]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 09:51:40 raspberrypi shairport-sync[31758]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 09:51:40 raspberrypi shairport-sync[31758]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount

Code: Select all

  output_device = "anyChannelCount"; // the name of the alsa output device. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc.
  mixer_control_name = "Master"; // the name of the mixer to use to adjust output volume. If not specified, volume in adjusted in software.
  mixer_device = "default"; // the mixer_device default is whatever the output_device is. Normally you wouldn't have to use this.
Results in:

Code: Select all

May 02 09:54:20 raspberrypi shairport-sync[31913]: Successful Startup
May 02 09:54:50 raspberrypi shairport-sync[31913]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 09:54:50 raspberrypi shairport-sync[31913]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 09:54:50 raspberrypi shairport-sync[31913]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 09:54:50 raspberrypi shairport-sync[31913]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 09:54:50 raspberrypi shairport-sync[31913]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 09:54:50 raspberrypi shairport-sync[31913]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 09:54:50 raspberrypi shairport-sync[31913]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 09:54:50 raspberrypi shairport-sync[31913]: mmap() failed: Cannot allocate memory
May 02 09:54:50 raspberrypi shairport-sync[31913]: Failed to attach mixer

Code: Select all

  output_device = "anyChannelCount"; // the name of the alsa output device. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc.
  mixer_control_name = "Master"; // the name of the mixer to use to adjust output volume. If not specified, volume in adjusted in software.
//  mixer_device = "default"; // the mixer_device default is whatever the output_device is. Normally you wouldn't have to use this.
Results in:

Code: Select all

May 02 09:56:01 raspberrypi systemd[1]: Started ShairportSync AirTunes receiver.
May 02 09:56:02 raspberrypi pulseaudio[32044]: [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
May 02 09:56:02 raspberrypi pulseaudio[32044]: [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported:Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
May 02 09:56:02 raspberrypi shairport-sync[32037]: ALSA lib control.c:1373:(snd_ctl_open_noupdate) Invalid CTL anyChannelCount
May 02 09:56:02 raspberrypi shairport-sync[32037]: Failed to attach mixer

Code: Select all

  output_device = "anyChannelCount"; // the name of the alsa output device. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc.
//  mixer_control_name = "Master"; // the name of the mixer to use to adjust output volume. If not specified, volume in adjusted in software.
  mixer_device = "default"; // the mixer_device default is whatever the output_device is. Normally you wouldn't have to use this.
Results in:

Code: Select all

May 02 10:01:06 raspberrypi shairport-sync[32215]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 10:01:06 raspberrypi shairport-sync[32215]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 10:01:06 raspberrypi shairport-sync[32215]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 10:01:06 raspberrypi shairport-sync[32215]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 10:01:06 raspberrypi shairport-sync[32215]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 10:01:06 raspberrypi shairport-sync[32215]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 10:01:06 raspberrypi shairport-sync[32215]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 10:01:06 raspberrypi shairport-sync[32215]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 10:01:06 raspberrypi shairport-sync[32215]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 10:01:06 raspberrypi shairport-sync[32215]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 10:01:06 raspberrypi shairport-sync[32215]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount
May 02 10:01:06 raspberrypi shairport-sync[32215]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelCount

Code: Select all

  output_device = "default"; // the name of the alsa output device. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc.
  mixer_control_name = "Master"; // the name of the mixer to use to adjust output volume. If not specified, volume in adjusted in software.
  mixer_device = "default"; // the mixer_device default is whatever the output_device is. Normally you wouldn't have to use this.
Results in:

Code: Select all

May 02 10:07:19 raspberrypi systemd[1]: Started ShairportSync AirTunes receiver.
May 02 10:07:20 raspberrypi pulseaudio[32614]: [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
May 02 10:07:20 raspberrypi pulseaudio[32614]: [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
May 02 10:07:20 raspberrypi shairport-sync[32607]: Successful Startup
May 02 10:07:58 raspberrypi shairport-sync[32607]: Failed to set playback dB volume

Code: Select all

  output_device = "default"; // the name of the alsa output device. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc.
  mixer_control_name = "Master"; // the name of the mixer to use to adjust output volume. If not specified, volume in adjusted in software.
//  mixer_device = "default"; // the mixer_device default is whatever the output_device is. Normally you wouldn't have to use this.
Results in:

Code: Select all

May 02 10:10:06 raspberrypi systemd[1]: Started ShairportSync AirTunes receiver.
May 02 10:10:06 raspberrypi pulseaudio[434]: [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
May 02 10:10:06 raspberrypi pulseaudio[434]: [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
May 02 10:10:06 raspberrypi shairport-sync[427]: Successful Startup
May 02 10:10:40 raspberrypi shairport-sync[427]: Failed to set playback dB volume

Code: Select all

  output_device = "default"; // the name of the alsa output device. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc.
//  mixer_control_name = "Master"; // the name of the mixer to use to adjust output volume. If not specified, volume in adjusted in software.
//  mixer_device = "default"; // the mixer_device default is whatever the output_device is. Normally you wouldn't have to use this.
Results in no apparent errors, but the streaming audio from an iPod cuts out after only a few seconds.


So, I'm back to using output_device = "plughw:0"; with shairport-sync.

Re: Octo arrived and working, potentiometer knobs?

Posted: Wed May 03, 2017 1:43 am
by ktb
It also occurred to me that shairport-sync runs as the shairport-sync user, so maybe the shairport-sync user needs its own .asoundrc config (/home/shairport-sync/.asoundrc). Unfortunately, that doesn't seem to help:

Code: Select all

May 02 10:35:56 raspberrypi shairport-sync[1835]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelOutput
May 02 10:35:56 raspberrypi shairport-sync[1835]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelOutput
May 02 10:35:56 raspberrypi shairport-sync[1835]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelOutput
May 02 10:35:56 raspberrypi shairport-sync[1835]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelOutput
May 02 10:35:56 raspberrypi shairport-sync[1835]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelOutput
May 02 10:35:56 raspberrypi shairport-sync[1835]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelOutput
May 02 10:35:56 raspberrypi shairport-sync[1835]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelOutput
May 02 10:35:56 raspberrypi shairport-sync[1835]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelOutput
May 02 10:35:56 raspberrypi shairport-sync[1835]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelOutput
May 02 10:35:56 raspberrypi shairport-sync[1835]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelOutput
May 02 10:35:56 raspberrypi shairport-sync[1835]: ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM anyChannelOutput
I wonder if running pulseaudio in system mode would help at all.

Re: Octo arrived and working, potentiometer knobs?

Posted: Wed May 03, 2017 8:36 pm
by ktb
OK, I think I got the "default" output working with shairport-sync. It seems I needed to run shairport-sync as the pi user since pulseaudio is running as a user service. So basically I created and enabled a modified version of the shairport-sync.service systemd unit file:

/etc/systemd/system/shairport-sync.service

Code: Select all

[Unit]
Description=ShairportSync AirTunes receiver
After=sound.target
Requires=avahi-daemon.service
After=avahi-daemon.service
Wants=network-online.target
After=network.target network-online.target

[Service]
ExecStart=/usr/local/bin/shairport-sync
User=pi
Group=pi

[Install]
WantedBy=multi-user.target
My guess is that it might also work if pulseaudio was run as a system service, but maybe not. EDIT: Yes, pulseaudio in system mode also works with the default shairport-sync.service unit file (running as the shairport-sync user).

I don't know if this is any better than using plughw:0.