I am trying to use porcupine on my Jetson Nano as a wake word. In order to do this I need to record audio in pcm format(which I believe is raw format) using python. I also need the sample rate to be 16,000 and 16bit linearly encoded on single channel. My input device index is 11. So, How would I be able to record audio in this format using python?
1 Answers
It looks like there is a demo already setup for this from porcupine's side.
Checkout their demo here - it's a lot of code so I won't paste it all.
Essentially it requires installing the pvporcupinedemo package:
$ sudo pip3 install pvporcupinedemo
And then running the demo script (located in the Python demo) to start running the processing:
$ porcupine_demo_mic --access_key ${ACCESS_KEY} --keywords picovoice
There are various arguments to this script, which can be found documented in the repo itself.
The demo explicitly states that this should work for the Jetson Nano:
Runs on Linux (x86_64), Mac (x86_64 and arm64), Windows (x86_64), Raspberry Pi (all variants), NVIDIA Jetson (Nano), and BeagleBone.
To make sure the demo detects your microphone, you can run the detect mic script flag:
$ porcupine_demo_mic --show_audio_devices
And you should see something like:
index: 0, device name: USB Audio Device
index: 1, device name: MacBook Air Microphone
Then you can determine which mic is correct, and use the index as an argument to the demo, e.g. for the "USB Audio Device":
$ porcupine_demo_mic --access_key ${ACCESS_KEY} --keywords picovoice --audio_device_index 0
I would then go ahead and start picking apart the code in their demo to modify it as required.
-
1hello, thanks for your help but what I'm actually trying to do is pvporcupine not pvporcupinedemo so I am implementing this on python on Jetson Nano. So I just need to implement **get_next_audio_frame()** but I am currently constantly getting afailure becuase of it needs to have certain sample_rate and the audio file needs to be in pcm format. Do you know how I can implment get_next_audio_frame in this format? – gs97ahn Jan 16 '22 at 06:59