mikebrady / shairport-sync

AirPlay and AirPlay 2 audio player
Other
7.29k stars 574 forks source link

Play songs in external media player using shairport-sync #613

Closed priyambaid closed 7 years ago

priyambaid commented 7 years ago

I am using Beagle bone black hardware and booting from SD card. Also installed Shairport-sync in the BBB. It works fine when I connect USB sound card in the USB host port. But, When I connect external Media player with the BBB using USB cable, Shairport-sync could not redirect the audio output to the external media player.

Can you please suggest some solution to play songs in external media player using shairport-sync?

Thanks & Regards, Manimekala Rajendran

mikebrady commented 7 years ago

Thanks for the post. Perhaps the new device can not accept audio at 44,1000 / 16 bit stereo — maybe it only works at 48,000. Can you post the make and model?

A suggestion is that you look in the log file for any entries made by shairport-sync. It may be necessary to set the log_verbosity to 1 in Shairport Sync’s configuration file.

Also, perhaps you would post the result of executing the command $ shairport-sync -V.

priyambaid commented 7 years ago

Hi Mike, I don't know the configuration of Media Player. It is an external device. I set the value of log_verbosity to 1 and executed the shairport-sync -V command. The following is the output of the $ shairport-sync -V command:

_root@am335x-evm:~# shairport-sync -v
Looking for configuration file at full path "/usr/local/etc/shairport-sync.conf"
alsa output device name is "default".
The processor is running little-endian.
Version: "3.1.3-OpenSSL-Avahi-ALSA-metadata-sysconfdir:/usr/local/etc"
statistics_requester status is 0.
daemon status is 0.
deamon pid file is "/var/run/shairport-sync/shairport-sync.pid".
rtsp listening port is 5000.
udp base port is 6001.
udp port range is 100.
player name is "Nissan Shairport".
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)".
userSuppliedLatency is 0.
AirPlayLatency is -1.
iTunesLatency is -1.
forkedDaapdLatency is -1.
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 0.150000 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.conf" resolves to "/usr/local/etc/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
Unable to listen on IPv4 port 5000. The error is: "Address already in use".
Unable to listen on IPv6 port 5000. The error is: "Address already in use".
fatal error: Could not establish a service on port 5000 -- program terminating. Is another instance of Shairport Sync running on this device?
Request to shut down all rtsp conversation threads
asking playing threads to stop_
mikebrady commented 7 years ago

Thanks — It should have been an uppercase ‘v’, but the information about the version number happens to be there anyway.

If you could try to use the service and then, when it has failed, look in the log for any messages from shairport-sync and post them here, that would be great.

priyambaid commented 7 years ago

I executed the following command to check the status of the shairport-sync: #systemctl status shairport-sync I got the following output:

_[0;1;32m●[[0m shairport-sync.service - Shairport Sync - AirPlay Audio Receive
r
   Loaded: loaded (/lib/systemd/system/shairport-sync.service; enabled; vendor p
reset: enabled)
   Active: [[0;1;32mactive (running)[[0m since Tue 2017-10-10 06:38:56 UTC; 6min
 ago
 Main PID: 873 (shairport-sync)
    Tasks: 9 (limit: 512)
   CGroup: /system.slice/shairport-sync.service
           └─873 /usr/local/bin/shairport-sync

Oct 10 06:45:01 am335x-evm shairport-sync[873]: ALSA lib ../../alsa-lib-1.1.2/sr
c/conf.c:4371:(_snd_config_evaluate) function snd_func_refer returned error: No
such file or directory
Oct 10 06:45:01 am335x-evm shairport-sync[873]: ALSA lib ../../alsa-lib-1.1.2/sr
c/conf.c:4850:(snd_config_expand) Evaluate error: No such file or directory
Oct 10 06:45:01 am335x-evm shairport-sync[873]: ALSA lib ../../../alsa-lib-1.1.2
/src/pcm/pcm.c:2450:(snd_pcm_open_noupdate) Unknown PCM default
Oct 10 06:45:01 am335x-evm shairport-sync[873]: ALSA lib ../../alsa-lib-1.1.2/sr
c/confmisc.c:767:(parse_card) cannot find card '1'
Oct 10 06:45:01 am335x-evm shairport-sync[873]: ALSA lib ../../alsa-lib-1.1.2/sr
c/conf.c:4371:(_snd_config_evaluate) function snd_func_card_driver returned erro
r: No such file or directory_
mikebrady commented 7 years ago

Thanks. It seems that the output device cannot be found – the alsa system can't find it. Could you post the outputs of $ aplay -l and $ aplay -L please? (That's aplay with a lowercase L and an uppercase L respectively.) If aplay isn't installed, try installing the package alas-utils.

priyambaid commented 7 years ago

Thank you very much for your immediate replies. The following is the output for $ aplay -l and $ aplay -L command:

root@am335x-evm:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Black [TI BeagleBone Black], device 0: davinci-mcasp.0-hdmi-hifi.0 hdmi-hifi.0-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

root@am335x-evm:~# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
default:CARD=Black
    TI BeagleBone Black,
    Default Audio Device
sysdefault:CARD=Black
    TI BeagleBone Black,
    Default Audio Device
mikebrady commented 7 years ago

Thanks. Those posts seem to indicate that your external media player is not being recognised by the BeagleBone Black as an audio device at all. In fact, the only device that is showing up using aplay above is the HDMI output. It looks to me like the version of Linux installed on the board does not have a low-level audio driver for your external media player.

There may be one to be found somewhere, but you'd have to figure out how to install it, and I'm afraid that's well outside the scope of Shairport Sync.

If you could plug the external media player into a more complete Linux system, such as Ubuntu running on a laptop, it might be recognised as an audio device. If so, it would establish that an audio driver did exist for it, and it might make it easier to track one down.

priyambaid commented 7 years ago

Thank you