Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS Configuration #718

Closed
hstriepe opened this issue Jun 30, 2018 · 10 comments
Closed

macOS Configuration #718

hstriepe opened this issue Jun 30, 2018 · 10 comments

Comments

@hstriepe
Copy link

I am trying to set up sh airport-sync installed via HomeBrew and am having trouble.

  • Running it with just -s to show the version, it shows up in the AirPlay popup
  • I am trying to redirect to an audio DAC that works with AirPlay and SwitchAudio with the command line:
    shairport-sync -- -n “USB Audio DAC "
    The extra spaces are in the advertised name.
    This was reported by SwitchAudioSource and also works with SwitchAudioSource -s.
    Shairport-sync starts up without error but there is showing up in the AirPlay lists. I have tried other output devices as reported by SwitchAudioSource -a

What am I doing wrong?

If I want to set up a config list, where would it be placed. No samples in /etc...

Thanks,
-- Harald

@mikebrady
Copy link
Owner

Harald, I don't really know my way around the HomeBrew installation, but if you enter $ shairport-sync -V and post the response, we can locate where the config file is expected.

@hstriepe
Copy link
Author

hstriepe commented Jul 1, 2018

Ah, "/usr/local/etc/shairport-sync/shairport-sync.conf"

It works using the system default.

$ shairport-sync -v
Version: "3.1.7-OpenSSL-ao-stdout-pipe-soxr-metadata-sysconfdir:/usr/local/etc/shairport-sync"
statistics_requester status is 0.
daemon status is 0.
deamon pid file is "/usr/local/var/run/shairport-sync.pid".
rtsp listening port is 5000.
udp base port is 6001.
udp port range is 100.
player name is "Neptune".
backend is "(null)".
on-start action is "(null)".
on-stop action is "(null)".
wait-cmd status is 0.
on-start returns output is 0.
mdns backend "(null)".
stuffing option is "0" (0-basic, 1-soxr).
resync time is 0.050000 seconds.
allow a session to be interrupted: 0.
busy timeout time is 120.
drift tolerance is 0.001995 seconds.
password is "(null)".
ignore_volume_control is 0.
volume_max_db is not set
playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
disable_synchronization is 0.
use_mmap_if_available is 1.
output_rate is 44100.
output_format is 3 (0-unknown, 1-S8, 2-U8, 3-S16, 4-S24, 5-S24_3LE, 6-S24_3BE, 7-S32).
audio backend desired buffer length is 1.000000 seconds.
audio backend latency offset is 0.000000 seconds.
audio backend silence lead-in time is -1.000000 seconds. A value -1.0 means use the default.
volume range in dB (zero means use the range specified by the mixer): 0.
zeroconf regtype is "_raop._tcp".
decoders_supported field is 1.
use_apple_decoder is 0.
alsa_use_playback_switch_for_mute is 0.
no special mdns service interface was requested.
configuration file name "/usr/local/etc/shairport-sync/shairport-sync.conf" resolves to "/usr/local/etc/shairport-sync/shairport-sync.conf".
metadata enabled is 0.
metadata pipename is "(null)".
metadata socket address is "(null)" port 0.
metadata socket packet size is "500".
get-coverart is 0.
loudness is 0.
loudness reference level is -20.000000
Successful Startup

@mikebrady
Copy link
Owner

Thanks. So, in this configuration, Shairport Sync is using the ao backend to connect to the libao audio subsystem. There are no specific libao options in the Shairport Sync configuration file, and if you do $ shairport-sync -h you'll get the command line options you can use. If you look through some of the issues, including the closed issues, you'll find references to the HomeBrew installation which might be useful.

@hstriepe
Copy link
Author

hstriepe commented Jul 1, 2018

Appreciate the help. I will look around.

@hstriepe
Copy link
Author

hstriepe commented Jul 1, 2018

SwitchAudioSource works with the macOS CoreAudio framework. It clearly maps displayed devices to internal.
What I have not figured out is what the device options are for libao.
Ended up doing a launchctl script hack that saved the default audio device, switched to my desired shairport-sync target, launched shairport-sync as daemon using that default, and switched back the audio device default.
Makes my skin crawl...

Later:
Interestingly, my hack works on High Sierra, but not Mojave. I can do it live:

  • Switch
  • Run shairport-sync as daemon
  • Switch back

But I cannot do it not programmatically at system start. It picks the set default, even with delays.

Oh well, now I just use a simple script menu there...
Getting the right command line syntax to switch to the audio device as listed would be the real answer.

@whizkid79
Copy link

Having the same issues here. I'm looking for a way to tell shairport-sync on macOS which audio device and which channels to use.

@luckman212
Copy link

luckman212 commented Feb 6, 2021

@whizkid79 @hstriepe did you guys ever figure this out? Today I installed shairport-sync on 11.2 using Homebrew 3.0 and got it to play (no pulseaudio required) with this command:

shairport-sync --name=mac-mini --output=ao --statistics

But not sure if there's a better invocation, or any way to use a different backend, since according to the readme:

Note that the installation uses the libao library and so synchronisation is not available — playback glitches will occur occasionally, when the ao system's buffers overflow or underflow.

update: in case anyone reads this. Here's a simple config that lets you start/stop the airplay receiver with just a short simple command.

edit /usr/local/etc/shairport-sync/shairport-sync.conf:

general = {
	name = "mac-mini";
	output_backend = "ao";
};

start daemon:

shairport-sync -d

stop:

shairport-sync -k

@linxucc
Copy link

linxucc commented Aug 27, 2021

The original issue could be translated to this: How could I select a specific the output device?

The trick is simple, since the developers for now don't bother the device select thing, it just uses AO's default output device, that in this case, is whatever the current audio output device is, usually this is the "built-in output", which satisfies 99% people so it stays this way.

To switch between difference output devices, the right way (the Macintosh way) is to go to "Audio Midi Setup" (use your spotlight search for "midi"), then select which ever device you want, and set it as the default (right click on it, select use this device for sound output).

As most users don't have an "audio interface" (usually used for audio production or high-end sound reproduction), or multiple interfaces or DACs to switch between, this is the place people seldom knows.

Do note, after the switch, you have to manually restart the services, or it won't recognize the change, result in no sound.

Again since this is some niche scenario developers don't bother... The program only reads default devices once at the start of the program...

With my previous hacking experience with this AO thing, I'm quite sure it's capable of select specific audio output device manually. So it's just something not implemented in Shairport-sync. Maybe in the future when I have sometime I'll do this myself.

@hstriepe @whizkid79 @luckman212 in case you guys still needs the answer...

@github-actions
Copy link

This issue has been inactive for 45 days so will be closed 7 days from now. To prevent this, please remove the "stale" label or post a comment.

@Badsheep
Copy link

Badsheep commented Jan 17, 2024

Hi there,

In case someone is interested, I use this command tine to start shairport on my Mac OS, and I can choose the device I need (in my case it's called : "MIO Airplay") :

do shell script "/usr/local/opt/shairport-sync/bin/shairport-sync -d -o ao -- -n 'MIO Airplay'"

I run this command in a script at the start of the computer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants