Announcement

Collapse
No announcement yet.

Need help getting mono mp3 speech file to play through AirplaySpeaker

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Need help getting mono mp3 speech file to play through AirplaySpeaker

    I've been working on using Amazon Polly to do speech on HS3. My system is a Pi 3B running HS3 Standard. Amazon Polly produces mono mp3 files encoded at 22,050Hz. I convert that to 44,100 Hz stereo using the following command.
    avconv -i "$1_t" -y -ar 44100 -ac 2 "$1"
    The only difference between this and when using flite is the added -ac 2 to make sure the mono file is converted to stereo. Local playback using speak.sh is done using mpg123 and that work great as does sound sent to HSTouch.

    The only thing that's not working is getting sound to my Mac. The mac is running 5KPlayer which will act as an Airplay receiver. I have no issues sending music from my iPhone to my Mac running the 5KPlayer.

    AirplaySpeak does see the Mac and thinks it an AppleTV which is correct for the 5KPlayer.

    Here is the results from the AirplaySpeak log.
    This is when it connects to the 5KPlayer
    Code:
    Jun-25 18:52:16 INFO Found Service: 787B8AC27D69@Lucas
    Jun-25 18:52:16 INFO Resolved Service: 787B8AC27D69 - Lucas - 10.0.2.21 - 5004
    Jun-25 18:52:16 DEBUG TXT Records = 
    Jun-25 18:52:16 DEBUG am = 'AppleTV3,2'
    Jun-25 18:52:16 DEBUG da = 'true'
    Jun-25 18:52:16 DEBUG et = '0,3,5'
    Jun-25 18:52:16 DEBUG sf = '0x4'
    Jun-25 18:52:16 DEBUG ss = '16'
    Jun-25 18:52:16 DEBUG tp = 'UDP'
    Jun-25 18:52:16 DEBUG vv = '2'
    Jun-25 18:52:16 DEBUG txtvers = '1'
    Jun-25 18:52:16 DEBUG md = '0,1,2'
    Jun-25 18:52:16 DEBUG vn = '65537'
    Jun-25 18:52:16 DEBUG vs = '220.68'
    Jun-25 18:52:16 DEBUG sv = 'false'
    Jun-25 18:52:16 DEBUG ch = '2'
    Jun-25 18:52:16 DEBUG pk = '482131eacf7e006792da125540724283fb3f2ba6a25cabe13b5f1543b3b234bd'
    Jun-25 18:52:16 DEBUG sr = '44100'
    Jun-25 18:52:16 DEBUG ft = '0x5A7FFFF7,0x1E'
    Jun-25 18:52:16 DEBUG cn = '1,3'
    This is when it trys to play speech.

    Code:
    Jun-25 18:54:28 DEBUG calling SpeakToFile text=<speak>MAY I HAVE YOUR ATTENTION PLEASE<break time="300ms"/> The Outside Gate has been closed.</speak> file=/home/pi/HomeSeer/Temp/AirplaySpeak20180625185428962.wav
    Jun-25 18:54:30 INFO (Lucas): <speak>MAY I HAVE YOUR ATTENTION PLEASE<break time="300ms"/> The Outside Gate has been closed.</speak>
    Jun-25 18:54:30 DEBUG Start sleep
    Jun-25 18:54:30 DEBUG 581 Speaker.Reset()
    Jun-25 18:54:30 DEBUG 581 Speaker.Reset() gets the lock
    Jun-25 18:54:30 DEBUG End sleep
    Jun-25 18:54:30 DEBUG ANNOUNCE rtsp://10.0.2.43/1079979903 RTSP/1.0
    CSeq: 1
    Content-Type: application/sdp
    Content-Length: 176
    User-Agent: iTunes/7.6.2 ( Windows;N;)
    Client-Instance: 8FE95CFF71C50DB2
    
    v=0
    o=iTunes 1079979903 0 IN IP4 10.0.2.43
    s=iTunes
    c=IN IP4 10.0.2.21
    t=0 0
    m=audio 0 RTP/AVP 96
    a=rtpmap:96 AppleLossless
    a=fmtp:96 352 0 16 40 10 14 2 255 0 0 44100
    
    Jun-25 18:54:35 DEBUG CSeq, 1
    Jun-25 18:54:35 DEBUG Server, AirTunes/230.33
    Jun-25 18:54:35 DEBUG Apple-Jack-Status, connected; type=analog
    Jun-25 18:54:35 DEBUG SETUP rtsp://10.0.2.43/1079979903 RTSP/1.0
    CSeq: 2
    Transport: RTP/AVP/UDP;unicast;interleaved=0-1;mode=record;control_port=48545;timing_port=60161
    User-Agent: iTunes/7.6.2 ( Windows;N;)
    Client-Instance: 8FE95CFF71C50DB2
    
    
    Jun-25 18:54:35 DEBUG CSeq, 2
    Jun-25 18:54:35 DEBUG Server, AirTunes/230.33
    Jun-25 18:54:35 DEBUG Apple-Jack-Status, connected; type=analog
    Jun-25 18:54:35 INFO Connection to Lucas (10.0.2.21:5004) failed: SETUP: no session in response
    Jun-25 18:54:35 DEBUG Stack:   at RTSPClient.Setup (System.Int32 controlport, System.Int32 timingport) [0x00070] in <b2f4575dd15646579fe26d0a3053b5ce>:0 
      at RAOPClient.Connect () [0x00342] in <b2f4575dd15646579fe26d0a3053b5ce>:0 
      at HSPI_AIRPLAY_SPEAK.Speaker.Reset () [0x000fd] in <b2f4575dd15646579fe26d0a3053b5ce>:0 
    Jun-25 18:54:35 DEBUG 581 Speaker.BeforeSend()
    Jun-25 18:54:35 DEBUG 581 Speaker.SendSample()
    Jun-25 18:54:35 DEBUG 581 Speaker.SendSample() gets lock
    Jun-25 18:54:35 DEBUG 581 Speaker.AfterSend()
    All my Pi's are tied up right now so I can't run Airplay for the Pi which I know works. If everything looks OK then I guess I'll just have to wait till I pickup a Pi Zero and the speaker pHAT and bring up Airplay for the Pi.
    Last edited by Timon; July 2, 2018, 06:03 PM.
    HomeSeer Version: HS3 Standard Edition 3.0.0.548
    Linux version: Linux auto 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
    Number of Devices: 484 | Number of Events: 776

    Enabled Plug-Ins: 3.0.0.13: AirplaySpeak | 2.0.61.0: BLBackup
    3.0.0.70: EasyTrigger | 1.3.7006.42100: LiftMaster MyQ
    4.2.3.0: mcsMQTT | 3.0.0.53: PHLocation2 | 0.0.0.47: Pushover 3P
    3.0.0.16: RaspberryIO | 3.0.1.262: Z-Wave

    Z-Net version: 1.0.23 for Inclusion Nodes
    SmartStick+: 6.04 (ZDK 6.81.3) on Server

    #2
    Looks like this is a problem with the 5KPlayer. It works fine using the Airplay app and the Pimoroni SpeakerpHat.

    BTW, is you use the SPeakerpHAT DON'T use the speaker that comes with it. Fine a good 2 to 5W speaker and use it. The one that comes with it sounds like s&*$ to put it bluntly.

    I'm using an old no amplified PC speaker and it should very good all things considered. I'm going to open it up and put the Pi Zero W inside for a nice clean package. You can also pick up some cheep bookshelf speakers and use them. If you want stereo Pimoroni has other pHAT and HATs for the Pi you can use as well.
    HomeSeer Version: HS3 Standard Edition 3.0.0.548
    Linux version: Linux auto 4.15.0-72-generic #81-Ubuntu SMP Tue Nov 26 12:20:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
    Number of Devices: 484 | Number of Events: 776

    Enabled Plug-Ins: 3.0.0.13: AirplaySpeak | 2.0.61.0: BLBackup
    3.0.0.70: EasyTrigger | 1.3.7006.42100: LiftMaster MyQ
    4.2.3.0: mcsMQTT | 3.0.0.53: PHLocation2 | 0.0.0.47: Pushover 3P
    3.0.0.16: RaspberryIO | 3.0.1.262: Z-Wave

    Z-Net version: 1.0.23 for Inclusion Nodes
    SmartStick+: 6.04 (ZDK 6.81.3) on Server

    Comment

    Working...
    X