Giter Club home page Giter Club logo

Comments (12)

nimroddolev avatar nimroddolev commented on July 28, 2024

Hi @dbullendsl. I'm sorry to hear you're having issues.

Thank you for the detailed log and the list of your troubleshooting steps!

I think that your issue might be due to an incorrect public mp3 folder path in the integration's configuration.
Can you please check that the public mp3 folder path is a full path and not relative?

You can access the integration's configuration by navigating to Settings --> Devices & services --> Chime TTS --> CONFIGURE

from chime_tts.

dbullendsl avatar dbullendsl commented on July 28, 2024

I thought of that too and did change it at one time to /homeassistant/www/chime_tts I also changed it to /local/chime_tts but that didn't change anything either.

If I manually create the /www/chime_tts folder and drop a known good mp3 into it I can reference it from the outside with a browser.

I've set things back to the default and here's a screen shot.
'''
image
'''
I also noticed that even though the chime_tts.play function isn't expected to run with Amazon devices that it also doesn't produce any mp3 output.

from chime_tts.

nimroddolev avatar nimroddolev commented on July 28, 2024

As I’m not familiar with your setup I can’t know what are the correct paths are but I still think that the lack of mp3 files is due to an issue with the paths, probably for both the service calls.
Note that the MP3s generated from the chime_tts.say service only persist if the cache parameter is set to true.

from chime_tts.

dbullendsl avatar dbullendsl commented on July 28, 2024

ok, I'll check that

from chime_tts.

dbullendsl avatar dbullendsl commented on July 28, 2024

I think I found the problem, by executing the chime_tts:say_url function in the developer's console I get a return result of

url: https://[server.url]/local/chime_tts/zfijllg7.mp3

but I think the result should be https://[server.url]/www/chime_tts/zfijllg7.mp3

Elsewhere in comments in other issues there were instructions to make sure that /local pointed to /media, but that's not a public path for web connections. From running the chime_tts:say fuction with the cache parameter set to true results from the TTS service end up in /media/sounds/temp/chime_tts which is the same as /local/sounds/temp/chime_tts and is not accessible externally. Your code should then move the result to /homeassistant/www/chime_tts which would be accessible as https://[server.url]/www/chime_tts/tts_file.mp3

from chime_tts.

nimroddolev avatar nimroddolev commented on July 28, 2024

You described exactly what the code does (chime_tts.say saves to media and chime_tts.say_url saves to www).
In Home Assistant the www folder is accessible publicly as https://[server.url]/local/ so the URL from your last comment is correct. The issue is that the file is not being saved in the right folder, and therefore cannot be found at that address.
I can confirm that it works correctly in both my docker development environment and my HAOS Raspberry Pi 4 production environment.

It is for these reasons that I feel the problem lies in the public mp3 folder path defined in your configuration.

from chime_tts.

nimroddolev avatar nimroddolev commented on July 28, 2024

Could you please try setting the public mp3 folder path to: /config/www/chime_tts ?

from chime_tts.

dbullendsl avatar dbullendsl commented on July 28, 2024

Excellent! That was it.

the intigration is working and I'm getting the mp3 in the www/chime_tts folder, and can paste the URL into a browser and it'll play.

Amazon is still throwing an error but I've seen that before when the audio file didn't match Amazon's specifications, so it's not a problem with the integration.

If you've got any suggestions on fixing that I'd appreciate it. Can the options field be used to do anything like calling ffmpeg to format the output?

from chime_tts.

nimroddolev avatar nimroddolev commented on July 28, 2024

I’m glad it is now working for you!

I would be happy to add support for encoding with ffmpeg. I can add a checkbox specifically for Amazon’s requirements and also a text field to pass ffmpeg parameters for other use cases.

from chime_tts.

dbullendsl avatar dbullendsl commented on July 28, 2024

That would be great, meanwhile I do have it working using a shell command to ffmpeg with the parameters specified on Amazon's AWS SML page. I'll post everything here soon.

from chime_tts.

dbullendsl avatar dbullendsl commented on July 28, 2024

here's my solution, not completely refined, but it works.
It consists of 3 parts, 2 scripts and a shell command.

The set up looks like this:

Edit configuration.yaml to add the following

# Add ffmpeg to the configuration to format audio
# output to play on Amazon Echos
ffmpeg:

shell_command:
  amazon_level_up: ffmpeg -i '{{input_url}}' -y -ac 2 -codec:a libmp3lame -b:a 48k -ar 16000 -write_xing 0 '{{output_url}}'

the first script calls chime_tts.say_url, then sends the output to the shell command with another script

alias: aa chime
sequence:
  - service: chime_tts.say_url
    data:
      chime_path: bells
      end_chime_path: bells 2
      delay: 0
      final_delay: 0
      tts_playback_speed: 100
      message: "{{message}}"
      tts_platform: google_translate
      cache: false
    response_variable: chime_tts
  - service: script.aa_ffmpeg_convert
    data:
      input_url: "{{chime_tts.url}}"
      output_url: /config/www/chime_tts/output.mp3
  - service: notify.alexa_media
    data:
      message: |
        <audio src="https://[your_server.url]/local/chime_tts/output.mp3"/>
      target:
        - media_player.office_echo_dot
      data:
        type: tts
mode: single
fields:
  message:
    selector:
      text: null
    name: message

second script:

alias: aa ffmpeg_convert
sequence:
  - service: shell_command.amazon_level_up
    data:
      input_url: "{{input_url}}"
      output_url: "{{output_url}}"
mode: single
fields:
  input_url:
    selector:
      text: null
    name: input_url
    required: true
  output_url:
    selector:
      text: null
    name: output_url
    required: true

I probably could have gotten by with one script, but I decided to split out the ffmpeg part in case I needed it for some other use case when sending audio to amazon echoes.

the only variables are the input message and the resultant url supplied by chime_tts.say_url, the output.mp3 from the shell command is overwritten each time it's run so is a fixed name. I'll be changing the inputs so that I can supply the sounds to play before / after the announcements. Haven't tried changing the voice yet, but for now this is it.

Thanks for the assistance, great idea.

from chime_tts.

nimroddolev avatar nimroddolev commented on July 28, 2024

Hey @dbullendsl, I added a new FFmpeg Arguments parameter to the chime_tts.say and chime_tts.say_url services, allowing you to list the conversion parameters you want to use for an FFmpeg conversion on the generated audio:

Screenshot 2023-12-19 at 15 21 34

I created a discussion here, and it would be great if you could please test it out and let me know if it works for your use case.

I created a new beta version with the changes. Please follow these steps to install it:

  1. Open the Chime TTS repository in HACS
  2. Click on the button in the top right
  3. Select the ↻ Redownload option
  4. Enable the Show beta versions option
  5. Select version v0.10.2-beta1 from the updated version drop-down list

from chime_tts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.