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.

    audio problem

    Scheduled Pinned Locked Moved Solved Troubleshooting
    13 Posts 2 Posters 138 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.
    • T Offline
      tommyk @sdetweil
      last edited by

      @sdetweil Hi sam
      thanks for your reply, and thanks to everyone for all these wonderful modules
      firstly I must say that I am a complete novice ,but love messing about with this mirror thing
      I am running a pi 4 with debian 13 (trixie).
      so when I type in terminal (cd MagicMirror npm start) the mirror starts with audio… ie Manual start
      but when I created a bash file to autostart the mirror, which I got on utube from the fuzz guy
      the mirror starts up automatically when the pi has loaded up… but there is no audio…
      then if i click control and m to close the mirror and type in terminal the audio is on again.
      so it seems something is not loading on autostart.
      thats about all I know, sorry but I dont know how to show system info

      thanks
      tommyk

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

        @tommyk I understand

        Maybe there will be some info here

        After starting from boot , where the audio fails,
        Open the browser developers window
        ctrl-shift-i
        Select the console tab, and put juke in the filter field
        To see if there are any errors, usually marked in red

        If so, copy paste them here

        Same keystroke to get out of dev window

        Let me know what you find

        Another test thing to try, is add a sleep 30
        In the script before launching MagicMirror to see if that makes a difference

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        T 1 Reply Last reply Reply Quote 0
        • T Offline
          tommyk @sdetweil
          last edited by

          @sdetweil hello again
          thanks for your help sam.
          I said I was a novice but neglected to say I am also a 77 year old fool, and I have just realized that I overlooked an issue which may be the problem I am having…so let me recap…

          when I start up my pi 4 my speaker says bluetooth is now connected, then after 20 seconds the mirror starts with no audio, so I close the mirror and paste npm in terminal… ok…
          then I just realized that the mirror wont start because the port is being used by another ?
          so I have to open config.js to change the port number…
          then the mirror opens up with audio and works fine…
          so it seems it is a port issue…but how to fix this, I have no idea lol.
          I just dont understand if it working ok when I change the port number , why is does not work on restart the next day.
          why is the port being used by another something or other…
          if the port was’nt being used then the mirror would autostart with no problem…I assume

          any advice on that would be appreciated, and sorry for being a nusance
          thanks again
          tommyk

          S T 2 Replies Last reply Reply Quote 0
          • S Do not disturb
            sdetweil @tommyk
            last edited by

            @tommyk no nuisance at all.

            So, how did you setup to auto start. If you are using pm2 then there are commands that can help you without editing the config file to change the port

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • T Offline
              tommyk @tommyk
              last edited by

              well I tried pm2 method but could not get it to work
              so I found a utube vid by the fuzz guy on how to autostart magic mirror
              so I followed his instructions and finally got it to work
              https://www.youtube.com/watch?v=iqNHX8v8cPY
              perhaps I did something wrong . as I had to try a few times before it would actually autostart
              cheers

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

                @tommyk awesome… thanks…

                ps. I am the current author/maintainer of the scripted MM install and upgrade scripts.
                https://github.com/sdetweil/MagicMirror_scripts
                referenced in the MM install doc, Alternative install methods…
                I provide the mm.sh. and the pm2 setup to use it.
                if you say no during install, then I provide a separate script to add that after the fact

                I use pm2 because it fixes the one problem you have…

                crontab started mm from a background script… BUT there is no EASY way to restart it without reboot…(which really isn’t needed) , unless you change the port like you found and start ANOTHER copy…

                pm2 has ONE tiny drawback/benefit… its JOB is to START an app, AND KEEP IT RUNNING, if it fails for some reason, then it will get restarted… so, your old, crtl-q to quit, oops the app ends, pm2 will restart it

                to work around that, pm2 is a commandline command, so ctrl-m to minimze MM, then open a terminal window,
                ctrl-alt-t, and use pm2 status
                to see the apps running under pm2 control
                then using the name or number of the line with the app (I have a few apps under pm2 control)

                id │ name                │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
                ├────┼─────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
                │ 8  │ MagicMirror         │ default     │ 2.32.0… │ fork    │ N/A      │ 0      │ 245… │ stopped   │ 0%       │ 0b       │ sam      │ disabled │
                │ 7  │ MagicMirror 8       │ default     │ 2.31.0… │ fork    │ N/A      │ 0      │ 8    │ stopped   │ 0%       │ 0b       │ sam      │ disabled │
                │ 10 │ MagicMirror-test    │ default     │ 2.37.0… │ fork    │ N/A      │ 0      │ 30   │ stopped   │ 0%       │ 0b       │ sam      │ disabled │
                

                so to restart my current test version MM, I need to use the number 10, or the name MagicMirror-test

                pm2 stop 10
                pm2 start 10
                

                or

                pm2 restart 10
                

                a learning thing, under linux, raspios, … by convention commandline commands are required to provide easy access help, by responding to the --help parm

                pm2 --help 
                

                will do that… but ANY command should respond appropriately
                — back to the problem

                the mm.sh script he uses

                npm run start
                

                run start is a shortcut to npm run start

                starting in release 2.35 we changed the startup to use the Raspberrypi default wayland display environment.
                you can see this by examining the scripts: list in package.json (see below)
                BUT many are not using that, still on x11… SO,

                you need to change the script to use
                npm run start:x11
                (my mm.sh has that built in)

                a part the package.json scripts list (I added comments, not allowed in a json file)

                  "scripts": {
                                "config:check": "node js/check_config.js",
                                "postinstall": "git clean -df fonts vendor modules/default",
                                "install-mm": "npm install --no-audit --no-fund --no-update-notifier --only=prod --omit=dev",
                                "install-mm:dev": "npm install --no-audit --no-fund --no-update-notifier && npx playwright install chromium",
                                "lint:css": "stylelint 'css/**/*.css' 'defaultmodules/**/*.css' --fix",
                                "lint:js": "eslint --fix",
                                "lint:markdown": "markdownlint-cli2 . --fix",
                                "lint:prettier": "prettier . --write",
                                "prepare": "[ -f node_modules/.bin/husky ] && husky || echo no husky installed.",
                                "server": "node ./serveronly",
                                "server:watch": "node ./serveronly/watcher.js",
                                "start": "node --run start:wayland",    <----------------------------  start launch start:wayland
                                "start:dev": "node --run start:wayland -- dev",
                                "start:wayland": "WAYLAND_DISPLAY=\"${WAYLAND_DISPLAY:=wayland-1}\" ./node_modules/.bin/electron js/electron.js --ozone-platform=wayland", <-- start:wayland
                                "start:wayland:dev": "node --run start:wayland -- dev",
                                "start:windows": ".\\node_modules\\.bin\\electron js\\electron.js",
                                "start:windows:dev": "node --run start:windows -- dev",
                                "start:x11": "DISPLAY=\"${DISPLAY:=:0}\" ./node_modules/.bin/electron js/electron.js",
                

                anyhow after ALL THAT… i’d edit your existing mm.sh and increase the time from 20 to 30 to try and let the system settle down some more… this is just a test…

                if you want to switch to my pm2 setup, you can edit the crontab, and add a pound sign/hash ‘#’ as the first char of your launch of mm.sh, this will make it a comment

                reboot so MM is not running (there are cool ways to make tools(scripts) that can solve that problem, but not trying to go there
                and then copy/paste the command to setup pm2 launch from my scripts repo… not git clone, just copy paste one line to a terminal window
                see https://github.com/sdetweil/MagicMirror_scripts#add-using-pm2-to-autostart-magicmirror-at-bootup

                ps, i’m only a couple years younger then you…

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 0
                • T Offline
                  tommyk
                  last edited by

                  wow, thats a lot of info, I will maybe have to ponder over that a while to let it sink in
                  I will get back to you when I have digested some of this info
                  and hopefully gained some knowledge
                  thank you again
                  tommyk

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

                    @tommyk yeh, but I wanted to explain WHY and WHAT you can DO…

                    anytime, we’re here to help.
                    I do the scripts to help users get MM up and running, and KEEP their systems running… feel successful…

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    T 1 Reply Last reply Reply Quote 0
                    • T Offline
                      tommyk @sdetweil
                      last edited by

                      @sdetweil Hi Sam
                      turned my pi4 on this morning
                      bluetooth speaker said I am now connected
                      Magic Mirror started after a short pause
                      hello lucy said hello and welcome to magic mirror jukebox
                      I clicked on a jukebox button and woke the neighbors up . lol…joking
                      and I thought (yippi) music played

                      now, I mess around with so many different things at once I confuse myself
                      so I dont know exactly what I done, but I did put a pound sigh at the start of the bash file
                      and changed the sleep time to 30
                      and done what you advised , run start with x11 etc.
                      Im not sure but I think I may have pasted some of your pm2 script in terminal
                      but whatever i did , thanks to you my problem is solved, I think you are a genius
                      …
                      my next project is to get my android phone to control the mirror
                      I tried mmm remote once and failed , so now that the autostart is working
                      I will try that again
                      thank you so much for all your help

                      ps, I think I may be back to you regarding this remote module
                      thank you
                      tommyk

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

                        @tommyk glad you got it working

                        As for remote control , open another topic. I’m sure someone can help

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        1 Reply Last reply Reply Quote 0
                        • S sdetweil has marked this topic as solved

                        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 / 1
                        • 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