• 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.

MMM-AssistantMk2

Scheduled Pinned Locked Moved System
421 Posts 61 Posters 453.9k Views 57 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.
  • J Offline
    jomwells @Guest
    last edited by Jul 23, 2018, 2:07 PM

    @sean Yes, the pm2 error logs show some alsa related errors, I assume this is why the assistant doesn’t produce audio?

    /home/pi/.pm2/logs/MagicMirror-error.log:
    
    [../deps/mpg123/src/output/alsa.c:90] error: initialize_device(): cannot set format S16_LE
    MESA-LOADER: failed to retrieve device information
    libGL error: MESA-LOADER: failed to retrieve device information
    [../deps/mpg123/src/output/alsa.c:94] error: initialize_device(): cannot set 1 channels
    

    I have a pretty fresh install of MagicMirror so shouldn’t be an issue of too many modules, im using an RPI3, and a USB sound card, thanks
    on a side note, to get the Hotword and Assistant module to choose the correct microphone, I have had to change the input device to

    device: 'plughw:1',
    

    however each time I reboot, the input devices change order and I need to edit the config file again, is there a way to stop them changing device number?

    ? 1 Reply Last reply Jul 23, 2018, 3:12 PM Reply Quote 0
    • ? Offline
      A Former User @jomwells
      last edited by A Former User Jul 23, 2018, 3:13 PM Jul 23, 2018, 3:12 PM

      @jomwells
      Frankly says, I’m not an expert of system administration. Especially Alsa configuration is out of my ability.
      Anyway you should success this test.

      arecord -d 10 test.wav & aplay test.wav

      It should record your voice and play again.

      It means, your mic and speaker should be default device.

      1 Reply Last reply Reply Quote 0
      • J Offline
        jomwells
        last edited by Jul 23, 2018, 3:39 PM

        To anyone having issues with RPI3 and a USB sound card, the solution to this was to change ‘/home/pi/.asoundrc’ to:

        pcm.!default {
          type plug
          slave {
            pcm "hw:1,0"
          }
        }
        
        ctl.!default {
            type hw
            card 1
        }
        

        (where the USB device is card 1)
        Thank you @Sean for your help, it is now working brilliantly, this is by far the best voice assistant module for MM!
        Is there any way to configure how long the result card displays on screen before hiding itself? If not, could this be added in a later version? thanks!

        ? S T 3 Replies Last reply Jul 23, 2018, 4:24 PM Reply Quote 0
        • ? Offline
          A Former User @jomwells
          last edited by A Former User Jul 23, 2018, 4:26 PM Jul 23, 2018, 4:24 PM

          @jomwells
          Card display time is decided by card itself. Maybe I can hook the duration, but with some painful effort, not even clearly.
          The card itself is hardcoded, so there isn’t enough margin to manipulate. Originally the card would be planned to be used on specific device - smart tv, so ours has some limitation for full usage.
          For example, In smart tv, a user can decide to play or not the result of a YouTube search by remote controller, but we haven’t. That is why I implement YouTube player in this module. Other functions are the same.

          J 1 Reply Last reply Jul 23, 2018, 6:04 PM Reply Quote 0
          • J Offline
            jomwells @Guest
            last edited by Jul 23, 2018, 6:04 PM

            @sean Ah I see, its not essential at all! one minor bug I seem to have, that I have noticed does not occur for you in your demonstration video is that now, having finished the audio reply, there is often a very short sound, it sounds like the last half a second of text is repeated, sometimes it is more of a ‘buzz’, I attempted changing the encodingOut setting to one of the other options (MP3 or OPUS_IN_OGG) but both of these just give white noise (like an old tv with no signal) in place of any audio, is this something you have come across at all, and is there anything you can suggest to fix it? maybe getting the alternative encoding to work? thanks

            ? J 3 Replies Last reply Jul 23, 2018, 9:07 PM Reply Quote 0
            • ? Offline
              A Former User @jomwells
              last edited by A Former User Jul 23, 2018, 9:22 PM Jul 23, 2018, 9:07 PM

              @jomwells
              I’m not sure.
              Voice output is just buffered stream, so just piping it to the speaker is all of mechanism. So at the moment I have no idea why last data is duplicated(?) in your environment.
              Voice output stream comes chunked, so there is some possibility of the time gap between incoming stream chunks.

              Maybe instead piping Linear16 to speaker directly, writing response stream to mp3(or ogg) file then playing that file could be one of solutions.(sorry, I didn’t implement that)

              S 1 Reply Last reply Jul 24, 2018, 2:42 AM Reply Quote 0
              • ? Offline
                A Former User @jomwells
                last edited by Jul 23, 2018, 9:16 PM

                @jomwells
                For the Speaker, research this.
                https://github.com/TooTallNate/node-speaker

                1 Reply Last reply Reply Quote 0
                • S Offline
                  Sun @jomwells
                  last edited by Sun Jul 24, 2018, 3:12 AM Jul 24, 2018, 2:37 AM

                  @jomwells Mine is a little bit different as I use the hdmi on tv as speaker as well. the default device fall on card 0 with alsa. For microphone is usb on card 1. I don’t have problem with microphone but I did have problem with sound via hdmi. Sometime sound just come out right through the hdmi but with lag sound, sometime no sound at all and say device busy. Also, to avoid hdmi device busy, I use usb sound card instead of hdmi sound also very lag.

                  pcm.!default {
                  type asym
                  playback.pcm
                  {
                  type hw
                  card 0
                  device 1
                  }
                  capture.pcm
                  {
                  type hw
                  card 1
                  device 0
                  }
                  }

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    Sun @Guest
                    last edited by Jul 24, 2018, 2:42 AM

                    @sean How to change the piping Linear 16 to ogg. Can I just put ogg in the

                    encodingOut: “OPUS_IN_OGG”,

                    ? 1 Reply Last reply Jul 24, 2018, 4:47 AM Reply Quote 0
                    • ? Offline
                      A Former User @Sun
                      last edited by Jul 24, 2018, 4:47 AM

                      @sun
                      No, mp3 and Ogg should be written to file or piping to proper player, frankly I didn’t implement those function, because I thought nobody needs.
                      I’ll try those till next update.

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 5
                      • 6
                      • 42
                      • 43
                      • 4 / 43
                      4 / 43
                      • First post
                        31/421
                        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