Need help with custom Mp3s and Alexa Media Player

Hey everyone, I’m having some trouble with using custom MP3s with Alexa Media Player. I keep getting “I’m having trouble accessing your simon says now skill right now”
So far I’ve:

  • Checked that regular TTS works, it does
  • Reconfigured the Integration and my public tunnel
  • The mp3s im trying to play have all previously worked so no issues with them format wise
  • redownloaded the v4.12.11 addon from hacs

Here’s the action:

action: notify.alexa_media
data:
  message: <audio src='https://publicip.win/local/audio/music/alarm.mp3'/>
  data:
    type: tts
  target: media_player.bathroom_echo

At this point im a few hours away from completely resetting my ha to see if that will fix it with others reporting its still working for them

here is what works for me:

- service: notify.alexa_media
  data:
    message: "<audio src='https://my_ha.ui.nabu.casa/local/mp3/nws_alert_tone.mp3' />"
    target: media_player.computer_room_dot
    data:
      type: tts

maybe try adding the outer quotes.

DIdn’t work for me, I notice your yaml says service not action, are you on an old version of HA?

yes but it doesn’t matter as service is backwards compatible. you can use either and it will still work the same.

what version of AMP are you using? Also have you done anything to it like replaced cookies or anything like that?

I’m on 4.12.11

I haven’t changed anything at all. It’s just whatever the stock install is.

Are you sure your audio file is accessible over the internet?

you can test that by just pasting your link (https://publicip.win/local/audio/music/alarm.mp3) directly into a browser and it should play. If not then that will be the thing you need to get sorted out first.

Yeah it’s accessible

Then I’m sorry but I’m all out of suggestions.

Just as a dummy check I’m now on the latest versions of both HA and AMP and I tested the service above and it still works as expected. So it doesn’t seem to be a version issue.

Just figured it out. It was a cloudflare location filter.

1 Like

how did you figure this out i’m still having trouble with exactly what you are mentioning.

Well I tried this guys suggestion and it worked for me lo and behold

ffmpeg -y -i az.mp3 -ac 2 -codec:a libmp3lame -b:a 48k -ar 16000 az-converted.mp3

and then

action: notify.alexa_media
data:
  message: <audio src='https://mys3bucket.s3.amazonaws.com/burglar_alarm-converted.mp3' />
  data:
    type: tts
  target: media_player.echo_office
1 Like

This will make it easier for anyone wanting to convert audio for use with alexa media player and home assistant. I whipped this up really quick and I have not tested it with multiple files. It’s just a .bat file and ffmpeg setup to allow drag and drop convertions to the proper settings for alexa media player. it will append _converted to the end of the name of the outputted mp3

https://drive.google.com/file/d/1XVJQy-mBb3bp0Pk-BJ6UAC3G6DO-vh1l/view?usp=sharing

There are some things that Node Red just makes easier.

nodered

ffmpeg -y -i az.mp3 -ac 2 -codec:a libmp3lame -b:a 48k -ar 16000 az-converted.mp3

Been trying to sort this for the last hour growing increasingly frustrated, and this magical simple command just made it all happen instantly. Amazing!! <3

1 Like

Any idea why this won’t work? the mp3 is public

service: notify.alexa_media
data:
  message: <audio src='https://download.samplelib.com/mp3/sample-3s.mp3'/>
  data:
    type: tts
  target: media_player.echo_pop

Ok, after reading a bit, the issue seems the file is not correctly encoded.

  • The bit rate must be 48 kbps. Note that this bit rate gives a good result when used with spoken content, but is generally not a high enough quality for music.
  • The sample rate must be 22050 Hz, 24000 Hz, or 16000 Hz.

All files from here do work TsaTsaTzu Alexa Resources

data:
  message: <audio src='https://s3.amazonaws.com/tsatsatzu-alexa/sound/alarms/ALERTGU.mp3'/>
  data:
    type: tts
  target: media_player.echo_pop
action: notify.alexa_media

Finally got it working.

If you’re using Cloudflare to access your HA then read on.

I set a rule in my Cloudflare firewall to block any requests from outside my country.

The Alexa Skill accesses your domain from the USA. So in my case the request was blocked.

I edited my firewall rule to allow requests if they have the User Agent contains ‘AlexaSkillsKit’ and that fixed the problem.

First test by using sounds from TsaTsaTzu to make sure your sound file is not the problem.

Then convert your own sounds and upload them to your HA ‘www’ folder.

Make sure those are accessible publicly.

Then check Cloudflare, or whatever service you’re using to make sure the firewall isn’t blocking Alexa.

Hope this helps

MyMediaAlexa allows you to play your MP3’s without the limitations. I’m able to play a 3 hour DJ set using it.

Also, Chime_TTS also allows you to play mp3’s to Alexa devices and formats the mp3 within the integration automatically when you enable that option when setting up the chime. :slight_smile:

can you point me to where in cloudflare you did this?