Coder Social home page Coder Social logo

Comments (11)

richtier avatar richtier commented on August 18, 2024

I'm glad you got good results for the first ones :)

Note you do not need the "alexa" prefix when using this tool - Alexa Voice Service assumes that by the point the audio is uploaded the wake word has already occurred. Try removing that and see if that helps.

Can you please share two of the affected wav files so I can debug. Thanks.

from alexa-voice-service-client.

theodorehu95 avatar theodorehu95 commented on August 18, 2024

I tried to remove the "Alexa", it didn't help. Actually, it's worse. Only 5 of them give a legit response now.

Here is the link to all the audio files https://drive.google.com/drive/folders/1GQ_XM5P2-qz5SGMhG6rhJn-RjyS0V8BB?usp=sharing

from alexa-voice-service-client.

richtier avatar richtier commented on August 18, 2024

for "heads up" I get the response "hmm. I do not know that one"

for "twenty questions" it says "here's twenty questions from the games trivia..."

so for me the response is not empty.

what does your code look like? mine looks like this:

alexa_client = AlexaVoiceServiceClient(
    client_id='...',
    secret='...',
    refresh_token='...',
)
alexa_client.connect()  # authenticate and other handshaking steps
with open('/home/richtier/Downloads/test.wav', 'rb') as f:
    alexa_response_audio = alexa_client.send_audio_file(f)
with open('./output.wav', 'wb') as f:
    f.write(alexa_response_audio)

from alexa-voice-service-client.

theodorehu95 avatar theodorehu95 commented on August 18, 2024

I wrote a wrapper for a client.

For
1f8f273eea381aad4bbd8aa9f563409b.wav: "Open Heads Up! and play Superstars",
548d7b9c60a699410f23168e48e52285.wav: "Play Geo Quiz",
e96466b699d20f65d8d147d751c00379.wav: "Ask Baby Groot what time is it",

My response are just empty.

Others give me legit response.

When I test with the Alexa test tools. I type "Ask baby groot what time is it". Following are the response. Is it possible that this implementation only receives the first response, but sometimes Alexa returns several response for just one question. The same with "Play Geo Quiz"

image
image

from avs_client import AlexaVoiceServiceClient

class Alexa:
    def __init__(self, product_id, client_id, client_secret, refresh_token):
        self.product_id = product_id
        self.client_id = client_id
        self.client_secret = client_secret
        self.refresh_token = refresh_token
        self.alexa_client = AlexaVoiceServiceClient(self.client_id, self.client_secret, self.refresh_token)
        self.alexa_client.connect()

    def talk(self, voice_path, response_path=None):
        with open(voice_path, 'rb') as f:
            alexa_response_audio = self.alexa_client.send_audio_file(f)
        
        if response_path is not None and alexa_response_audio is not None:
            with open(response_path, 'wb') as f:
                f.write(alexa_response_audio)
            print('Saved')
        else:
            print('Not Saved')

from alexa-voice-service-client.

richtier avatar richtier commented on August 18, 2024

ah yes - the client does not support multiple responses yet. It currently just returns the first one.

you can stick a breakpoint here to see if this is the cause: check what parsed.parts contains.

from alexa-voice-service-client.

theodorehu95 avatar theodorehu95 commented on August 18, 2024

Let me try to work on it. Not sure if Hyper supports Server Push now.

from alexa-voice-service-client.

richtier avatar richtier commented on August 18, 2024

requirements.txt pins Hyper to a specific version, so we're unaffected by removal of breaking changes in future versions of Hyper.

from alexa-voice-service-client.

richtier avatar richtier commented on August 18, 2024

@bayescram any progress debugging this?

from alexa-voice-service-client.

theodorehu95 avatar theodorehu95 commented on August 18, 2024

This problem is because this implementation only receives 1 response. I made some changes around the breakpoint you made. Basically, accept all responses and return a list.

from alexa-voice-service-client.

richtier avatar richtier commented on August 18, 2024

That's great, thanks. I've left some comments on the Pull Request. Let me know if you need assistance with the points raised in the feedback.

from alexa-voice-service-client.

richtier avatar richtier commented on August 18, 2024

multiple audio responses are now supported

with latest version you can do

from avs_client import AlexaVoiceServiceClient

alexa_client = AlexaVoiceServiceClient(
    client_id='my-client-id',
    secret='my-secret',
    refresh_token='my-refresh-token',
)
alexa_client.connect()  # authenticate and other handshaking steps
with open('./tests/resources/alexa_play_twenty_questions.wav', 'rb') as f:
    for directive in alexa_client.send_audio_file(f):
        if directive.name == 'Speak':
            with open(f'./{directive.content_id}.mp3', 'wb') as f:
                f.write(directive.audio_attachment)

from alexa-voice-service-client.

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.