• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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 31.7k 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.
  • C Offline
    clumsy_ninja @whyjustin
    last edited by Nov 29, 2016, 11:28 PM

    @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 Nov 30, 2016, 6:07 PM Reply Quote 0
    • L Offline
      lb-rezende @whyjustin
      last edited by lb-rezende Nov 30, 2016, 1:59 AM Nov 30, 2016, 1:10 AM

      @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 Nov 30, 2016, 6:10 PM Reply Quote 0
      • W Offline
        whyjustin @clumsy_ninja
        last edited by Nov 30, 2016, 6:07 PM

        @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
        • W Offline
          whyjustin @lb-rezende
          last edited by Nov 30, 2016, 6:10 PM

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

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

          I would verify your Maven installation. Is $M2_HOME set? If so you can -Dmaven.multiModuleProjectDirectory=$M2_HOME although this should be the default behavior.

          L 1 Reply Last reply Nov 30, 2016, 8:26 PM Reply Quote 0
          • L Offline
            lb-rezende @whyjustin
            last edited by Nov 30, 2016, 8:26 PM

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

            -Dmaven.multiModuleProjectDirectory=$M2_HOME

            Where do I set the $M2_HOME (and how)? I just created the maven.sh file as described in the tutorial and included the two lines. I inserted this line that you suggested in the same file, maven.sh, but did not work.
            Is there a way to uninstall those applications and do all over again?

            W 1 Reply Last reply Nov 30, 2016, 10:29 PM Reply Quote 0
            • W Offline
              whyjustin @lb-rezende
              last edited by Nov 30, 2016, 10:29 PM

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

              Where do I set the $M2_HOME (and how)?

              Looks like the $M2_HOME is set in the script

              export M2_HOME=/opt/apache-maven-3.3.9
              

              If the script resides in /etc/profile.d/ then it should run during boot (have you restarted your pi at all?).

              Is there a way to uninstall those applications and do all over again?

              Easiest would be to nuke the entire thing and start over. TBH these are linux questions and I’m very happy to support my plugin but they seem beyond the scope of that. I’ll try my best to help but may not be able to provide support on every question.

              1 Reply Last reply Reply Quote 0
              • L Offline
                lb-rezende
                last edited by Dec 1, 2016, 10:22 PM

                @whyjustin

                Thanks for your help. I formatted the SD card and installed all over again, but it has something that does not work.

                I have Alexa working, I used the following guide:
                https://github.com/alexa/alexa-avs-sample-app/wiki/Raspberry-Pi

                So, following the README of your module, I have the following:
                VLC:

                VLC media player 2.2.1 Terry Pratchett (Weatherwax) (revision 2.2.1-0-ga425c42)

                JAVA

                java version “1.8.0_111”
                Java™ SE Runtime Environment (build 1.8.0_111-b14)
                Java HotSpot™ Client VM (build 25.111-b14, mixed mode)
                javac 1.8.0_111

                So ALPN is configured to 8.1.0.v20141016 (1.8.0u11 OpenJDK version)

                MAVEN

                Apache Maven 3.0.5
                Maven home: /usr/share/maven
                Java version: 1.8.0_111, vendor: Oracle Corporation
                Java home: /usr/lib/jvm/java-8-oracle/jre
                Default locale: en_GB, platform encoding: UTF-8
                OS name: “linux”, version: “4.4.35-v7+”, arch: “arm”, family: “unix”

                I configured config.js with the following sets and after that executed npm install in the module directory:

                            {
                                    module: 'magic-mirror-voice',
                                    header: 'Magic Mirror Voice',
                                    position: 'top_right',
                                    config: {
                                            debug: true,
                                            alexa: {
                                                    productId: 'my_device',
                                                    dsn: '1xxxxxxxxxx'
                                            },
                                            ssl: {
                                                    sslCaCert: '',
                                                    sslKey: '',
                                                    sslCert: '',
                                                    sslClientKeyStore: '',
                                                    sslClientKeyStorePassphrase: ''
                                            },
                                            companion: {
                                                    port: 3000,
                                                    serviceUrl: 'https://localhost:3000',
                                                    redirectUrl: 'https://localhost:3000/authresponse',
                                                    clientId: '.MY PRIVATE KEY',
                                                    clientSecret: 'MY PRIVATE KEY'
                                            },
                                            client: {
                                                    alpnVersion: '8.1.0.v20141016',
                                                    vlcPath: '/usr/lib/vlc',
                                                    vlcPluginPath: '/usr/lib/vlc/plugins'
                                            },
                                            sphinx: {
                                                    commands: {
                                                            "mirror mirror": {
                                                                    action: 'alexa'
                                                                    }
                                                            },
                                                    dictionary: './commands.dic', // Optional
                                                    model: './commands.lm' // Optional
                                                    }
                                            }
                            },
                

                I removed the ssl optional configuration, the port is the same that is configured at the amazon developer site, the clientId and clientSecret are correct (I removed here), the ALPN version is the same of Java and the vlc address is correct, so it should be working, but I receive the following message:

                Whoops! There was an uncaught exception…
                TypeError: parser.close is not a function
                at SAXStream.openf1 (/home/pi/MagicMirror/node_modules/feedme/lib/xmlfeedparser.js:107:14)
                at emitOne (events.js:96:13)
                at SAXStream.emit (events.js:188:7)
                at Object.me._parser.(anonymous function) [as onopentag] (/home/pi/MagicMirror/node_modules/sax/lib/sax.js:258:17)
                at emit (/home/pi/MagicMirror/node_modules/sax/lib/sax.js:640:35)
                at emitNode (/home/pi/MagicMirror/node_modules/sax/lib/sax.js:645:5)
                at openTag (/home/pi/MagicMirror/node_modules/sax/lib/sax.js:841:5)
                at Object.write (/home/pi/MagicMirror/node_modules/sax/lib/sax.js:1318:13)
                at SAXStream.write (/home/pi/MagicMirror/node_modules/sax/lib/sax.js:239:18)
                at yoshi.write (/home/pi/MagicMirror/node_modules/feedme/lib/feedme.js:41:14)
                at IconvLiteDecoderStream.ondata (_stream_readable.js:555:20)
                at emitOne (events.js:96:13)
                at IconvLiteDecoderStream.emit (events.js:188:7)
                at readableAddChunk (_stream_readable.js:176:18)
                at IconvLiteDecoderStream.Readable.push (_stream_readable.js:134:10)
                at IconvLiteDecoderStream.Transform.push (_stream_transform.js:128:32)
                MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
                If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues

                Do you have any idea of what is happening?

                W 1 Reply Last reply Dec 2, 2016, 5:57 PM Reply Quote 0
                • W Offline
                  whyjustin @lb-rezende
                  last edited by Dec 2, 2016, 5:57 PM

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

                  Whoops! There was an uncaught exception…
                  TypeError: parser.close is not a function

                  Do you have any idea of what is happening?

                  Looking through the stack trace it looks like this is unrelated to my plugin.

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    Mirrorolentia
                    last edited by Jan 2, 2017, 3:50 PM

                    @whyjustin: I have integrated your module into other modules. However, am seeing the following problems:

                    1. Saying “mirror mirror” doesn’t trigger Alexa. Do the AVS sample apps need to be started alongside?I tried that but your module was exiting with an exception:
                      Unable to run Listen in Sphinx Java Client:Error: Error running instance method
                      java.lang.NullPointerException
                      at com.amazon.alexa.avs.AudioCapture.startCapture(AudioCapture.java:74)
                      at com.amazon.alexa.avs.AudioCapture.getAudioInputStream(AudioCapture.java:56)
                      at com.whyjustin.magicmirror.sphinx.SphinxMirrorRecognizer.startRecognition(SphinxMirrorReroot@raspberrypi:/home/pi/MagicMirror/MagicMirror-master/modules/magic-mirror-voice

                    2. There are few errors:
                      Error with Alexa Companion Service: { [Error: Not Found] status: 404 }

                    Please let me know where am I going wrong.

                    1 Reply Last reply Reply Quote 0
                    • C Offline
                      clumsy_ninja
                      last edited by clumsy_ninja Jan 2, 2017, 11:40 PM Jan 2, 2017, 11:39 PM

                      @Mirrorolentia If you can’t get that one to work or want to try a different one checkout AlexaPi. It’s a python implementation of Alexa made for all sorts of platforms.
                      You can get it from here: https://github.com/alexa-pi/AlexaPi

                      You can also use this mirror module to give status feedback on the mirror: https://github.com/dgonano/MMM-AlexaPi

                      Just be sure to pick the magicmirror platform during setup instead of the default raspberrypi

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 4 / 4
                      • 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