Trying to record audio using Nicla Voice
Compiling Record_and_Stream fails with errors
Record_and_stream_test:51:19: error: no matching function for call to 'audio_tools::G722Encoder::begin(audio_tools::AudioInfo&)'
encoder.begin(bi);
Record_and_stream_test:53:11: error: 'class audio_tools::G722Encoder' has no member named 'setOutputStream'; did you mean 'setOutput'?
encoder.setOutputStream(Serial);
Libraries are arduino-audio-tools-main@0.9.6 and arduino-libg722-master@1.0.2
Also that sketch mentions setting
Setup the serial port as raw
How do you to do that on a Windows machine?
The cause of the compilation failure is some breaking changes (e.g., pschatzmann/arduino-audio-tools@bbe9fd6) that were made in the 3rd party "audio-tools" library dependency since the time the "NDP" library developers wrote that "Record_and_stream" example sketch.
Resolution
The solution is to use the compatible version of the "audio-tools" library.
I'll provide instructions you can follow to install that version of the library:
A. Remove existing installation of "audio-tools" library
Select File > Preferences...(or Arduino > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open.
Take note of the path shown in the "Sketchbook location" preference.
Click the "Cancel" button.
The "Preferences" dialog will close.
Select File > Quit from the Arduino IDE menus.
All Arduino IDE windows will close.
Delete the folder at the following path on your hard drive:
Click the "Source code (zip)" link you will see under the "Assets" section of that page.
A download of the ZIP file of the library will start.
Wait for the download to finish.
Select Sketch > Include library > Add .ZIP Library from the Arduino IDE menus.
Select the downloaded file.
Click the "Open" button.
Wait for the message to appear on the teal bar in the Arduino IDE Window:
Library added to your libraries. Check "Include library" menu
Now try compiling or uploading the sketch again. Hopefully this time it will compile and work as expected.
Please let me know if you have any questions or problems while following those instructions.
Follow up
In order to make all relevant information available to any who are interested in this subject, I'll share a link to your report about the breakage of the example sketch in the issue tracker of the arduino/ArduinoCore-mbed repository where the "NDP" library and examples are hosted:
Even though it is possible for the users to work around that problem by installing the compatible version of the "audio-tools" library, it will be a good idea for the example to be updated to be compatible with the latest version of the library. Your issue report will allow the developers to track that task.
Open teraTerm, start File->log
Then Setup->Serial Port and select your nicla Voice serial and set 115200 baud, 8bit, parity None, stop bits 1, Flow control None.
and click New Setting.
Screen shows strange chars as data comes in.
Close log when you are finished recording.
Install Audacity for Windows audacity-win-3.5.1-64bit.exe
from Audacity ® | Download for Windows
also install FFmpeg support from https://lame.buanzo.org/FFmpeg_5.0.0_for_Audacity_on_Windows_x86_64.exe
Start Audacity and open file teraterm.log
get error msg "Could not open file ... incorrect file type"
click OK, but file does not open
rename file extension to .g722, that is to teraterm.g722
open again. Get same error msg "incorrect file type"
but this time clicking OK, opens file in Audacity and you can play and edit it.
You are welcome. I'm glad if I was able to be of assistance. Thanks for taking the time to post an update with your findings!
It is truly their 0.9.6 release. The reason why Arduino IDE thinks it is 0.9.5 is because the library maintainer made the too common mistake of forgetting to update the version field in the library's library.properties metadata file before they pushed the v0.9.6 Git tag:
But it is important to be clear that this is the 0.9.6 release of the library. If we call it "0.9.5", that is ambiguous because there is a 0.9.5 release of the library:
Hi i tried your method and all i hear is noise and not anything... Just fzzzzzzz like radios when don t find signal, do you know why? thanks. I am using nicla voice and i know microphone works cause i don t have problem with the cloud system
Sorry no ideas
It just worked for me once I fixed the library compile problem.
Here is the sketch I used Record_and_stream.ino (1.4 KB)
Send me a PM if you want a copy of the libraries I used (too large to put here)
Note: make sure you are loading the correct model. The above sketch loads the default model. You need to change that to match the model you have uploaded. i.e. update this line to the model actually on your board NDP.load("alexa_334_NDP120_B0_v11_v91.synpkg"); <<<<<<<<<
I gave up on NiclaVoice shortly after as
i) it was not suitable for my Rain Sensor application
ii) it was expensive
iii) Arduino did not seem interested in keeping it current or updating the docs and libraries leading to problems like this thread
iv) it seemed to be destined to be another Arduino orphan board
Thank you very much, i didn t upload a model ad that was the problem. So for every sketch you need to load a model the dsp and mcu firmware? even if you are not using a ML model? I have to use this board for a thesis project with a company so i am kinda forced
There is a load model command in the sketch. Seems you need to do that.
Don't get me wrong, there are projects that seem to get usable results for word recognition, which is what the board was designed for. So may also work for you if that is what you are doing.
In my case rain drops only ping for 0.1sec, much less than the ~1sec signal sample time for the Nicla AI processing. Also the AI had trouble rejecting ambient noise like an air conditioner.
I eventually solved my problem by using two I2S MEMS microphones and an ESP32 and Fourier Transform to isolate rain drops and reject ambient noise
see Audio Rain Sensor and Window Open Detector
Which made the AI approach look like an overkill.