Read the statement by Michael Teeuw here.
arecord sudo only
-
Hello
I installed a USB-Micro and a speaker on the headphone socket.
I used aplay and arecord to test.
when typing aplay … and enter it runs and plays the sound
when typing arecord…out.wav it says no rights
so I tried sudo arecord… it runs and records the file, which I can listen to via aplay.MagicMirror cannot access the micro because of sudo.
How can I change the rights for arecord so MM can use it?
Manfred
-
@kupperma chmod and chown are the two commands to change permissions and group assignments
which arecord
will tell you where it is
ls ??? -laF
will give you the current info
??? is the output of whichpermissions are 3 settings read/write/execute
for each of 3 user relationshipsuser - user is the owner
group - user accessing is my the owner, but in the group
other - user accessing is not in the above3 bits
4 - read
2 - write
1 - execute7 is all 3
6 is read/write
2 is write only777 is all permissions for all users ( bad)
each user has their own group as well.
u will need to use sudo to change the permissions or user/group assignments
see the help for each command, for example
chmod --help
-
@sdetweil
Thank you for your reply.pi@raspberrypi:/ $ arecord --format=S16_LE --duration=5 --rate=16000 --file-type=wav out.wav
Aufnahme: WAVE ‘out.wav’ : Signed 16 bit Little Endian, Rate: 16000 Hz, mono
out.wav: Keine BerechtigungThis ist the arecord without sudo
pi@raspberrypi:/ $ sudo arecord --format=S16_LE --duration=5 --rate=16000 --file-type=wav out.wav
Aufnahme: WAVE ‘out.wav’ : Signed 16 bit Little Endian, Rate: 16000 Hz, monoand here the task with sudo.
ls arecord or find arecord – file or folder not found.
I assume that arecord is part of aplay probably of the alsa family.
But why do tasks of the same family ask for different rights.Manfred
-
@kupperma oh, you are in the root folder /
it’s the write of out.wav that is causing the problem
cd ~
to go to the users home folder
everything (mm related) should be installed there
generally, never use sudo unless u know WHY u need to do that
-
@kupperma on your ls arecord, file not found
u forgot to do
which arecord
and use it’s output, the full path to arecord
-
@sdetweil
pi@raspberrypi:~ $ which arecord
/usr/bin/arecordpi@raspberrypi:~ $ ls /usr/bin/arecord -laF
lrwxrwxrwx 1 root root 5 16. Apr 2021 /usr/bin/arecord -> aplay*Is it that way that I have to set the microphone in MM separately so that the Module MMM-voice will recognize the micophone which is on card 1 device 0.
-
@kupperma said in arecord sudo only:
wxrwxrwx
areceord is execuatble by the user (root) and the group(root) and others (everyone else)
arecord -l
will list recording devices
mmm-voice says config
microphone REQUIRED Id of microphone shown in the installer.
shown in the installer <---- thats the key
-
@sdetweil
thank you,
I have set in the config of MMM-voice the microphone 1, but there is still an error.
I will ask the developer of MMM-voice.Manfred