anonym-tsk / mmm-volume Goto Github PK
View Code? Open in Web Editor NEWVolume controller for MagicMirror
License: MIT License
Volume controller for MagicMirror
License: MIT License
is there anyway i can always have it always on the screen. Should I change the hideDelay to a really long number?
There is no error or anything just nothing appears on the screen when I turn on the magic mirror. I am using multiple pages so that could be a problem. I also have to change respeaker_speaker from speaker to headphone in the get and set scripts. The terminal shows that it does set the volume to 50 but there is nothing on the screen. Any help would be great, thanks.
Module is working great on my RPI4B.
One thing: I do have more than one audio device and therefore the default Respeaker script did not work for me.
I had to specify the output device with -c
.
It looks like this:
"RESPEAKER_PLAYBACK": {
getVolumeScript: "amixer -c seeed2micvoicec -M sget Playback | grep -E -o '[[:digit:]]+%' | head -n 1| sed 's/%//g'", // get 0~100
setVolumeScript: "amixer -c seeed2micvoicec -M sset Playback #VOLUME#%", // set 0~100
},
Another thing I stumbled upon is that in the readme the scripts are inside ` and not " (see screenshot).
With ` it is not working on raspberry pi.
Hi
i installed MMM-PlayerRadio with MMM-Volume, but when i press up or down volume button i receive this error:
[04.11.2023 15:30.08.490] [LOG] [VOLUME] Set Volume Error: Error: Command failed: amixer sset -M 'PCM' 5%
amixer: Unable to find simple control 'PCM',0
at ChildProcess.exithandler (node:child_process:430:12)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1091:16)
at Socket. (node:internal/child_process:449:11)
at Socket.emit (node:events:513:28)
at Pipe. (node:net:322:12) {
code: 1,
killed: false,
signal: null,
cmd: "amixer sset -M 'PCM' 5%"
}
Thanks
I am running MagicMirror:latest+MMM-Volume on my Raspberry Pi (detailed environment below).
Raspberry outputs sound through card 1: usb c-media sound card (see aplay -l
results in the env section below)
MMM-Volume does not change the system volume.
I have put in config to decrease the volume to 4%, it retursn with an error in terminal log:
[2020-02-05 21:54:49.891] [LOG] [VOLUME] Set Volume Error: Error: Command failed: amixer sset -M 'PCM' 4%
amixer: Unable to find simple control 'PCM',0
at ChildProcess.exithandler (child_process.js:303:12)
at ChildProcess.emit (events.js:200:13)
at maybeClose (internal/child_process.js:1021:16)
at Socket.<anonymous> (internal/child_process.js:430:11)
at Socket.emit (events.js:200:13)
at Pipe.<anonymous> (net.js:586:12) {
killed: false,
code: 1,
signal: null,
cmd: "amixer sset -M 'PCM' 4%"
{
module: "MMM-Volume",
disabled: false,
position: "top_left", // It is meaningless. but you should set.
config: {
usePresetScript: "ALSA", // "ALSA" is supported by default.
volumeOnStart: 4,
}
},
Raspbian version
pi@raspberrypi:~/MagicMirror $ cat /etc/os-release
>PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
>NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
Linux core
pi@raspberrypi:~/MagicMirror $ uname -a
Linux raspberrypi 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l GNU/Linux
Hardware model
pi@raspberrypi:~/MagicMirror $ cat /proc/device-tree/model
Raspberry Pi 3 Model B Plus Rev 1.3
Node and NPM version
pi@raspberrypi:~ $ node -v v10.18.1
pi@raspberrypi:~ $ npm -v 6.13.4
Audio devices
pi@raspberrypi:~/MagicMirror $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 7/7
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: ALSA [bcm2835 ALSA], device 2: bcm2835 IEC958/HDMI1 [bcm2835 IEC958/HDMI1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: Device_1 [USB Audio Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
Before you post issue, try this first
- Confirm you have completed installation with instruction
Confirmed- Copy your content of
config.js
and paste it into http://esprima.org/demo/validate.html to check whether you have syntax error or not. If there might be errors, usually your issue will be solved by fix those errors.
Confirmed- If you are using
pm2
to execute MM, stop pm2 (pm2 stop mm
) then executenpm start dev
on your MagicMirror directory. It will show front-end log on dev-console of MM, and back-end log on your shell terminal. Both logs are needed to examine.
Confirmed. PM2 is not used
Hi,
I installed the module-fork for the Seeed Respeaker 2-Mics hat on my Pi 3b+ (buster) and in general it works fine, but I stumbled across some issues with MMM-GroveGesture.
For example, when I try to do a VOLUME_UP with GroveGesture like this:
"CLOCKWISE": {
notificationExec: {
notification: "VOLUME_UP",
payload: null,
}
},
it won't work. The gesture is being recognized but the volume does not change.
If I change the payload to 0
it uses the default upDownScale value and works.
And payload {upDownScale: 10}
is working too (volume changes by 10).
But payload: null,
should work too? Am I right?
I want to control volume states with MMM-AssistantMk2 module.
Can I use MMM-Volume notification just with MMM-AssistantMk2?
It's hard to understand the function code of volume control.
Hi Sean ,
I'm trying to achieve the following using Volume Module and notification trigger volume :
triggers: [
{
trigger: "ASSISTANT_RESPONSE_END", // HOTWORD_LISTENING if you use MMM-HOTWORD or HOTWORD_RESUME if you use MMM-AssistantMk2
fires: [
{
fire: "standby_Image",
payload: payload => {
var img = document.getElementById("MY_ANIMATION");
img.src = "modules/MMM-AI/jarvis-standby2.gif";
return payload;
}
}
]
},
{
trigger: "HOTWORD_SLEEPING", // HOTWORD_SLEEPING if you use MMM-HOTWORD or HOTWORD_RESUME if you use MMM-AssistantMk2
fires: [
{
fire: "VOLUME_GET",
exec: "amixer sset -M 'PCM' 10%"
}
]
},
{
trigger: "ASSISTANT_UNDERSTOOD", // HOTWORD_SLEEPING if you use MMM-HOTWORD or HOTWORD_PAUSE if you use MMM-AssistantMk2
fires: [
{
fire: "VOLUME_RESTORE",
payload: payload => {
var img = document.getElementById("MY_ANIMATION");
img.src = "modules/MMM-AI/jarvis-talk2.gif";
return payload;
}
}
]
}
]
}
},
Workflow is like :
Standby -> User hotword -> trigger notification "HOTWORD_SLEEPING" -> Get current Volume by fire: "VOLUME_GET" ( that is where i'm failing ) -> set volume to 10 with the exec ( that works ok -> trigger "ASSISTANT_UNDERSTOOD" -> fire "VOLUME_RESTORE" to restore volume from the previous GET Etc ....
So Far the volume is reduce ok in the right workflow place . But I'm unable to set it back with VOLUME_RESTORE from the previous VOLUME_GET call .
I think i'm not getting how this is working or I might miss some param ?
thanks for your help .
Ejay
When running MMM-Volume, I am getting the static dark blue block on my main MagicMirror's screen - see the screenshot https://github.com/sergge1/bugs/blob/master/MMM-Volume/volume.png
May be this relates to my previous issues #13
{
module: "MMM-Volume",
disabled: false,
position: "top_left", // It is meaningless. but you should set.
config: {
usePresetScript: "ALSA", // "ALSA" is supported by default.
volumeOnStart: 4,
}
},
Raspbian version
pi@raspberrypi:~/MagicMirror $ cat /etc/os-release
>PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
>NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
Linux core
pi@raspberrypi:~/MagicMirror $ uname -a
Linux raspberrypi 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l GNU/Linux
Hardware model
pi@raspberrypi:~/MagicMirror $ cat /proc/device-tree/model
Raspberry Pi 3 Model B Plus Rev 1.3
Node and NPM version
pi@raspberrypi:~ $ node -v v10.18.1
pi@raspberrypi:~ $ npm -v 6.13.4
Audio devices
pi@raspberrypi:~/MagicMirror $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 7/7
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: ALSA [bcm2835 ALSA], device 2: bcm2835 IEC958/HDMI1 [bcm2835 IEC958/HDMI1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: Device_1 [USB Audio Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
Before you post issue, try this first
- Confirm you have completed installation with instruction
Confirmed- Copy your content of
config.js
and paste it into http://esprima.org/demo/validate.html to check whether you have syntax error or not. If there might be errors, usually your issue will be solved by fix those errors.
Confirmed- If you are using
pm2
to execute MM, stop pm2 (pm2 stop mm
) then executenpm start dev
on your MagicMirror directory. It will show front-end log on dev-console of MM, and back-end log on your shell terminal. Both logs are needed to examine.
Confirmed. PM2 is not used
after NOTIFICATION Volume_STORE is sent
MMM-Volume.js:132 Uncaught TypeError: Cannot read property 'faded' of null
at Class.storeVolume (MMM-Volume.js:132)
at Class.notificationReceived (MMM-Volume.js:106)
at sendNotification (main.js:95)
at Object.sendNotification (main.js:498)
at Class.sendNotification (module.js:368)
at Class.notificationReceived (MMM-AI.js:88)
at sendNotification (main.js:95)
at Object.sendNotification (main.js:498)
at Class.sendNotification (module.js:368)
at Class.socketNotificationReceived (MMM-Hotword.js:88)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.