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

Successful install, but no audio playing on Homepod #17

Open
sebasjunca opened this issue Dec 26, 2019 · 23 comments
Open

Successful install, but no audio playing on Homepod #17

sebasjunca opened this issue Dec 26, 2019 · 23 comments

Comments

@sebasjunca
Copy link

Hi all! I'm kind of noob here, but I'll try my best.

I have a raspberrypi. 3b+ with homebridge installed. I've followed afaden guide and successfully installed, but when I select the output device, nothing happens, there's no sound.

In terminal (via ssh on a mac), I've found that when running the node index.js the following thing happen:

$ node index.js

listening on *:3000
bluetooth controller exists
a user connected
switch_output: airplay_192.168.0.25_7000
inputStream FromVoid {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: null,
ended: false,
endEmitted: false,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: true,
_events: {},
_eventsCount: 0,
_maxListeners: undefined }
outputStream ToVoid {
_writableState:
WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
bufferedRequestCount: 0,
corkedRequestsFree:
{ next: null,
entry: null,
finish: [Function: bound onCorkedFinish] } },
writable: true,
_events: {},
_eventsCount: 0,
_maxListeners: undefined }
adding device: 192.168.0.25:7000
switch_output: airplay_192.168.0.25_7000
inputStream FromVoid {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: null,
ended: false,
endEmitted: false,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: true,
_events: {},
_eventsCount: 0,
_maxListeners: undefined }
outputStream ToVoid {
_writableState:
WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
bufferedRequestCount: 0,
corkedRequestsFree:
{ next: null,
entry: null,
finish: [Function: bound onCorkedFinish] } },
writable: true,
_events: {},
_eventsCount: 0,
_maxListeners: undefined }
/home/pi/node_airtunes/lib/rtsp.js:385
this.socket.end(this.makeHead('TEARDOWN', '', di) + '\r\n');
^

TypeError: Cannot read property 'end' of null
at Client.sendNextRequest (/home/pi/node_airtunes/lib/rtsp.js:385:17)
at Client.teardown (/home/pi/node_airtunes/lib/rtsp.js:124:8)
at AirTunesDevice.stop (/home/pi/node_airtunes/lib/device_airtunes.js:121:13)
at cleanupCurrentOutput (/home/pi/babelpod/index.js:151:19)
at Socket. (/home/pi/babelpod/index.js:202:5)
at Socket.emit (events.js:180:13)
at /home/pi/babelpod/node_modules/socket.io/lib/socket.js:528:12
at process._tickCallback (internal/process/next_tick.js:112:11)

This happens everytime I select an Airplay device, I've rebooted, made a clean install, and nothing seems to work.

I know on the guide it Says node version 9.8, and the updated installed on the RPI is the 10.x, which in order to install babelpod I had to downgrade to the 9.8.

Does anyone know what might be wrong?

Thanks in advance,

@sebasjunca sebasjunca changed the title Succesfull install, but no audio playing on Homepod Successful install, but no audio playing on Homepod Dec 26, 2019
@dingoosh
Copy link

I’ve been having this issue for months, and I eventually ended up giving in. I limited it down to a problem with AirTunes, and specifically where it calls a method “teardown.” It can’t complete the call completely due to an error, so it aborts. From my understanding, “teardown” deals with making sure proper ports are closed when disconnecting from an AirPlay device. I figured that shouldn’t affect AirTunes’ ability to connect and stream to a device - it should only affect when it attempts to close the connection. So I edited the “tcp” file within AirTunes to not call the “teardown” method, and whaddya know, no errors anymore! The program looks like it operates... but it still won’t connect to an Airplay device, even though it says it does. That’s as far as I was able to make it. I’m not sure why Babelpod/AirTunes doesn’t work anymore, since no edits have been made to the code in years that could cause issues. I even used the same Raspberian stretch version the dev probably would’ve been using with all the same versions of nodejs, etc but still no avail. I think if we want this issue solved, either the dev of Babelpod or AirTunes will have to step in to assist. Hope this helps - cheers.

@johntuesday
Copy link

johntuesday commented Feb 27, 2020

Hey, im having the same issue. Also I'm using the raspberry for the first time and was able to set up everything. I'm able to see me input and output but can not hear anything ;(

@christian-heise
Copy link

same issue here unfortunately

@maexdaemaege
Copy link
Contributor

maexdaemaege commented Apr 19, 2020

Took me a night but I finally figured it out and got it up and running with a Homepod on 13.4 (current version in April 2020). I replaced the node_airtunes package with https://github.com/mcfisto/node_airtunes2. There are a couple of minor things you have to change. I'll fork the project to provide commits as soon as I find the time, but here's what I did, so you can fix it manually:

  1. in mcfisto's package, the module is called AirTunes instead of airtunes. You have to use:
    var AirTunes = require('../node_airtunes2/lib');
    and
    var airtunes = new AirTunes();

  2. if you're on afaden's recommended node version (v.9.8.0), you have to fix a loop in node_airtunes2. Replace line 109 in udp_servers.js with:
    function(cb) { cb(null, to_bind.length > 0); },

  3. decrease the keepalive interval in node_airtunes2 lib/config.js to 30000 or lower

@GrandMaster0 @johntuesday @larxene066 @sebasjunca

@magictaco
Copy link

@maexdaemaege Thanks for the pointers! Updating to airtunes2 got this working briefly (a few seconds) but now I get this message and BabelPod dies with a segfault: compressed frame too big: 11315 vs. 11280

Any suggestions for where to look?

@maexdaemaege
Copy link
Contributor

maexdaemaege commented Apr 22, 2020

I get this message and BabelPod dies with a segfault: compressed frame too big: 11315 vs. 11280

Just did a few minutes of research and it looks like an error from the alac encoder. This might be a related (unfortunately unsolved) issue: openairplay/node_airtunes#22.

It's a bit weird since I can't find the alac implementation in node_airtunes2, even though there's an implementation in openairplay/node_airtunes. Might have been dropped in node_airtunes2. Having that said: I don't have the time to take a deeper look at the moment, so I might miss something here. (Edit: yep, there's a directory called 'alac', I missed it)

Could you provide some information about what you're trying to play? A usb device? Bluetooth? I usually would suggest, that you try and debug with the examples provided in node_airtunes2, but unfortunately all of them are broken. I'll provide fixes as soon as possible.

Edit: I just saw, that you forked node_airtunes2. If you want to try to fix the examples by yourself: use the lame example to begin with.

@magictaco
Copy link

Thanks for looking into this!

Could you provide some information about what you're trying to play? A usb device? Bluetooth?

I'm trying to play through this USB capture card: https://www.amazon.com/gp/product/B079CBGDST

I did see that the error comes from the ALAC Encoder, it seems that it happens when the encoded frame size is larger than expected. I was wondering if this might mean my capture card is sampling at the wrong rate?

I usually would suggest, that you try and debug with the examples provided in node_airtunes2, but unfortunately all of them are broken. I'll provide fixes as soon as possible.

I'm just trying to jump through the hoops to get node_airtunes2 building on my development machine now...

@magictaco
Copy link

magictaco commented May 2, 2020

@maexdaemaege – I'm just getting around to looking into this some more. I've fixed the lame example on my fork.

Edit: Actually the ffmpeg example is working too.

@maexdaemaege
Copy link
Contributor

@magictaco Sweet! Have you had any chance to debug your initial problem with the compressed frames? I also did some commits. Basically just the fixes to get it up and running. I want to work on endpoints for a Shortcut next week, so you don't have to use the browser to change inputs/outputs. That could also enable Siri support, I guess :)

For everyone who's interested in the future: I'm using a Behringer U-Control UCA202. Works like a charm.

@maexdaemaege
Copy link
Contributor

maexdaemaege commented May 4, 2020

@magictaco I did some further improvements. Removed the volume heartbeat, which allows Siri and the HomePod buttons to control the volume again without having it reset by the heartbeat every 30s. Also fixed that Airplay devices showed up multiple times. And some other minor things. https://github.com/maexdaemaege/babelpod

@afaden Are you interested in PRs or is this repo abandoned? Love the project and would like to contribute to it, so that other folks can enjoy BabelPod in the future.

@magictaco
Copy link

magictaco commented May 7, 2020

@maexdaemaege I was finally able to get playback to work consistently by using alsamixer to turn down the gain on my input card. I'm still not sure why that would crash ALAC, but I'm relieved to finally have the setup working!

I'd also be happy to be involved with contributing to the BabelPod project if this repo moves in that direction.

Edit: maybe I was a little quick to declare success... it seems that BabelPod is only streaming to one of my pair of AirPods, so I still have some tinkering to do.

@ghost
Copy link

ghost commented Jul 11, 2020

@magictaco @maexdaemaege I'm still a noob in this, but really want to get that working. I gave up when I got the connection errors (see my Issue #15 )...
In order to get this working, I would follow the readme from @afaden but use the fork from @maexdaemaege instead?
... with the latest OS for the raspberry pi zero w and the latest node.js version. Or is there anything else to consider?
Sorry for asking, but before I start over again, I don't want to miss something. Since I don't own a HomePod I would use an IKEA Symfonisk instead. I guess that's no problem, AirPlay is Airplay.
Thank you!

@pillar-man
Copy link

@traktuner are you trying to use line in or bluetooth as input?

I am trying to get the bluetooth part working, it seems that the bluetootctl node.js wrapper is deprecated, so it wont work properly with bluealsa/bluetoothctl anymore. See also my Issue #19 .

If the answer is the first, the following steps should work for you:

  1. Image: latest Buster lite
  2. sudo apt update && sudo apt upgrade -y
  3. wget https://nodejs.org/dist/v9.8.0/node-v9.8.0-linux-armv6l.tar.xz
  4. sudo mkdir /usr/local/lib/nodejs
  5. sudo tar -xJvf node-v9.8.0-linux-armv6l.tar.xz -C /usr/local/lib/nodejs
  6. sudo mv /usr/local/lib/nodejs/node-v9.8.0-linux-armv6l/ /usr/local/lib/nodejs/node-v9.8.0
  7. nano ~/.profile, add:
# Nodejs
export NODEJS_HOME=/usr/local/lib/nodejs/node-v9.8.0
export PATH=$NODEJS_HOME/bin:$PATH
  1. source ~/.profile
  2. sudo apt install git
  3. git clone https://github.com/maexdaemaege/node_airtunes2
  4. cd node_airtunes2
  5. npm install
  6. cd ..
  7. git clone https://github.com/maexdaemaege/babelpod.git
  8. cd babelpod
  9. npm install
  10. node index.js

After that, switching between Airplay devices does not cause any crashes for me anymore. It does connect properly to the Homepod, but will immediately stop when trying to choose the Apple TV:

switch_output: airplay_192.168.178.46_7000
inputStream FromVoid {
  _readableState:
   ReadableState {
     objectMode: false,
     highWaterMark: 16384,
     buffer: BufferList { head: null, tail: null, length: 0 },
     length: 0,
     pipes: null,
     pipesCount: 0,
     flowing: null,
     ended: false,
     endEmitted: false,
     reading: false,
     sync: true,
     needReadable: false,
     emittedReadable: false,
     readableListening: false,
     resumeScheduled: false,
     destroyed: false,
     defaultEncoding: 'utf8',
     awaitDrain: 0,
     readingMore: false,
     decoder: null,
     encoding: null },
  readable: true,
  _events: {},
  _eventsCount: 0,
  _maxListeners: undefined }
outputStream ToVoid {
  _writableState:
   WritableState {
     objectMode: false,
     highWaterMark: 16384,
     finalCalled: false,
     needDrain: false,
     ending: false,
     ended: false,
     finished: false,
     destroyed: false,
     decodeStrings: true,
     defaultEncoding: 'utf8',
     length: 0,
     writing: false,
     corked: 0,
     sync: true,
     bufferProcessing: false,
     onwrite: [Function: bound onwrite],
     writecb: null,
     writelen: 0,
     bufferedRequest: null,
     lastBufferedRequest: null,
     pendingcb: 0,
     prefinished: false,
     errorEmitted: false,
     bufferedRequestCount: 0,
     corkedRequestsFree:
      { next: null,
        entry: null,
        finish: [Function: bound onCorkedFinish] } },
  writable: true,
  _events: {},
  _eventsCount: 0,
  _maxListeners: undefined }
adding device: 192.168.178.46:7000
airplay status: stopped

@ghost
Copy link

ghost commented Jul 11, 2020

@pillar-man Thank you!!
I will use a Line-In adapter since I want to get my CD player working with AirPlay.
Will try as soon as I have time, thank you so much!

@dingoosh
Copy link

dingoosh commented Aug 9, 2020

For anyone having trouble with the install (since it requires a few extra steps now, and may not work with the latest kernel), I've made a pre-configured Raspbian image with Babelpod already set up. It also comes with a project called HKCam installed and pre-configured - here's more info on it: https://github.com/brutella/hkcam

Anyway, you can download the Raspbian image on my website: https://snyderrepairs.com/2020/08/09/babelpod-hkcam-raspbian-image/

Have fun streaming to your Homepods!

@gabll
Copy link

gabll commented Jan 16, 2021

@maexdaemaege thanks for your improvements and for keeping this project alive! I have the same exact issue that is experiencing @magictaco (some compressed frame too big and then audio interrupts with segmentation fault or malloc(): corrupted top size).
I have a Behringer U-Control UCA202 on a Raspberry3, it should be the same setup that you have. I don't use bluetooth.

I've tried to lower the volume with alsamixer as suggested but I get similar results (it actually depends on the song played by my CD Player but sooner or later it always crashes). Any idea on how to fix this? I understand it's linked to airtunes2 but I can't figure it out. If you can share how you configured the Behringer audio card it may be helpful. Thanks in advance!

EDIT: if anyone is still interested, the error "compressed frame too big" is definitely related to the volume of the input. I have realized that U-Control UCA202 doesn't have any line-in volume/gain control, so I've added a small volume knob before the USB card and the audio isn't interrupted anymore.

@lucashou
Copy link

@larxene066 I have some issue with your image. ( A huge thank you for the wok though )

  1. Bluetooth does not seems to be working
  2. Network connexion is very unstable. Sometimes it's work , then fail couple of minute after , or does not connect at all , or cannot connect after reboot
  3. HKCam does not seems to work :(

Thanks for your help

@kj54321
Copy link

kj54321 commented Feb 3, 2021

Thank you @maexdaemaege . Confirmed works like magic on Ubuntu20.04 laptop.

@snibles
Copy link

snibles commented Feb 8, 2023

@traktuner are you trying to use line in or bluetooth as input?

I am trying to get the bluetooth part working, it seems that the bluetootctl node.js wrapper is deprecated, so it wont work properly with bluealsa/bluetoothctl anymore. See also my Issue #19 .

If the answer is the first, the following steps should work for you:

  1. Image: latest Buster lite
  2. sudo apt update && sudo apt upgrade -y
  3. wget https://nodejs.org/dist/v9.8.0/node-v9.8.0-linux-armv6l.tar.xz
  4. sudo mkdir /usr/local/lib/nodejs
  5. sudo tar -xJvf node-v9.8.0-linux-armv6l.tar.xz -C /usr/local/lib/nodejs
  6. sudo mv /usr/local/lib/nodejs/node-v9.8.0-linux-armv6l/ /usr/local/lib/nodejs/node-v9.8.0
  7. nano ~/.profile, add:
# Nodejs
export NODEJS_HOME=/usr/local/lib/nodejs/node-v9.8.0
export PATH=$NODEJS_HOME/bin:$PATH
  1. source ~/.profile
  2. sudo apt install git
  3. git clone https://github.com/maexdaemaege/node_airtunes2
  4. cd node_airtunes2
  5. npm install
  6. cd ..
  7. git clone https://github.com/maexdaemaege/babelpod.git
  8. cd babelpod
  9. npm install
  10. node index.js

After that, switching between Airplay devices does not cause any crashes for me anymore. It does connect properly to the Homepod, but will immediately stop when trying to choose the Apple TV:

switch_output: airplay_192.168.178.46_7000
inputStream FromVoid {
  _readableState:
   ReadableState {
     objectMode: false,
     highWaterMark: 16384,
     buffer: BufferList { head: null, tail: null, length: 0 },
     length: 0,
     pipes: null,
     pipesCount: 0,
     flowing: null,
     ended: false,
     endEmitted: false,
     reading: false,
     sync: true,
     needReadable: false,
     emittedReadable: false,
     readableListening: false,
     resumeScheduled: false,
     destroyed: false,
     defaultEncoding: 'utf8',
     awaitDrain: 0,
     readingMore: false,
     decoder: null,
     encoding: null },
  readable: true,
  _events: {},
  _eventsCount: 0,
  _maxListeners: undefined }
outputStream ToVoid {
  _writableState:
   WritableState {
     objectMode: false,
     highWaterMark: 16384,
     finalCalled: false,
     needDrain: false,
     ending: false,
     ended: false,
     finished: false,
     destroyed: false,
     decodeStrings: true,
     defaultEncoding: 'utf8',
     length: 0,
     writing: false,
     corked: 0,
     sync: true,
     bufferProcessing: false,
     onwrite: [Function: bound onwrite],
     writecb: null,
     writelen: 0,
     bufferedRequest: null,
     lastBufferedRequest: null,
     pendingcb: 0,
     prefinished: false,
     errorEmitted: false,
     bufferedRequestCount: 0,
     corkedRequestsFree:
      { next: null,
        entry: null,
        finish: [Function: bound onCorkedFinish] } },
  writable: true,
  _events: {},
  _eventsCount: 0,
  _maxListeners: undefined }
adding device: 192.168.178.46:7000
airplay status: stopped

@pillar-man
Any update on this issue? Did you found any solution?
I have the exact same result.
I cannot make Babelpod work. This is so frustrating.
Any help?

@TheMoD22
Copy link

@maexdaemaege :
a lot has been written, some is now 3 years and older. There are some approaches, e.g. from "wrenchpilot" or from you. As a beginner, however, it is difficult to reconcile the different approaches.
Question, can you not even post a complete guide based on the current Raspberry OS, which also works and not only on a Raspberry Pi Zero, but also on a 4b+, 4. etc.. I think this will keep the project alive and you can then recommend it as a working version. The idea that is available here is cool, but unfortunately not working at the moment, at least for me and other beginners

Thanks very much

@maexdaemaege
Copy link
Contributor

@TheMoD22 You're totally right. I'm going to update the readme asap. I might find some time next week.

I've set up a new installation this week myself and with @afaden's latest commit it's so much easier than ever before. It worked out of the box for me. Good timing to update the readme and write a post on reddit.

Setup: RaspberryPi 4b, Behringer U-Control UCA202, HomePod OG (16.6)

@TheMoD22
Copy link

@maexdaemaege Thanks very much

This saves me and others a lot of time and endless troubleshooting, which beginners can't get a grip on. Maybe then I'll understand the respective error messages and the actual interaction.

The Behringer U-Control UCA202 has already been ordered, but it should all run under the 3B+

@TheMoD22
Copy link

@maexdaemaege

moin moin,

since the vacation time is slowly coming to an end, I wanted to ask if you had the time to write the "small" instructions in an updated form. I would like to get this project up and running. There are others waiting for the go so they can start.

Best regards

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

No branches or pull requests