PeteManchester / MediaPlayer

61 stars 20 forks source link

Issues with Linn Kazoo. #34

Closed Ghuru42 closed 9 years ago

Ghuru42 commented 9 years ago

First, great work! found this project today and it just so good! Been working on upmpdcli for a couple of weeks but been hitting one wall after another with issues when used with Kinsky or Kazoo. MediaPlayer is just way better!

I'm using this on a raspberry B+ with the Hifiberry Digi+ card and mpd as a player. Playback via upnp works perfect, but as always there are a few issues. :-)

I will use a DSP for among other volume control. That device will be the master volume. I can send up/down to it so that should be easy to use the Lirc plugin and just use a different cmd line argument. But I also want to return the current volume level back to the upnp client.. Just as it works when mpd returns volume level. So I need a way to give the "lirc plugin" the current volume so it can create the volume event back to upnp clients. Could this be added??

PeteManchester commented 9 years ago

Hi, Thanks for the feedback...

I managed to get custom inputs to show in Kazoo.. See the last post in this thread.. http://forums.linn.co.uk/bb/showthread.php?tid=26969&page=2&highlight=NetAux

    <Source>
        <name>Laptop</name>
        <type>Analog</type>
        <GPIO_PIN>5</GPIO_PIN>
    </Source>

    <Source>
        <name>Home PC</name>
        <type>Analog</type>
        <GPIO_PIN>6</GPIO_PIN>
    </Source>

When Kazoo cannot see the source can Kinksy see the source?

For the Source 'upnp' you can name this in the InputSources.xml

    <Source>
        <name>Study (Pete)</name>
        <type>UpnpAv</type>
        <visible>false</visible>
        <GPIO_PIN>9</GPIO_PIN>
    </Source>

For the Airplay/Songcast issue, if possible can you send me a log file (debug log level) from startup where you attempt to play Songcast or Airplay..

How would we get the current volume from the DSP?

Thanks again,

Pete.

Ghuru42 commented 9 years ago

Hi.

See note bellow.

I managed to get custom inputs to show in Kazoo.. See the last post in this thread.. http://forums.linn.co.uk/bb/showthread.php?tid=26969&page=2&highlight=NetAux http://forums.linn.co.uk/bb/showthread.php?tid=26969&page=2&highlight=NetAux

Laptop Analog 5
<Source>
    <name>Home PC</name>
    <type>Analog</type>
    <GPIO_PIN>6</GPIO_PIN>
</Source>

Will test this tonight, I think I named it ”digital” and kazoo wants ”Digital”, might be that simple. When Kazoo cannot see the source can Kinksy see the source?

Yes, Kinsky just displays everything as is.. For the Source 'upnp' you can name this in the InputSources.xml

<Source>
    <name>Study (Pete)</name>
    <type>UpnpAv</type>
    <visible>false</visible>
    <GPIO_PIN>9</GPIO_PIN>
</Source>

Ahh, nice, will test this tonight as well. For the Airplay/Songcast issue, if possible can you send me a log file (debug log level) from startup where you attempt to play Songcast or Airplay..

I can send you logs for airplay tonight. A customer bought the Linn DS so will go down to our demo room as soon as I can and test it. How would we get the current volume from the DSP?

The DSP has a USB port that works as a USB HID device. I have a documentation from the manufacturer on how to set the volume and query the volume. There are also other functions I want to control on this device, such as switching between the two inputs and selecting which dsp config should be active. My thought so far is to just make a two part sw for handling this, one is a deamon that handles the communication and also can expose the usb port to the network. The other is a small cmd line utility that can be used to send or query values. Using that cmd line utility would be simple with the LIRC plugin.

Thanx for a great software!

/Johan

Ghuru42 commented 9 years ago

Here is a link to the log for an airplay session. https://www.dropbox.com/s/2ya3aee956n9r6s/mediaplayer.log.gz?dl=0

This is on a B+ with the hifiberry Digi+ card, using an all digital amp via spdif.

Ghuru42 commented 9 years ago

Source inputs works fine with Kazoo now, had it named digital instead of Digital.

UpnpAV worked as well, but kazoo shows this "source" as a main tile instead of under "inputs" so will keep it with the wrong name, that way kazoo don't show it at all.

Is there a source name for airplay and songcast? So I can get a GPIO signal when any of these are active?

PeteManchester commented 9 years ago

Hi,

For the input sources for Songcast and Airplay try this..

<Source>
    <name>Songcast</name>
    <type>Receiver</type>
    <GPIO_PIN>9</GPIO_PIN>
</Source>

<Source>
    <name>AirPlay</name>
    <type>NetAux</type>
    <visible>false</visible>
    <GPIO_PIN>9</GPIO_PIN>
</Source>
PeteManchester commented 9 years ago

Hi,

For the Airplay, I've had a quick look at the logs and seem some strange things but at the moment i don't know why the occur..

I'm comparing your iPhone 5 ios8.1 to my iPad ios 8.1 so it should be similar... The are both using AirPlay/211.2

User-Agent: AirPlay/211.2

In your log I see the Annoucne Request, then Setup, Record, SetParameter then Flush requests, the same as my event sequence..

But then in your log the Flush request is sent every few seconds..

Your soundcard is identified as ###Setting Sound Card Name: #sndrpihifiberry [plughw:0,0] Which is think is correct..

It looks like the packets are being decoded correctly because we get this message at the start

2014-11-06 21:32:10,749 [nioEventLoopGroup-4-1] DEBUG [org.rpi.airplay.AudioDecrpyt] Missed a Frame: 65443 Last Frame: 0 65442

And when we get a flush request there are packets in the queue that are cleared

2014-11-06 21:32:27,229 [nioEventLoopGroup-3-1] INFO [org.rpi.java.sound.JavaSoundPlayerLatency] Clearing Work Queue. Number of Items: 289 2014-11-06 21:32:27,230 [nioEventLoopGroup-3-1] INFO [org.rpi.java.sound.JavaSoundPlayerLatency] WorkQueue Cleared

It's not very scientific ,but could you try some of the following:

Using top monitor the cpu usage when Airplay starts, it will spike because the encryption library uses a lot of CPU, but it should drop down again.

Stripping back your raspi to just use the default soundcard//headphone jack, to see if that makes a difference (temporary test)

It looks like you are using the ethernet port for the raspi which is fine, is your wifi ok? Can you test Airplay from a PC rather than iPhone?

Thanks,

Pete.

Ghuru42 commented 9 years ago

Your soundcard is identified as

Setting Sound Card Name: #sndrpihifiberry [plughw:0,0]

Which is think is correct..

Yepp, that is correct, or should be.. The internal bcm sound card is disabled so the only card in the system is the hifiberry.

It looks like the packets are being decoded correctly because we get this message at the start

Once it plays it seam to work ok, it’s just at the start, stop and jumping tracks that makes for klicks and glitches in the speakers.. One thing that might help is to have a ”hold back” time between opening the soundcard and starting playback. As well as holding on to the soundcard for a few seconds after playback… Using top monitor the cpu usage when Airplay starts, it will spike because the encryption library uses a lot of CPU, but it should drop down again.

No playback: 96-100% idle Upnp: (mpd is set to high quality resample..) 44.1Khz 16bit, 50% idle 192Khz, 24bit, 30% idle Airplay: 4 0 0 219368 9980 108536 0 0 0 0 343 115 1 0 99 0 5 0 0 219368 9980 108536 0 0 0 0 395 143 52 1 47 0 6 0 0 219336 9980 108536 0 0 0 0 399 127 52 1 47 0 5 0 0 219344 9980 108536 0 0 0 0 809 936 54 4 42 0 5 0 0 219344 9980 108536 0 0 0 0 1309 1925 40 7 53 0 6 0 0 219248 9980 108536 0 0 0 0 1274 1855 45 5 50 0 5 0 0 219344 9980 108536 0 0 0 0 1357 1937 39 10 51 0 6 0 0 219344 9980 108536 0 0 0 0 1370 1928 37 10 54 0 5 0 0 219344 9980 108536 0 0 0 0 1354 1903 39 7 54 0 5 0 0 219344 9980 108536 0 0 0 0 1360 1893 42 6 52 0 6 0 0 219280 9980 108536 0 0 0 0 1359 1901 40 6 54 0 5 0 0 219344 9980 108536 0 0 0 0 1352 1886 38 8 54 0 6 0 0 219312 9980 108536 0 0 0 0 1338 1973 17 4 79 0 5 0 0 219344 9980 108536 0 0 0 0 1309 1959 22 7 71 0 4 0 0 219344 9980 108536 0 0 0 0 1361 1984 17 9 74 0 5 0 0 219344 9980 108536 0 0 0 0 1360 1966 20 6 73 0 0 0 0 219368 9980 108540 0 0 3 0 353 143 2 1 97 0 0 0 0 219368 9980 108540 0 0 0 0 342 136 0 1 99 0 99% is just before I activate Airplay on the phone. Start a song, glitches, music, stop, glitches and then deselect airplay. Nothing strange there as I see it :-) Stripping back your raspi to just use the default soundcard//headphone jack, to see if that makes a difference (temporary test)

Will try it this asap.. Just need to get an analog amp :-) or find a cheep a/d converter to test with..

I will do a recording and send you just how it sound, might make it easier to understand whats going on.

It looks like you are using the ethernet port for the raspi which is fine, is your wifi ok? Can you test Airplay from a PC rather than iPhone?

Yepp, the raspberry is on ethernet. My Wifi is right now an airport express on 5Ghz, gives me around 80Mbit of true bandwidth. Airplay works fine to the Airport express, AppleTv and XBMC.

PeteManchester commented 9 years ago

Ah yes, I see what you mean. At the start of Airplay the sound is very rough as the CPU settles down. The encrypt/decrpty libs take a lot of cpu at the start. Which is one reason why I run them when mediaplayer first starts, which helps but doesn't completely solve the issue. I take on board what you say about delaying the audio for a few seconds, probably a better experience for the listener, although they may wonder what is happening..

Airplay uses more CPU than Songcast because I have to decrypt each packet from Airplay.

Cheers,

Pete.

PeteManchester commented 9 years ago

Hi,

I made some changes to MediaPlayer and the CustomInputSource Plugin.

The beta MediaPlayer can be downloaded here https://github.com/PeteManchester/MediaPlayer/tree/master/com.upnp.mediaplayer/download/beta

The changes I made are: If an Analog source is selected, mediaplayer will stop playing it's current source. When MediaPlayer goes into Standby state all input pins will go low There is a configurable pin for the standby state, low whilst in standby, high when not in standby (see Wiki) Mediaplayer will come out of the standby state when playing a track.

Cheers,

Pete.

Ghuru42 commented 9 years ago

Hi.

I’m back again, at last.. Been way to many other things going on so have had no time to work on this.

But:

Java is:


root@gplayer:/usr/local/bin# java -version java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) Client VM (build 25.0-b70, mixed mode)


From this:

But.

Airplay: I have not tested the analog (3.5mm) output, only the hdmi and digi+. Digi+ gives some scrap noice, then silence. Hdmi nothing. With both Digi+ and Hdmi enabled the Digi shows up as plughw:0,0 and the hdmi as hw:1,1. Setting mpd to use hw:1,1 gives full sound for upnp music, but still no airplay, tried all hw: and plughw: combos.. Debug log dont seam to indicate anything wrong from what I can see. Any suggestions on how to proceed?

gpio: Is anything else needed than wireing pi? It’s installed as described on the wireing pi homepage. The gpio worked on the B+ but I cant remember if I installed any additional software for it to work. gpio util on the cmd line works for the led,s and they use the same numbering as on the B+.

Cheers, Johan

13 nov 2014 kl. 16:19 skrev PeteManchester notifications@github.com:

Hi,

I made some changes to MediaPlayer and the CustomInputSource Plugin.

The beta MediaPlayer can be downloaded here https://github.com/PeteManchester/MediaPlayer/tree/master/com.upnp.mediaplayer/download/beta https://github.com/PeteManchester/MediaPlayer/tree/master/com.upnp.mediaplayer/download/beta The changes I made are: If an Analog source is selected, mediaplayer will stop playing it's current source. When MediaPlayer goes into Standby state all input pins will go low There is a configurable pin for the standby state, low whilst in standby, high when not in standby (see Wiki) Mediaplayer will come out of the standby state when playing a track.

Cheers,

Pete.

— Reply to this email directly or view it on GitHub https://github.com/PeteManchester/MediaPlayer/issues/34#issuecomment-62905218.

Ghuru42 commented 9 years ago

Did some more tests.

Noticed the java was pointing to v8, fixed so that mediaplayer runs with v7 oracle-java7 as per web info.

Booted the new SD card on a B+ board, without the Digi+ board, and removed the dtoverlay param in config.

Got both HDMI and 3,5mm output connected. mpd is set to hw:0,0, plays fine, outputs on hdmi port. mediaplayer is set to plughw:0,0 (also tried hw:0,0) Still no sound from MacBook, iPhone or iPad for airplay.

I laso tried to shutdown mpd, just to test that the soundcard was not busy for any other reason.

/J

21 mar 2015 kl. 22:30 skrev Johan Winäs johan@databeredning.se:

Airplay: I have not tested the analog (3.5mm) output, only the hdmi and digi+. Digi+ gives some scrap noice, then silence. Hdmi nothing. With both Digi+ and Hdmi enabled the Digi shows up as plughw:0,0 and the hdmi as hw:1,1. Setting mpd to use hw:1,1 gives full sound for upnp music, but still no airplay, tried all hw: and plughw: combos.. Debug log dont seam to indicate anything wrong from what I can see. Any suggestions on how to proceed?

PeteManchester commented 9 years ago

Hi Johan,

Can you send me your

app.proprties file A clean log file from startup where you attemp to AirPlay, set the log level to debug

Cheers,

Pete

On Sunday, March 22, 2015, Ghuru42 notifications@github.com wrote:

Did some more tests.

Noticed the java was pointing to v8, fixed so that mediaplayer runs with v7 oracle-java7 as per web info.

Booted the new SD card on a B+ board, without the Digi+ board, and removed the dtoverlay param in config.

Got both HDMI and 3,5mm output connected. mpd is set to hw:0,0, plays fine, outputs on hdmi port. mediaplayer is set to plughw:0,0 (also tried hw:0,0) Still no sound from MacBook, iPhone or iPad for airplay.

I laso tried to shutdown mpd, just to test that the soundcard was not busy for any other reason.

/J

21 mar 2015 kl. 22:30 skrev Johan Winäs <johan@databeredning.se javascript:_e(%7B%7D,'cvml','johan@databeredning.se');>:

Airplay: I have not tested the analog (3.5mm) output, only the hdmi and digi+. Digi+ gives some scrap noice, then silence. Hdmi nothing. With both Digi+ and Hdmi enabled the Digi shows up as plughw:0,0 and the hdmi as hw:1,1. Setting mpd to use hw:1,1 gives full sound for upnp music, but still no airplay, tried all hw: and plughw: combos.. Debug log dont seam to indicate anything wrong from what I can see. Any suggestions on how to proceed?

— Reply to this email directly or view it on GitHub https://github.com/PeteManchester/MediaPlayer/issues/34#issuecomment-84563863 .

Ghuru42 commented 9 years ago

Se attached files.

run.sh is modified, se attached.

debug.log has:

22 mar 2015 kl. 10:42 skrev PeteManchester notifications@github.com:

Hi Johan,

Can you send me your

app.proprties file A clean log file from startup where you attemp to AirPlay, set the log level to debug

Cheers,

Pete

On Sunday, March 22, 2015, Ghuru42 notifications@github.com wrote:

Did some more tests.

Noticed the java was pointing to v8, fixed so that mediaplayer runs with v7 oracle-java7 as per web info.

Booted the new SD card on a B+ board, without the Digi+ board, and removed the dtoverlay param in config.

Got both HDMI and 3,5mm output connected. mpd is set to hw:0,0, plays fine, outputs on hdmi port. mediaplayer is set to plughw:0,0 (also tried hw:0,0) Still no sound from MacBook, iPhone or iPad for airplay.

I laso tried to shutdown mpd, just to test that the soundcard was not busy for any other reason.

/J

21 mar 2015 kl. 22:30 skrev Johan Winäs <johan@databeredning.se javascript:_e(%7B%7D,'cvml','johan@databeredning.se');>:

Airplay: I have not tested the analog (3.5mm) output, only the hdmi and digi+. Digi+ gives some scrap noice, then silence. Hdmi nothing. With both Digi+ and Hdmi enabled the Digi shows up as plughw:0,0 and the hdmi as hw:1,1. Setting mpd to use hw:1,1 gives full sound for upnp music, but still no airplay, tried all hw: and plughw: combos.. Debug log dont seam to indicate anything wrong from what I can see. Any suggestions on how to proceed?

— Reply to this email directly or view it on GitHub https://github.com/PeteManchester/MediaPlayer/issues/34#issuecomment-84563863 .

— Reply to this email directly or view it on GitHub https://github.com/PeteManchester/MediaPlayer/issues/34#issuecomment-84575524.