Upcoming maintenance
Dear Customers and Partners.
This website will be undergoing scheduled maintenance on June 14, 2023. Please be aware there may be disruption to the developer portal website and associated services during the scheduled maintenance period.
This upgrade is essential to ensure the continued performance, reliability, and security of Developer World.
We apologize for any inconvenience.
Trigger an audio beep as alarm when recording
-
Hi All,
I am doing an SNR calculation project based on the microphones' input audio. Right now, I hope to add an audio alarm function. When the calculated SNR is below a certain threshold, it can trigger an audio alarm from the output headphone jack. I encountered the following issues in implementing this:
-
I have a pair of earphones with two jacks. The blackjack is used for playing sound and the red one is used for recording. When I only connect one jack to the extension board, it can work fine. However, when testing the 'audio through' example, it does not work. I cannot hear anything from my earphone. But, if I use two different earphones (another earphone as output), this works fine. Is this hardware related? OR I need to modify the software (I have already modified the MicIn part as instructed).
-
Since I hope the earphone can trigger an audio alarm when recording, which mode should I use, in this way I must have both 'player' and 'recorder' mode active? This seems very challenging. Even the existing 'beep' example requires to set the whole audio system to the player mode. Is there any way I can trigger an audio beep to my earphone as easy as turning on the LEDs on the main board considering turning on LEDs only simply using the digitalWriter() function? I think the beep process should be very quick to implement, otherwise the recording and signal processing will be affected. I also suspect whether the subcore has enough performance to achieve this.
Thank you in advance for any help.
Best,
Larry
-
-
Hey, @Larry
-
I'm not quite sure if I understand the problem.
"When I only connect one jack to the extension board, it can work fine." - Which jack are you connecting and what exactly is working fine?
" But, if I use two different earphones (another earphone as output), this works fine. " - I don't understand. Are you plugging one headphone, recording, and then changing headphone to listen to what you recorded? -
This example shows how to use both microphone and speaker.
https://developer.sony.com/develop/spresense/docs/arduino_tutorials_en.html#_repeat_recording_and_playback
I don't think you can keep them both active at the same time, though. You would have to change between modes when it's time to send the audio alarm. So you would have to stop recording to send the beep and then resume. I haven't tested how long it takes to change modes, beep and go back to recording.. so you'd have to test if it is an acceptable delay to your application.
-
-
@CamilaSouza Thank you so much for your kind reply.
-
I have an earphone with 2 plugins, the red one for recording and the black one for playing, I tried the audio through example with this earphone, but it does not work. If I use two earphones, it is working.
-
Yes, I think there is a mode-switching process if I hope to use the 'record' and 'player' mode at the same time. I think such delay is not acceptable since I have to calculate the SNR and draw it on the screen timely. Anyway, my supervisor allows me to use a second board to implement this.
Is there any resources regarding powering the board by using battery? I hope the power bank/battery can be as small as possible.
Best,
Larry
-
-
Quick question..How are you using 2 earphones if the board only has one jack?
About the battery:
Here are some useful links that talk about powering Spresense externally and what kind of battery to use.
https://developer.sony.com/develop/spresense/tutorials-sample-projects/spresense-tutorials/how-to-make-spresense-super-power-efficienthttps://developer.sony.com/develop/spresense/docs/faq_en.html#_about_the_battery
-
@CamilaSouza Thank you for your kind reply.
-
I think I describe sth wrong. The extension board has 1 jack and it is an output. One earphone is connected to generate the beep. Another earphone has built-in mics and I use it input recording device.
-
Regarding the battery usage, I decided to follow this example provided here by using a Lion battery and a USB charger: https://www.hackster.io/taifur/pet-locator-powered-by-spresense-gps-20ed00
Best,
Larry
-
-
-
And what are you using to connect the spresense to the earphone with built-in mics?
-
Cool!
-
-
@CamilaSouza
Hi Camila, I still hope to get an answer for the previous question.The mics are connected on the mic pins of the extension board (followed the instruction here: https://developer.sony.com/develop/spresense/tutorials-sample-projects/spresense-tutorials/using-multiple-microphone-inputs-with-spresense)
The earphone is connected to the headphone connector on the extension board (for audio output).
Since this project is for SNR measurement, I use the audio recorder mode. My question is: Can I generate an audio beep to earphone through headphone connector as an alarm? I do not know how to combine the audio recorder mode and the audio player mode together.
Thank you in advance for any help,
Best,
Larry