Tag Archives: Voice

[Solved] ROS fatal error: alsa/asoundlib. h: There is no such directory or file

Ubuntu18. 04 + catkin for ROS melody_Make compile robot_Voice, the error message is as follows:,

Scanning dependencies of target iat_publish
[ 12%] Building CXX object robot_voice/CMakeFiles/iat_publish.dir/src/iat_publish.cpp.o
[ 25%] Building C object robot_voice/CMakeFiles/iat_publish.dir/src/linuxrec.c.o
cc1: warning: command line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C
/home/mc/ros/vision/src/robot_voice/src/linuxrec.c:12:10: fatal error: alsa/asoundlib.h: 没有那个文件或目录
 #include <alsa/asoundlib.h>
          ^~~~~~~~~~~~~~~~~~
compilation terminated.
robot_voice/CMakeFiles/iat_publish.dir/build.make:110: recipe for target 'robot_voice/CMakeFiles/iat_publish.dir/src/linuxrec.c.o' failed
make[2]: *** [robot_voice/CMakeFiles/iat_publish.dir/src/linuxrec.c.o] Error 1
CMakeFiles/Makefile2:449: recipe for target 'robot_voice/CMakeFiles/iat_publish.dir/all' failed
make[1]: *** [robot_voice/CMakeFiles/iat_publish.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j12 -l12" failed

Solution:

sudo apt-get install libasound2-dev

Or

sudo yum install alsa-lib-devel

Playing audio in termux

I have tried all kinds of apt install software, using Python library to write code to run (all kinds of libraries are not available), using java to write code to run (using Android’s own API), all failed. The reasons all point to one point: there is no default audio.

Analysis: because the execution environment is termux, there is no default setting in termux. Android is the real system of the outer system of termux. As long as the sound card, driver, default device and so on are set in termux, they can also be executed after setting.

Here’s a simpler way:

Premise: tinyalsa, root identity, a 44.1KHz audio, turn on the volume

Play command:

./tinyalsa play ~/test.wav

 
View command:

/tinyalsa tinymix

./tinyalsa tinypcminfo -D /proc/asound/cards

cat /proc/asound/cards

 
Set the output device to speaker:

/tinyalsa tinymix 0 SPK

 
Write the play command into a script, give him permission, you can play and use it freely!

After a variety of searches, a better solution was found:

Better and simpler solutions

When python installs pocketsphinx module (package), an error is reported: command ‘swig.exe’ failed: No such file or directory

Today, when installing Pocket Sphinx, the error command ‘swig.exe’ failed: No such File or Directory. I found a lot of content on the Internet, and finally I succeeded.
first of all, my computer is Windows10 system, the method is only available for Windows system, other systems do not know.
error is due to the fact that swig is missing from your computer, so you need to download and install it. I download from the website of the latest package swig 4.0.2, website address is: http://www.swig.org/download.html.
to unzip the downloaded files to C pan-gen directory. I want to emphasize the root directory here, because my previous attempts to put it in C:\Program Files (x86) still didn’t work (for unknown reasons). Finally, I just put it under C:\swigwin-4.0.2.
then add a new path path to the environment variable.

after the above steps are completed, then there is no problem with installing pocketsphinx.

Error occurred when Python installed the pocketsphinx module (package): Command‘ swig.exe “Failed: no such file or directory

command ‘swig.exe’ failed: No such file or directory when installing pocket sphinx today. I found a lot of content on the Internet, and finally I succeeded.
first of all, my computer is Windows10 system, the method is only available for Windows system, other systems do not know.
error is due to the fact that swig is missing from your computer, so you need to download and install it. I download from the website of the latest package swig 4.0.2, website address is: http://www.swig.org/download.html.
to unzip the downloaded files to C pan-gen directory. I want to emphasize the root directory here, because my previous attempts to put it in C:\Program Files (x86) still didn’t work (for unknown reasons). Finally, I just put it under C:\swigwin-4.0.2.
then add a new path path to the environment variable.

after the above steps are completed, then there is no problem with installing pocketsphinx.