Google Chat: zj734465502@gmail.com
+86-0755-88291180
sales01@spotpear.com
dragon_manager@163.com
services01@spotpear.com
manager01@spotpear.com
WhatsApp:13246739196
This is a USB sound card, support recording and playback, stereo codec, built-in microphone, and speaker. It is suitable for Jetson Nano. driver-free, plug, and play.
1. Connect the Audio Card for Jetson Nano to Jetson Nano with the USB adapter
2. Connect the 8Ω5W speaker to the speaker connector.
3. Start the Jetson Nano
jetson@linux:~$ aplay -l **** List of PLAYBACK Hardware Devices **** ... ... ... ... card 2: Device [USB PnP Audio Device], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0
jetson@linux:~$ arecord -l **** List of CAPTURE Hardware Devices **** ... ... ... ... card 2: Device [USB PnP Audio Device], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0
jetson@linux:~$ arecord -D plughw:2,0 -f S16_LE -r 48000 -c 2 test.wav Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
-D "plughw:1,0": stands for card 1 , device 0, that is the USB card connected.
-f S16_LE: Little-endian signed 16 bits;
-c 2: Dual-track;
test.wav: The avido file saved
Youc an press Ctrl+C to stop recording.
jetson@linux:~$ aplay -D hw:2,0 test.wav Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Play the audio recorded
sudo alsamixer
You can press F6 to select the audio device if you didn't set the USB audio card as the default audio device.
Speaker is the volume of the speaker and the Mic is the volume of the Microphone.
Becase the GUI of Jetson Nano 4GB and the 2GB version are different, please read the guide according to your Jetson Nano Board
Note: If you didn't set the Audio Card for Jetson Nano as the default audio card, the examples may not work normally.
Enter the GUI, and click the audio icon to configure the audio. Choose USB PnP Audio Device for Output/Input
Enter the GUI, click the Menu on the right-bottom. Choose Sound & Video - >PulseAudio Volume Control and open.
On the Playback/Recording page, set the audio output as USB PnP Audio Device.
Note: The options can only work when your run the codes, otherwise, you can only find the System Sounds option but not the SoX. If you didn't read the sound when running the codes, please check if you have set the USB PnP Audio Device as the default audio output
wget https://www.waveshare.com/w/upload/a/ae/Audio_Card_for_jetson_nano.tar.gz tar zxvf Audio_Card_for_jetson_nano.tar.gz
sudo apt-get update sudo apt-get install python3-dev python3-venv python3 -m venv env env/bin/python -m pip install --upgrade pip setuptools wheel source env/bin/activate
source ~/env/bin/activate
To use Google Assistant, you need to first install the Google Assistant Service
Official guides: https://developers.google.com/assistant/sdk/guides/service/python
Please follow step 3 of the guides to configure the developer project and the account, and then create an OAuth Client ID JSON file. And you need to copy the JSON file to your jetson nano.
Please follow step 4 to register the device model.
Install Google Assistant SDK
(env) $ sudo apt-get install portaudio19-dev libffi-dev libssl-dev (env) $ python -m pip install --upgrade google-assistant-sdk[samples]
Authorize the Google Assistant SDK Install or update the authorization tools.
(env) $ python -m pip install --upgrade google-auth-oauthlib[tool]
Generate the credential for running examples and tools. Import the JSON file downloaed before. Please directly copy the JSON file and do not rename it,
(env) $ google-oauthlib-tool --scope https://www.googleapis.com/auth/assistant-sdk-prototype \ --save --headless --client-secrets /path/to/client_secret_ client-id .json
Following the command you will get a URL:
Please visit this URL to authorize this application: https://...
Copy the URL and go to the website by the browser. The link is the login page of Google, you should log in with your Google account (Please use the developer account created before) Allow the license request from the API, and you will get a CODE like “ 4 / XXXX”, please copy the code to the terminal of Jetson nano:
Please go to this URL: https://... Enter the authorization code:
If the authorize successfully, you will get the response as below. If you get InvalidGrantError response, you may input the wrong code, please try it again.
credentials saved: /path/to/.config/google-oauthlib-tool/credentials.json
Run the following command to test my-dev-project is the Google Cloud Platform device ID of Action Console project created. You need to find the project ID in Actions Console, my-model
is the devcie model registered.
(env) $ googlesamples-assistant-pushtotalk --project-id my-dev-project --device-model-id my-model
Press Enter and try to test: Who am I? What time is it? Google Assitant will answer if all the settings are correct.
cd ~/Audio_Card_for_jetson_nano/google deactivate #Exit env python3 demo.py hotword.pmdl
Run the command and you will get the information that "Listening...", means that the examples are standby and you can speaker keyword to wake up the assistant and talk. For example: "ok google, Who am I? What time is it?". The assistants will respond with a tone.
Note 1: The hotword.pmd is the voice model of Waveshare, and you need to train your own voice model and replace it, otherwise you may fail to wake it up.
Note 2: The account used in the demo codes is a personal account and it has limitations of login times. Please create your own account and modify the device_model_id and device_id in audiofileinput.py.
snowboy is an open-source project for audio detecting. You can use it for sound wake-up.
sudo apt-get install swig sudo apt-get install libatlas-base-dev sudo apt-get install portaudio19-dev sudo apt-get install flac pip3 install PyAudio pip3 install SpeechRecognition
git clone https://github.com/Kitt-AI/snowboy.git cd snowboy/swig/Python3
vi Makefile
ifneq (,$(findstring aarch64,$(shell uname -m))) SNOWBOYDETECTLIBFILE = $(TOPDIR)/lib/aarch64-ubuntu1604/libsnowboy-detect.a endif
And then compile
make
cd ../../examples/Python3
cd ~/snowboy/examples/Python3 python3 demo.py resources/models/smart_mirror.umdl
INFO:snowboy:Keyword 1 detected at time: 2019-12-03 11:30:16
Note: The keyword use public model, you can train you own model and change the keyword for better detecting.