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.

    Hello-Lucy using Adafruit Voice Bonnet

    Scheduled Pinned Locked Moved Solved Troubleshooting
    24 Posts 2 Posters 4.6k Views 2 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.
    • S Do not disturb
      sdetweil @sinbad339
      last edited by

      @sinbad339 can u try this

      arecord -D default -q  -r 16000 -c 1 -t wav -f S16_LE >test.wav
      

      the replace default with

      arecord -D hw:2,0  -q -r 16000 -c 1 -t wav -f S16_LE >test.wav
      

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sinbad339 @sdetweil
        last edited by

        @sdetweil
        With MM running, if I issue

        arecord -D default -q  -r 16000 -c 1 -t wav -f S16_LE >test.wav
        

        I get a good .wave file that I can play.
        With MM still running, specifying the hw explicitly results in an error.

        arecord -D hw:2,0  -q -r 16000 -c 1 -t wav -f S16_LE >test2.wav
        arecord: main:830: audio open error: Device or resource busy
        pi@Magic:~/MagicMirror/config $ arecord -l
        **** List of CAPTURE Hardware Devices ****
        card 2: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [bcm2835-i2s-wm8960-hifi wm8960-hifi-0]
          Subdevices: 0/1
          Subdevice #0: subdevice #0
        
        
        S 1 Reply Last reply Reply Quote 0
        • S Do not disturb
          sdetweil @sinbad339
          last edited by

          @sinbad339 said in Hello-Lucy using Adafruit Voice Bonnet:

          With MM still running, specifying the hw explicitly results in an error.

          ok, so MM is using that device

          while mm is running do

          ps -ef | grep arec

          u should see the arecord process and the parms passed
          from one of my apps that uses arecord

          arecord -D default -q -r 16000 -c 1 -t wav -f S16_LE -
          

          the trailing dash means stream content to stdout (which is captured by the upstream library)

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          S 1 Reply Last reply Reply Quote 0
          • S Do not disturb
            sdetweil @sdetweil
            last edited by

            @sinbad339

            arecord -D default

            the question is, what is ‘default’

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sinbad339 @sdetweil
              last edited by

              @sdetweil
              So the arecord -l lists card2 as my expected capture device (seeed-2mic-voicecard). I find it interesting that it enumverates as #2 with no #0 or #1.

              Anyway, I ran your ps command; not sure what this output means (as I’m sure you’re aware by now, I’m a Noob on Linux).

              ps -ef | grep arec
              pi        1953  1927  0 11:04 pts/0    00:00:00 grep --color=auto arec
              
              
              S 1 Reply Last reply Reply Quote 0
              • S Do not disturb
                sdetweil @sinbad339
                last edited by

                @sinbad339 hm…

                should have used arecord…

                try

                ps -ef | grep rec
                

                (there are only 2 apps… arecord or rec )

                the output from ps

                pi        1953  1927  0 11:04 pts/0    00:00:00 grep --color=auto arec
                

                user that started process
                the process id
                the parent process id +
                (i don’t know, 0)
                the time the process was started
                (i don’t know, pts/ )
                how much cpu time has been used since started, in seconds
                the string used to start the process, pgm name and then parms

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sinbad339 @sdetweil
                  last edited by sinbad339

                  @sdetweil

                  ps -ef | grep rec
                  root        76     2  0 11:02 ?        00:00:00 [vchiq-recy/0]
                  pi        2320  1927  0 11:24 pts/0    00:00:00 grep --color=auto rec
                  

                  Not sure what vchiq-recy is…
                  But no arec or arecord.

                  S 1 Reply Last reply Reply Quote 0
                  • S Do not disturb
                    sdetweil @sinbad339
                    last edited by

                    @sinbad339 said in Hello-Lucy using Adafruit Voice Bonnet:

                    But no arec or arecord.

                    well, that explains the error…

                    you did run the installation dependencies script, right?

                    cd Hello-Lucy/installers
                    bash dependencies.sh
                    

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    S 1 Reply Last reply Reply Quote 0
                    • S Offline
                      sinbad339 @sdetweil
                      last edited by

                      @sdetweil
                      Yes, I did run it. Its been a while, and I remember warning about depreciated versions, but nothing that I thought could be an issue. OK to run it again?

                      S 1 Reply Last reply Reply Quote 0
                      • S Do not disturb
                        sdetweil @sinbad339
                        last edited by

                        @sinbad339 said in Hello-Lucy using Adafruit Voice Bonnet:

                        OK to run it again?

                        i don’t think there is a need

                        add debug:true to the module config section

                        module: 
                            config:  {
                                debug:true,
                           .... whatever else was there
                            }
                        

                        and then

                        pm2 stop all 
                        cd ~/MagicMirror
                        npm start >somefile.txt
                        

                        when error reported

                        alt-spacebar, n to minimize mm
                        ctrl-c to stop mm
                        and look at somefile.txt

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        S 1 Reply Last reply Reply Quote 0
                        • S Offline
                          sinbad339 @sdetweil
                          last edited by

                          @sdetweil
                          WELL, now it seems to work. Running from command line w/ debug, I don’t get microphone with ERROR, and if I say “Hello Lucy”, it prompts for a command, then does it, and issues the “ding”. I’ve done this three times now, and its worked every time. Here’s the debug outout:

                          > magicmirror@2.18.0 start /home/pi/MagicMirror
                          > DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js
                          
                          [05.01.2022 11:55.24.384] [LOG]   Starting MagicMirror: v2.18.0
                          [05.01.2022 11:55.24.394] [LOG]   Loading config ...
                          [05.01.2022 11:55.24.404] [LOG]   Loading module helpers ...
                          [05.01.2022 11:55.26.860] [LOG]   Initializing new module helper ...
                          [05.01.2022 11:55.26.864] [LOG]   Module helper loaded: Hello-Lucy
                          [05.01.2022 11:55.26.866] [LOG]   All module helpers loaded.
                          [05.01.2022 11:55.27.040] [LOG]   Starting server on port 8081 ...
                          [05.01.2022 11:55.27.066] [LOG]   Server started ...
                          [05.01.2022 11:55.27.069] [LOG]   Connecting socket for: Hello-Lucy
                          [05.01.2022 11:55.27.071] [LOG]   Starting module helper: Hello-Lucy
                          [05.01.2022 11:55.27.073] [LOG]   Sockets connected & modules started ...
                          [05.01.2022 11:55.27.482] [LOG]   Launching application.
                          [05.01.2022 11:55.37.133] [LOG]   Hello-Lucy has recognized: ALL IS THE
                          [05.01.2022 11:56.16.829] [LOG]   Hello-Lucy has recognized: NINE
                          
                          1 Reply Last reply Reply Quote 0
                          • S Offline
                            sinbad339
                            last edited by

                            The difference is how MM is started. If I do it the manual way, the microphone works (with or without debug enabled). If MM does its normal autostart, using mm.sh that includes DISPLAY=:0 npm start, then the microphone doesn’t work.

                            S 1 Reply Last reply Reply Quote 0
                            • S Do not disturb
                              sdetweil @sinbad339
                              last edited by

                              @sinbad339 said in Hello-Lucy using Adafruit Voice Bonnet:

                              its normal autostart,

                              how is that done? pm2 or did u do some other setup

                              sounds like mm is not running as user but as root?

                              Sam

                              How to add modules

                              learning how to use browser developers window for css changes

                              S 1 Reply Last reply Reply Quote 0
                              • S Offline
                                sinbad339 @sdetweil
                                last edited by

                                @sdetweil
                                I followed the instructions from https://www.magicmirrorcentral.com/complete-raspberry-pi-magic-mirror-tutorial/.
                                It included

                                type in the following command:
                                
                                pm2 startup
                                 
                                A different command will appear. Run that command also.
                                
                                Now create a shell script for startup. Open up the built-in text editor on the Pi by typing in:
                                
                                cd ~
                                nano mm.sh
                                The lower line basically means, “open up a file called mm.sh in the nano text editor.”
                                
                                When the text editor has opened, add this to the mm.sh file:
                                
                                cd ~/MagicMirror
                                DISPLAY=:0 npm start
                                Make your shiny new script executable by typing in:
                                
                                chmod +x mm.sh
                                Now start up Magic Mirror and make it start up on boot:
                                
                                pm2 start mm.sh
                                
                                pm2 save
                                Now, reboot your Pi by typing in
                                
                                sudo reboot
                                
                                S 1 Reply Last reply Reply Quote 0
                                • S Do not disturb
                                  sdetweil @sinbad339
                                  last edited by

                                  @sinbad339 hm… my install script does all that.

                                  mm.sh already exists in the installers folder.

                                  try my fixuppm2.sh from here
                                  https://github.com/sdetweil/MagicMirror_scripts

                                  Sam

                                  How to add modules

                                  learning how to use browser developers window for css changes

                                  S 1 Reply Last reply Reply Quote 0
                                  • S Offline
                                    sinbad339 @sdetweil
                                    last edited by

                                    @sdetweil
                                    Let me start by saying I really appreciate your help with this. You’ve given me a lot of your time, and clearly I couldn’t have made any progress without you. Thank you.

                                    Running your fixupppm2 script fixes the microphone on a restart, but then there is no speaker output. If I stop MM, then manually restart it with npm start, the mic and speaker work fine, as before the fixup.

                                    S 1 Reply Last reply Reply Quote 0
                                    • S Do not disturb
                                      sdetweil @sinbad339
                                      last edited by sdetweil

                                      @sinbad339 that makes no sense to me.
                                      could u start it w pm2, and then ps -ef >somefile.txt

                                      and email me thevfile some file.txt

                                      same userid as here at gmail.

                                      I want to see if there is some permissions problem

                                      oh, check the file contents to make sure no userid or password is exposed. shouldn’t be but u never know.

                                      Sam

                                      How to add modules

                                      learning how to use browser developers window for css changes

                                      S 1 Reply Last reply Reply Quote 0
                                      • S Offline
                                        sinbad339 @sdetweil
                                        last edited by

                                        @sdetweil
                                        Just sent it…

                                        1 Reply Last reply Reply Quote 0
                                        • S Offline
                                          sinbad339
                                          last edited by

                                          Just sent two additional files; one where the speaker worked, and one where it didn’t. As I explained in the email, this is an intermittent issue and it doesn’t matter how MM is started.

                                          S 1 Reply Last reply Reply Quote 0
                                          • S Do not disturb
                                            sdetweil @sinbad339
                                            last edited by

                                            @sinbad339 i replied

                                            Sam

                                            How to add modules

                                            learning how to use browser developers window for css changes

                                            1 Reply Last reply Reply Quote 0

                                            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