MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Yet Another Voice Module (Sphinx + Alexa)

    Scheduled Pinned Locked Moved Development
    40 Posts 6 Posters 37.6k Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W Offline
      whyjustin
      last edited by

      I went to that directory and the files do exist. I used the script to generate them. My understanding is sphinx is working but there’s something wrong with the alexa part.

      From the logs this seems to be true. Thanks for the log, it makes debugging much easier. As mentioned in OP, my life is pretty hectic right now. I’m hoping to have some chance to look into this over the next week but may not be able to provide the optimal feedback cycle for you. Thanks for the patience.

      1 Reply Last reply Reply Quote 0
      • W Offline
        whyjustin @d3r
        last edited by

        @d3r said in Yet Another Voice Module (Sphinx + Alexa):

        Unable to run Alexa Java Client: Error: ENOENT: no such file or directory, open './magic-mirror-voice/alexa-certificate-generator/certs/server/node.key

        Do you have the optional sslKey entry in the config? If you are autogenerating all the keys, I would remove all the //optional values from the ssl configuration. May be a red herring but all I can think of w/o my computer.

        D 1 Reply Last reply Reply Quote 0
        • D Offline
          d3r @whyjustin
          last edited by

          @whyjustin Thank you. I understand you’re pretty busy with your familly so no rush.

          You were correct about the optional ssl. I commented it out and was able to get to the alexa registering part
          Register Alexa Java Client by navigating to https://localhost:5555/provision/143d3e3b67c6577291228ff9
          Now the problem is that the module is not registering. I cannot connect to that link if I put it in a browser. Also, I think it should be localhost:3000/provision/... because that’s how the alexa standalone app registration works but I could be wrong.
          I played around with the config.
          port: 5555,
          serviceUrl: ‘https://localhost:5555’, // if I change this to port 3000 I get an error /
          redirectUrl: ‘https://localhost:3000/authresponse’, // changing this port still returns https://localhost:5555/provision/143d3e3b67c6577291228ff

          Again no rush, this can wait.

          1 Reply Last reply Reply Quote 0
          • W Offline
            whyjustin
            last edited by

            Now the problem is that the module is not registering. I cannot connect to that link if I put it in a browser.

            This is a long shot since you’ve setup Alexa already, but are you using a browser on the pi to connect to the site? If not you would have to replace localhost with the pi’s IP/Hostname

            Also, I think it should be localhost:3000/provision/… because that’s how the alexa standalone app registration works but I could be wrong.

            The oauth service can run on any port, I believe that 3000 may been taken by another process on my raspberry pi (either by Magic Mirror or something else) which is I why I used 5555. I think there is some redundancy in the three options (port/serviceUrl/redirectUrl) but it is required to keep the same port and hostname on all three. If you choose to keep 5555, you will have to update the Alexa settings that you previously set up to indicate the proper port:

            https://github.com/alexa/alexa-avs-raspberry-pi/blob/master/assets/avs-web-settings-filled.png

            D 1 Reply Last reply Reply Quote 1
            • D Offline
              d3r @whyjustin
              last edited by

              @whyjustin said in Yet Another Voice Module (Sphinx + Alexa):

              The oauth service can run on any port, I believe that 3000 may been taken by another process on my raspberry pi (either by Magic Mirror or something else) which is I why I used 5555. I think there is some redundancy in the three options (port/serviceUrl/redirectUrl) but it is required to keep the same port and hostname on all three. If you choose to keep 5555, you will have to update the Alexa settings that you previously set up to indicate the proper port:
              https://github.com/alexa/alexa-avs-raspberry-pi/blob/master/assets/avs-web-settings-filled.png

              Thank you.
              Changed the port on the amazon website and I got it to work.
              Your module is awesome! This is really good.

              W 1 Reply Last reply Reply Quote 0
              • W Offline
                whyjustin @d3r
                last edited by

                @d3r said in Yet Another Voice Module (Sphinx + Alexa):

                Your module is awesome! This is really good.

                Thanks, good to hear it’s working. Let me know if you have any other difficulties or feature requests. As mentioned to @cowboysdude, it is easiest for me to track these through GitHub Issues. Cheers.

                1 Reply Last reply Reply Quote 0
                • C Offline
                  clumsy_ninja
                  last edited by

                  @whyjustin What kind of visual feedback does it display on the mirror?

                  D 1 Reply Last reply Reply Quote 0
                  • D Offline
                    d3r @clumsy_ninja
                    last edited by

                    @clumsy_ninja This module has no visual feedback. You only get an audio prompt which indicates that alexa is listening and a second audio prompt when the audio stops.

                    1 Reply Last reply Reply Quote 0
                    • C Offline
                      clumsy_ninja
                      last edited by

                      @d3r Thanks. I’ve been looking at AlexaPi and i’m not sure how similar the code is but i did notice is has led’s indicating the status (listening, processing, speaking).
                      https://github.com/alexa-pi/AlexaPi

                      What i really want to achieve is a module for the mirror which shows the visual feedback with a microphone icon and also show the GUI cards alexa service returns. Problem is I’m not sure how to make this hahah I’m only use to writing in C and Java.

                      W 1 Reply Last reply Reply Quote 0
                      • W Offline
                        whyjustin @clumsy_ninja
                        last edited by

                        @clumsy_ninja said in Yet Another Voice Module (Sphinx + Alexa):

                        notice is has led’s indicating the status (listening, processing, speaking).
                        https://github.com/alexa-pi/AlexaPi

                        IIRC I exposed some of this stuff in the plugin, it shouldn’t be too hard to provide UI feedback for these events. Look at the events passed to the Java client here: https://github.com/whyjustin/magic-mirror-voice/blob/master/node_helper.js#L49. If you get anything working, PRs welcome.

                        What i really want to achieve is a module for the mirror which shows the visual feedback with a microphone icon and also show the GUI cards alexa service returns. Problem is I’m not sure how to make this hahah I’m only use to writing in C and Java.

                        GUI Cards are going to take more work.

                        1 Reply Last reply Reply Quote 0
                        • C Offline
                          clumsy_ninja
                          last edited by

                          @whyjustin Thanks for that, I’m new to javascript myself but I’m trying to recruit a mate to give us a hand haha. I’ll post something back if I get anything working.

                          1 Reply Last reply Reply Quote 0
                          • C Offline
                            clumsy_ninja
                            last edited by

                            @whyjustin Is it possible to change the activation work in your alexa? I remember seeing it defined in json somewhere but does it require voice training or something?

                            W 1 Reply Last reply Reply Quote 0
                            • L Offline
                              lb-rezende
                              last edited by

                              Hi,

                              I’m having a problem installing this module and maybe someone could help me, because this is my first experience with Linux and the Magic Mirror.

                              I followed the link describe in the Github to install Alexa. It was everything ok, I talked to her at the end.

                              I followed the rest of the instructions to install the module, although when I start the Magic Mirror it keeps at “loading” and after a while the application crash.

                              The last message is:
                              Listening for transport dt_socket at address: 5005
                              electron js/electron.js: …/src/java.cpp:105: v8::Localv8::Value Java::ensureJvm(): Assertion `result->IsNull()’ failed.

                              How can I solve it?

                              Thanks in advance.

                              W 1 Reply Last reply Reply Quote 0
                              • W Offline
                                whyjustin @clumsy_ninja
                                last edited by

                                @clumsy_ninja said in Yet Another Voice Module (Sphinx + Alexa):

                                @whyjustin Is it possible to change the activation work in your alexa? I remember seeing it defined in json somewhere but does it require voice training or something?

                                     commands: {
                                        "mirror mirror": {
                                          action: 'alexa'
                                        }
                                      },
                                

                                If you edit the above you can adjust the activation of Alexa. Haven’t spent much time with this project recently but IIRC you have to remove sphinx-model-generator/commands.dic and sphinx-model-generator/commands.lm when changing the commands.

                                C 1 Reply Last reply Reply Quote 0
                                • W Offline
                                  whyjustin @lb-rezende
                                  last edited by

                                  @lb-rezende said in Yet Another Voice Module (Sphinx + Alexa):

                                  electron js/electron.js: …/src/java.cpp:105: v8::Localv8::Value Java::ensureJvm(): Assertion `result->IsNull()’ failed.

                                  If I were to hazard a guess the JDK isn’t installed on your machine although you previously said that you were able to verify Alexa was working. Wild guess would be to verify the steps in [0] were followed to downgrade the electron client although this may not be related.

                                  [0] https://github.com/whyjustin/magic-mirror-voice#installation-notes

                                  L 1 Reply Last reply Reply Quote 0
                                  • L Offline
                                    lb-rezende @whyjustin
                                    last edited by

                                    @whyjustin

                                    I had done that step when I installed. I checked again, and Alexa is working when I execute the last step of the installation process (the one that has to open three different terminals and then the Alexa opens).

                                    As I said, I’m new with Linux, so probably I configured it with something missing or wrong. My config.js is this way:

                                                {
                                                        module: 'magic-mirror-voice',
                                                        header: 'Magic Mirror Voice',
                                                        position: 'top_right',
                                                        config: {
                                                                debug: true,
                                                                alexa: {
                                                                        productId: 'MagicMirrorEmmanuel',
                                                                        dsn: 'MagicMirrorEmmanuel'
                                                                },
                                                                ssl: {
                                                                        sslCaCert: './magic-mirror-voice/alexa-certificate-generator/certs/ca/ca.crt',
                                                                        sslKey: './magic-mirror-voice/alexa-certificate-generator/certs/server/node.key',
                                                                        sslCert: './magic-mirror-voice/alexa-certificate-generator/certs/server/node.crt',
                                                                        sslClientKeyStore: './magic-mirror-voice/alexa-certificate-generator/certs/client/client.pkcs12',
                                                                        sslClientKeyStorePassphrase: ''
                                                                },
                                                                companion: {
                                                                        port: 3000,
                                                                        serviceUrl: 'https://localhost:3000',
                                                                        redirectUrl: 'https://localhost:3000/authresponse',
                                                                        clientId: 'MY PRIVATE CLIENT ID',
                                                                        clientSecret: 'MY PRIVATE CLIENT SECRET'
                                                                },
                                                                client: {
                                                                        alpnVersion: '1.0.2',
                                                                        vlcPath: '/usr/lib/vlc',
                                                                        vlcPluginPath: '/usr/lib/vlc/plugins'
                                                                },
                                                                sphinx: {
                                                                        commands: {
                                                                                "mirror mirror": {
                                                                                        action: 'alexa'
                                                                                        }
                                                                                },
                                                                        dictionary: './commands.dic', // Optional
                                                                        model: './commands.lm' // Optional
                                                                        }
                                                                }
                                                },
                                    

                                    I’m not sure about the alpnVersion, vlcPath and vlcPluginPath, because I do not know where and how to find it. The dsn line as well, where do I find it?
                                    I already changed ports as discussed here before, but did not work.

                                    Thanks!

                                    W 1 Reply Last reply Reply Quote 0
                                    • W Offline
                                      whyjustin @lb-rezende
                                      last edited by

                                      @lb-rezende said in Yet Another Voice Module (Sphinx + Alexa):

                                      I’m not sure about the alpnVersion,

                                      Verify your java version by running java -version then you should be able to look up the ALPN here. Your version looks incorrect so maybe this is your issue.

                                      vlcPath and vlcPluginPath,

                                      Check the docs here, but it should boil down to running whereis vlc. The values you provided look correct for a default setup.

                                      because I do not know where and how to find it. The dsn line as well, where do I find it?

                                      I don’t think you need to worry about this. It’s part of the automated cert generation and the communication between the OAuth NodeJS server and the Alexa Java application. IIRC this can be any value.

                                      L 1 Reply Last reply Reply Quote 0
                                      • C Offline
                                        clumsy_ninja @whyjustin
                                        last edited by

                                        @whyjustin said in Yet Another Voice Module (Sphinx + Alexa):

                                         commands: {
                                            "mirror mirror": {
                                              action: 'alexa'
                                            }
                                          },
                                        

                                        If you edit the above you can adjust the activation of Alexa. Haven’t spent much time with this project recently but IIRC you have to remove sphinx-model-generator/commands.dic and sphinx-model-generator/commands.lm when changing the commands

                                        @whyjustin Yeah thats it. Do i need to record a new training file to replace those or where did the original one come from?

                                        W 1 Reply Last reply Reply Quote 0
                                        • L Offline
                                          lb-rezende @whyjustin
                                          last edited by lb-rezende

                                          @whyjustin

                                          I followed this doc that you linked and it has more details than the original readme file that I used, when I used the automated installation. The problem now is that Maven is no longer working. I receive the following message:

                                          -Dmaven.multiModuleProjectDirectory system property is not set. Check $M2_HOME environment variable and mvn script match.

                                          Any idea how to solve it?

                                          W 1 Reply Last reply Reply Quote 0
                                          • W Offline
                                            whyjustin @clumsy_ninja
                                            last edited by

                                            @clumsy_ninja said in Yet Another Voice Module (Sphinx + Alexa):

                                            @whyjustin Yeah thats it. Do i need to record a new training file to replace those or where did the original one come from?

                                            The plugin will automatically generate your models and dictionary on startup using the JSON property names (e.g. “mirror mirror”) if the sphinx-model-generator/commands.dic and sphinx-model-generator/commands.lm are missing. So remove those files, adjust the JSON, then start the plugin again. You can also manually edit the commands.lm and commands.dic files after they are automatically generated if you are comfortable with language modeling.

                                            1 Reply Last reply Reply Quote 1

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post
                                            Enjoying MagicMirror? Please consider a donation!
                                            MagicMirror created by Michael Teeuw.
                                            Forum managed by Sam, technical setup by Karsten.
                                            This forum is using NodeBB as its core | Contributors
                                            Contact | Privacy Policy