1 |
sudo apt-get install alsa-utils sox libsox-fmt-all |
1 2 3 4 5 |
pi@raspberrypi:~/aws-iot/AwsIoTListener $ arecord -l **** ハードウェアデバイス CAPTURE のリスト **** カード 1: Device [USB PnP Sound Device], デバイス 0: USB Audio [USB Audio] サブデバイス: 1/1 サブデバイス #0: subdevice #0 |
1 2 |
pi@raspberrypi:~/aws-iot/AwsIoTListener $ arecord -f S16_LE -r 44100 -D hw:0,0 record.wav arecord: main:788: audio open error: そのようなファイルやディレクトリはありません |
1 2 3 4 5 |
pi@raspberrypi:~/aws-iot/AwsIoTListener $ lsusb Bus 001 Device 004: ID 8086:0808 Intel Corp. Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub |
1 2 3 |
pi@raspberrypi:~/aws-iot/AwsIoTListener $ cat /proc/asound/modules 0 snd_bcm2835 1 snd_usb_audio |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
pi@raspberrypi:~/aws-iot/AwsIoTListener $ amixer -c 1 sget Mic Simple mixer control 'Mic',0 Capabilities: cvolume cvolume-joined cswitch cswitch-joined Capture channels: Mono Limits: Capture 0 - 16 Mono: Capture 0 [0%] [0.00dB] [on] pi@raspberrypi:~/aws-iot/AwsIoTListener $ amixer -c 1 sset Mic 60% Simple mixer control 'Mic',0 Capabilities: cvolume cvolume-joined cswitch cswitch-joined Capture channels: Mono Limits: Capture 0 - 16 Mono: Capture 10 [62%] [14.88dB] [on] pi@raspberrypi:~/aws-iot/AwsIoTListener $ pi@raspberrypi:~/aws-iot/AwsIoTListener $ amixer -c 1 sget Mic Simple mixer control 'Mic',0 Capabilities: cvolume cvolume-joined cswitch cswitch-joined Capture channels: Mono Limits: Capture 0 - 16 Mono: Capture 10 [62%] [14.88dB] [on] |
カード番号を合わせると録音できた。
1 2 3 |
pi@raspberrypi:~/aws-iot/AwsIoTListener $ arecord -D plughw:1,0 -d 10 -f cd test.wav 録音中 WAVE 'test.wav' : Signed 16 bit Little Endian, レート 44100 Hz, ステレオ ^Cシグナル 割り込み で中断... |
失敗する
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
pi@raspberrypi:~/aws-iot/AwsIoTListener $ sudo pip install pyaudio Collecting pyaudio Downloading https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz Building wheels for collected packages: pyaudio Running setup.py bdist_wheel for pyaudio ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-1ahdfw/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpGn57Onpip-wheel- --python-tag cp27: running bdist_wheel running build running build_py creating build creating build/lib.linux-armv6l-2.7 copying src/pyaudio.py -> build/lib.linux-armv6l-2.7 running build_ext building '_portaudio' extension creating build/temp.linux-armv6l-2.7 creating build/temp.linux-armv6l-2.7/src arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-9xgeTe/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-armv6l-2.7/src/_portaudiomodule.o src/_portaudiomodule.c:29:23: fatal error: portaudio.h: そのようなファイルやディレクトリはありません #include "portaudio.h" ^ compilation terminated. error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1 ---------------------------------------- Failed building wheel for pyaudio Running setup.py clean for pyaudio Failed to build pyaudio Installing collected packages: pyaudio Running setup.py install for pyaudio ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-1ahdfw/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-BFv9vm-record/install-record.txt --single-version-externally-managed --compile: running install running build running build_py creating build creating build/lib.linux-armv6l-2.7 copying src/pyaudio.py -> build/lib.linux-armv6l-2.7 running build_ext building '_portaudio' extension creating build/temp.linux-armv6l-2.7 creating build/temp.linux-armv6l-2.7/src arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-9xgeTe/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/_portaudiomodule.c -o build/temp.linux-armv6l-2.7/src/_portaudiomodule.o src/_portaudiomodule.c:29:23: fatal error: portaudio.h: そのようなファイルやディレクトリはありません #include "portaudio.h" ^ compilation terminated. error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1 ---------------------------------------- Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-1ahdfw/pyaudio/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-BFv9vm-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-1ahdfw/pyaudio/ |
次のコマンドで失敗
1 |
sudo pip install --global-option='build_ext' --global-option='-I/usr/local/include' --global-option='-L/usr/local/lib' pyaudio |
次で入れる
1 |
$ sudo apt-get install python-pyaudio |
次のように
1 2 |
$ sudo pip install pyaudio Requirement already satisfied: pyaudio in /usr/lib/python2.7/dist-packages |
マイクの音量が小さくなっている。
1 |
amixer -D hw:1 sset Mic 100% |