Suggestion for USB mic for Raspberry Pi 4B

I have been using a Logitech c270 webcam to train and test a voice model to a Raspberry Pi 4B. Everything went fine. I was able to download the model and run it on the Raspberry Pi 4B with no problem.

I wanted to use a smaller mic for the project and have purchased a USB Lavalier mic. When I connected the Lavalier mic to the Raspberry Pi 4B, I was able to test out the model on the Studio in the Live Classification mode. See the terminal output below

pi@raspberrypi:~/linux-sdk-python/examples/audio $ edge-impulse-linux --disable-camera
Edge Impulse Linux client v1.3.1

[SER] Using microphone hw:1,0
[WS ] Connecting to wss://remote-mgmt.edgeimpulse.com
[WS ] Connected to wss://remote-mgmt.edgeimpulse.com
[WS ] Device "rasp1" is now connected to project "Waignaujai"
[WS ] Go to https://studio.edgeimpulse.com/studio/80471/acquisition/training to build your machine learning model!
[WS ] Incoming sampling request {
  path: '/api/testing/data',
  label: 'testing',
  length: 3000,
  interval: 0.0625,
  hmacKey: 'd3fe508d0eeb932049c38ee0b636edbe',
  sensor: 'Microphone'
}
[SER] Waiting 2 seconds
[SER] Recording audio...
[SER] Uploading sample to https://ingestion.edgeimpulse.com/api/testing/data...
[SER] Sampling finished
[WS ] Trying to connect in 1 second...
[WS ] Connecting to wss://remote-mgmt.edgeimpulse.com
[WS ] Connected to wss://remote-mgmt.edgeimpulse.com
[WS ] Device "rasp1" is now connected to project "Waignaujai"
[WS ] Go to https://studio.edgeimpulse.com/studio/80471/acquisition/training to build your machine learning model!

I then downloaded the model using the CLI

pi@raspberrypi:~/EImodels $ edge-impulse-linux-runner --download yesNoModel.eim
Edge Impulse Linux runner v1.3.1

[RUN] Downloading model...
[BLD] Created build job with ID 2188028
[BLD] Writing templates...
[BLD] Scheduling job in cluster...
[BLD] Job started
[BLD] Building binary...
[BLD] arm-linux-gnueabihf-g++ -MD -Wall -g -Wno-strict-aliasing -I. -Isource -Imodel-parameters -Itflite-model -Ithird_party/ -Os -DNDEBUG -DEI_CLASSIFIER_ENABLE_DETECTION_POSTPROCESS_OP=1 -g -DEI_CLASSIFIER_USE_FULL_TFLITE=1 -Iedge-impulse-sdk/tensorflow-lite -std=c++14 -c source/main.cpp -o source/main.o
[BLD] arm-linux-gnueabihf-g++ -MD -Wall -g -Wno-strict-aliasing -I. -Isource -Imodel-parameters -Itflite-model -Ithird_party/ -Os -DNDEBUG -DEI_CLASSIFIER_ENABLE_DETECTION_POSTPROCESS_OP=1 -g -DEI_CLASSIFIER_USE_FULL_TFLITE=1 -Iedge-impulse-sdk/tensorflow-lite -std=c++14 -c tflite-model/tflite-trained.cpp -o tflite-model/tflite-trained.o
[BLD] In file included from /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/vector:63,
[BLD] from source/main.cpp:8:
[BLD] /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/stl_uninitialized.h: In function '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = std::move_iterator<nlohmann::basic_json<>*>; _ForwardIterator = nlohmann::basic_json<>*; _Tp = nlohmann::basic_json<>]':
[BLD] /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/stl_uninitialized.h:287:5: note: parameter passing for argument of type 'std::move_iterator<nlohmann::basic_json<>*>' changed in GCC 7.1
[BLD] __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
[BLD] ^~~~~~~~~~~~~~~~~~~~~~
[BLD] /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/stl_uninitialized.h:287:5: note: parameter passing for argument of type 'std::move_iterator<nlohmann::basic_json<>*>' changed in GCC 7.1
[BLD] In file included from /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/vector:69,
[BLD] from source/main.cpp:8:
[BLD] /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/vector.tcc: In member function 'void std::vector<_Tp, _Alloc>::_M_realloc_insert(std::vector<_Tp, _Alloc>::iterator, _Args&& ...) [with _Args = {nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long long int, long long unsigned int, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >}; _Tp = nlohmann::basic_json<>; _Alloc = std::allocator<nlohmann::basic_json<> >]':
[BLD] /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/vector.tcc:413:7: note: parameter passing for argument of type 'std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > >::iterator' {aka '__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >'} changed in GCC 7.1
[BLD] vector<_Tp, _Alloc>::
[BLD] ^~~~~~~~~~~~~~~~~~~
[BLD] In file included from /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/vector:63,
[BLD] from source/main.cpp:8:
[BLD] /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/stl_uninitialized.h:311:2: note: parameter passing for argument of type 'std::move_iterator<nlohmann::basic_json<>*>' changed in GCC 7.1
[BLD] return std::__uninitialized_copy_a
[BLD] ~~~~~~~~~~~~~~~~~~~~~~~~~~~
[BLD] (_GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__first),
[BLD] ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[BLD] _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__last), __result, __alloc);
[BLD] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[BLD] /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/stl_uninitialized.h:311:2: note: parameter passing for argument of type 'std::move_iterator<nlohmann::basic_json<>*>' changed in GCC 7.1
[BLD] return std::__uninitialized_copy_a
[BLD] ~~~~~~~~~~~~~~~~~~~~~~~~~~~
[BLD] (_GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__first),
[BLD] ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[BLD] _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__last), __result, __alloc);
[BLD] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[BLD] In file included from /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/vector:69,
[BLD] from source/main.cpp:8:
[BLD] /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/vector.tcc: In member function 'void std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long long int, long long unsigned int, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >}; _Tp = nlohmann::basic_json<>; _Alloc = std::allocator<nlohmann::basic_json<> >]':
[BLD] /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/vector.tcc:109:4: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >' changed in GCC 7.1
[BLD] _M_realloc_insert(end(), std::forward<_Args>(__args)...);
[BLD] ^~~~~~~~~~~~~~~~~
[BLD] In file included from /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/char_traits.h:39,
[BLD] from /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/ios:40,
[BLD] from /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/ostream:38,
[BLD] from /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/iostream:39,
[BLD] from source/main.cpp:4:
[BLD] /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/stl_algobase.h: In function '_OI std::move(_II, _II, _OI) [with _II = __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >; _OI = std::back_insert_iterator<std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >]':
[BLD] /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/stl_algobase.h:479:5: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >' changed in GCC 7.1
[BLD] move(_II __first, _II __last, _OI __result)
[BLD] ^~~~
[BLD] /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/stl_algobase.h:479:5: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >' changed in GCC 7.1
[BLD] In file included from /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/vector:64,
[BLD] from source/main.cpp:8:
[BLD] /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/stl_vector.h: In member function 'void std::vector<_Tp, _Alloc>::reserve(std::vector<_Tp, _Alloc>::size_type) [with _Tp = nlohmann::basic_json<>; _Alloc = std::allocator<nlohmann::basic_json<> >]':
[BLD] /toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/bits/stl_vector.h:1401:35: note: parameter passing for argument of type 'std::move_iterator<nlohmann::basic_json<>*>' changed in GCC 7.1
[BLD] std::__uninitialized_copy_a(__first, __last, __result,
[BLD] ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
[BLD] _M_get_Tp_allocator());
[BLD] ~~~~~~~~~~~~~~~~~~~~~~
[BLD] In file included from source/main.cpp:10:
[BLD] third_party/json/json.hpp: In member function 'void nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::json_value::destroy(nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::value_t) [with ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long long int; NumberUnsignedType = long long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>]':
[BLD] third_party/json/json.hpp:17759:26: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >' changed in GCC 7.1
[BLD] std::move(array->begin(), array->end(), std::back_inserter(stack));
[BLD] ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[BLD] third_party/json/json.hpp:17780:30: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >' changed in GCC 7.1
[BLD] std::move(current_item.m_value.array->begin(), current_item.m_value.array->end(),
[BLD] ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[BLD] std::back_inserter(stack));
[BLD] ~~~~~~~~~~~~~~~~~~~~~~~~~~
[BLD] mkdir -p build
[BLD] arm-linux-gnueabihf-g++ edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix2_q15.o edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix2_f32.o edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_rfft_q15.o edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_rfft_f32.o edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_rfft_fast_f64.o edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix2_q31.o edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_rfft_fast_init_f64.o edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_rfft_init_q15.o edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_rfft_q31.o edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix4_f16.o edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_rfft_fast_f16.o edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix4_init_f16.o edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_cfft_f16.o edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix4_f32.o edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_rfft_fast_f32.o edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_cfft_q15.o edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/arm_cfft_f32.o edge-impulse-

(some of the output deleted for brevity - Francis)

sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_logsumexp_dot_prod_f32.o edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_min_f16.o edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_entropy_f16.o edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_max_q31.o edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFu
    [BLD] nctions/arm_min_q15.o edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_min_f32.o edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_entropy_f32.o edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_var_f16.o edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_kullback_leibler_f64.o edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_kullback_leibler_f32.o edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_rms_f16.o edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/arm_min_q31.o source/main.o tflite-model/tflite-trained.o edge-impulse-sdk/dsp/kissfft/kiss_fft.o edge-impulse-sdk/dsp/kissfft/kiss_fftr.o edge-impulse-sdk/dsp/dct/fast-dct-fft.o ./edge-impulse-sdk/dsp/memory.o edge-impulse-sdk/porting/posix/ei_classifier_porting.o edge-impulse-sdk/porting/posix/debug_log.o edge-impulse-sdk/porting/mingw32/ei_classifier_porting.o edge-impulse-sdk/porting/mingw32/debug_log.o  -o build/linux-impulse-runner -lm -lstdc++ -L./tflite/linux-armv7 -Wl,--no-as-needed -ldl -ltensorflow-lite -lcpuinfo -lfarmhash -lfft2d_fftsg -lfft2d_fftsg2d -lruy -lXNNPACK -lpthread
    [BLD] Building binary OK
    [RUN] Downloading model OK
    [RUN] Stored model in /home/pi/EImodels/yesNoModel.eim

However, when I ran the audio classify.py example, I got a message “the audio device is not compatible”. See output below

pi@raspberrypi:~/linux-sdk-python/examples/audio $ python3 classify.py /home/pi/EImodels/yesNoModel.eim
Loaded runner for "Francis K Tse / Waignaujai"
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.vc4-hdmi.pcm.front.0:CARD=4'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM front
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.vc4-hdmi.pcm.surround51.0:CARD=4'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.vc4-hdmi.pcm.surround51.0:CARD=4'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.vc4-hdmi.pcm.surround40.0:CARD=4'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.vc4-hdmi.pcm.surround51.0:CARD=4'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.vc4-hdmi.pcm.surround51.0:CARD=4'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.vc4-hdmi.pcm.surround51.0:CARD=4'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.vc4-hdmi.pcm.surround71.0:CARD=4'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.vc4-hdmi.pcm.iec958.0:CARD=4,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM iec958
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.vc4-hdmi.pcm.iec958.0:CARD=4,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.vc4-hdmi.pcm.iec958.0:CARD=4,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_a52.c:823:(_snd_pcm_a52_open) a52 is only for playback
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.vc4-hdmi.pcm.iec958.0:CARD=4,AES0=6,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM iec958:{AES0 0x6 AES1 0x82 AES2 0x0 AES3 0x2  CARD 4}
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
1 --> USB Lavalier Microphone: Audio (hw:1,0)
3 --> pulse
4 --> default
Type the id of the audio device you want to use: 
1
That device is not compatible
1 --> USB Lavalier Microphone: Audio (hw:1,0)
3 --> pulse
4 --> default
Type the id of the audio device you want to use:

This did not happen with the Logitech c270 webcam. Did I do something wrong or do I have to pick a compatible USB mic to use? Does anyone have a USB mic they have successfully used on the Raspberry Pi 4B with Edge Impulse models?

Thanks,
Francis.

Hi @FrancisTse,

Does the lavalier mic require any further audio/mic drivers for use on the RPi? This Raspberry Pi user also had a similar Unknown PCM error here: https://forums.raspberrypi.com/viewtopic.php?t=310775

Please let me know if this resolves your issue! Otherwise I’ll keep looking. :slight_smile:

Hello @jenny,

I did not have to load any drivers. I just plugged in the Lavalier mic and the RPi OS seems to recognize it. The USB mic showed up when I did a arecord -l. I was also able to record with the mic and play back the recorded .wav file. See terminal output below:

francis@raspberrypi:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Microphone [USB Lavalier Microphone], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
francis@raspberrypi:~ $ arecord --device=hw:1,0 --format S16_LE --rate 44100 -V mono -c1 test3.wav
Recording WAVE 'test3.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
##+                                                | 03%^CAborted by signal Interrupt...
# +                                                | 03%francis@raspberrypi:~ $ 
francis@raspberrypi:~ $ ls -l *.wav
-rw-r--r-- 1 francis francis 727760 Feb 11 16:58 test2.wav
-rw-r--r-- 1 francis francis 606474 Feb 15 15:43 test3.wav
francis@raspberrypi:~ $ aplay test3.wav
Playing WAVE 'test3.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono

Here is a summary of what I used and the observations:

  • I am running the latest 32-bit Raspberry Pi OS (bullseye) on a Raspberry Pi 4B with 8 GB

  • By now, I tested two USB mics and saw similar results - one is a Lavalier mic made by Maono, model number is AU-UL10 and the second one is mini USB mic made by SunFounder

  • Both USB mics were recognized by arecord without having to load any drivers. I was able to use arecord to capture and playback a .wav file

  • Both USB mics were recognized by alsamixer as well

  • Both mics worked with Edge Impulse Studio in the Live Classification mode to capture test audio files. After capture, files were uploaded and classifications performed as expected.

  • Only problem is that I keep getting a “the audio device is not compatible” message when trying to use the USB mics with the classify.py audio example.

Thanks for looking into this.

Best regards,
Francis.

Hello @jenny,

After replying to you, I went ahead and tried running puaudio.PyAudio() to repeat what the author in https://forums.raspberrypi.com/viewtopic.php?t=310775 did. Interestingly enough, I got the same kind of error when I ran the python program code given at the end of that message. I created a python program capture_audio_test.py and copied the code to it. When I ran the code, I got similar errors. However, I was able to capture audio which I played back to confirm. I tried it with both the Logitech c270 as well as the Lavalier mic. They both gave the error but also recorded my voice.

Below is the output for the Lavalier mic:

francis@raspberrypi:~/linux-sdk-python/examples/audio $ python3 capture_audio_test.py
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.front.0:CARD=0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM front
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.surround40.0:CARD=0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.surround71.0:CARD=0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM iec958
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_a52.c:823:(_snd_pcm_a52_open) a52 is only for playback
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.iec958.0:CARD=0,AES0=6,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM iec958:{AES0 0x6 AES1 0x82 AES2 0x0 AES3 0x2  CARD 0}
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
Recording
Finished recording
out_2_21_2022_18_50_46.wav saved
francis@raspberrypi:~/linux-sdk-python/examples/audio $ aplay out*.wav
Playing WAVE 'out_2_21_2022_18_50_46.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono

And, the following is with the Logitech c270 web cam:

francis@raspberrypi:~/linux-sdk-python/examples/audio $ python3 capture_audio_test.py
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.front.0:CARD=0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM front
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.surround40.0:CARD=0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.surround51.0:CARD=0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.surround71.0:CARD=0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM iec958
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM spdif
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.hdmi.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM hdmi
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_a52.c:823:(_snd_pcm_a52_open) a52 is only for playback
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.bcm2835_headpho.pcm.iec958.0:CARD=0,AES0=6,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM iec958:{AES0 0x6 AES1 0x82 AES2 0x0 AES3 0x2  CARD 0}
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
Recording
Finished recording
out_2_21_2022_18_34_39.wav saved
francis@raspberrypi:~/linux-sdk-python/examples/audio $ aplay out*.wav
Playing WAVE 'out_2_21_2022_18_0_55.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
Playing WAVE 'out_2_21_2022_18_33_35.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
Playing WAVE 'out_2_21_2022_18_34_39.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono

This is confusing to me. Why all this error? Anyway, thought I share this with you if it is helpful.

Best regards,
Francis.

Hi @FrancisTse,

What further troubleshooting steps have you tried? Because I do not have the same hardware as you I am unable to reproduce the error with this Python library.

Hello @jenny,

I looked at the edge_impulse_linux/audio.py source code on github. It appears that the issue has to do with the call to the pyaudio.PyAudio().is_format_supported() method which returned a False based on the rate parameter entered. See the PyAudio class documentation for more details. This seems to be cause by the Lavalier mic not supporting the 16000 samples per second rate that the model was trained on.

To test this hypothesis, I used the following snippet of Python code with the two mics and found that the code returns a supported=True for the c270 mic and not the Lavalier mic:

print('Check if device is compatible ...')
supported = p.is_format_supported(
    16000,
    input_device=1,
    input_channels=1,
    input_format=pyaudio.paInt16
)
print(supported)

Then, running arecord and aplay on the two mic, I get the following for the c270:

francis@raspberrypi:~/linux-sdk-python/examples/audio $ arecord --device=hw:1,0 --format S16_LE --rate 16000 -V mono -c1 c270_10sec_at_16000.wav
Recording WAVE 'c270_10sec_at_16000.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono
#+                                                 | 01%^CAborted by signal Interrupt...
#+                                                 | 01%
francis@raspberrypi:~/linux-sdk-python/examples/audio $ arecord --device=hw:1,0 --format S16_LE --rate 44100 -V mono -c1 c270_10sec_at_44100.wav
Recording WAVE 'c270_10sec_at_44100.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
Warning: rate is not accurate (requested = 44100Hz, got = 48000Hz)
         please, try the plug plugin 
#+                                                 | 01%^CAborted by signal Interrupt...
#+                                                 | 01%
francis@raspberrypi:~/linux-sdk-python/examples/audio $ ls -l c27*.wav
-rw-r--r-- 1 francis francis  292044 Feb 23 19:40 c270_10sec_at_16000.wav
-rw-r--r-- 1 francis francis 1116044 Feb 23 19:41 c270_10sec_at_44100.wav
francis@raspberrypi:~/linux-sdk-python/examples/audio $ aplay c270_10sec_at_16000.wav
Playing WAVE 'c270_10sec_at_16000.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono
francis@raspberrypi:~/linux-sdk-python/examples/audio $ aplay c270_10sec_at_44100.wav
Playing WAVE 'c270_10sec_at_44100.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono

And this for the Lavalier mic:

francis@raspberrypi:~/linux-sdk-python/examples/audio $ arecord --device=hw:1,0 --format S16_LE --rate 16000 -V mono -c1 lav_1sec_at_16000.wav
Recording WAVE 'lav_10sec_at_16000.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono
Warning: rate is not accurate (requested = 16000Hz, got = 44100Hz)
         please, try the plug plugin 
###+                                               | 05%^CAborted by signal Interrupt...
## +                                               | 05%
francis@raspberrypi:~/linux-sdk-python/examples/audio $ arecord --device=hw:1,0 --format S16_LE --rate 44100 -V mono -c1 lav_10sec_at_44100.wav
Recording WAVE 'lav_10sec_at_44100.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
###+                                               | 05%^CAborted by signal Interrupt...
###+                                               | 05%
francis@raspberrypi:~/linux-sdk-python/examples/audio $ ls -l lav*.wav
-rw-r--r-- 1 francis francis 1036488 Feb 23 17:40 lav_10sec_at_16000.wav
-rw-r--r-- 1 francis francis  992384 Feb 23 17:42 lav_10sec_at_44100.wav
francis@raspberrypi:~/linux-sdk-python/examples/audio $ aplay lav_10sec_at_16000.wav
Playing WAVE 'lav_10sec_at_16000.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
francis@raspberrypi:~/linux-sdk-python/examples/audio $ aplay lav_10sec_at_44100.wav
Playing WAVE 'lav_10sec_at_44100.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono

From the above, it appears that USB mics have different recording rates that they support. See the Warning from the arecord output and look at the actual recorded rate shown on the aplay output as well as the file sizes. It appear that finding a mic to work at 16000 samples per sec could be a real problem as indicated by this posting. They also mention that the c270 is the only device that can record at 16000 sampling rate. Seems like the original author was also looking for a small mic that supports sampling at 16000 rate.

If you know of such a mic, please let me know. Also, I might go back to play around with changing the sampling rate on my Edge Impulse model generation. However, higher rate would mean more processing. Seems like more things for me to learn. Appreciate your help.

Thanks and best regards,
Francis.

1 Like