I recently bought a Nano 33 IoT with the intention of streaming audio to it from a computer or mobile device. I bought a little speaker and amplifier as well. If it's possible, I'm fairly certain I'll be able to figure it out, but I read some old posts about Arduinos only outputting 8 bit audio. I'm trying to stream things like sound effects and spoken word. Does that sound like it would be possible?
Bluetooth LE has been designed for low power and not bandwidth. All Bluetooth audio products on the market use Bluetooth Classic.
There is no generic audio support for Bluetooth LE devices ether. So you would have to create your own audio driver for your PC.
If you can live with these limitations, audio data are just bits and bytes, so you can create a device that outputs some limited audio. I am not sure about streaming spoken words.
Do you need variable spoken words or fixed messages? You could store the fixed messages and just trigger the playback.
@Klaus_K Thanks so much for your reply! Triggering the playback of stored messages wouldn't be what I would prefer to do, but it would work. Do you know if any Arduino out there would be able to handle streaming audio like music? If not, do you know of any good resources to look into for creating my own audio driver? Thanks again!
The problem is not the Arduino. The new ARM-Cortex processor based Arduinos all have enough processing power to do some audio tasks. The issue is Bluetooth LE bandwidth.
What is your application? If you just want a generic Bluetooth audio output, I would look into commercial offerings. That will be a lot cheaper.
If your application can live with load delays you could create a system where you load some audio file over Bluetooth LE and then trigger playback. It will take longer to send the audio file then the playback, but there could be use cases where that does not matter.
@Klaus_K Thanks again! The use case is that I have a web/mobile application that is story-based. At certain times throughout the stories, I want the BT connected Arduino to output sound effects and dialogue. Maybe even music. For that purpose, loading the file and then triggering it would work, but I would want a completely different set of files for each story. Does that sound like it would be asking too much of the Arduino?
You certainly can make a system like that work and there are some interesting problems you can learn about. It sounds like a Bluetooth speaker would be a cheaper and easier solution.
Anyways, if you like this as a challenge, here are a few points you could look into:
- adding an SD card or external serial RAM to store the audio data
- switching between Bluetooth and WiFi to download the audio files at higher speed
- SAMD21 (that's the microcontroller on the Nano 33 IoT) I2S peripheral
- DMA usage to reduce processor usage for audio data copy operations
@Klaus_K Thanks for all the info! I think I'll take your advice for now and just use a commercial BT speaker for the initial proof of concept. It's great to know that your solution is an option for if/when I move past the proof of concept stage though!