Play audio files in microcontroller (Arduino) - audio

I try to make a Bluetooth speaker with a microcontroller (Arduino, teensy... I don't have a defined model, because I'm considering the frequency)
My question is if I want to put a SD, for reading music stored, the problem is there are library only for ".wav" files, but I want to extend for ".mp3", ".m4a", ".aac" and other.
Exist any library for this? and if is not, How I can do it?
I need to decode an audio files, convert the data in bytes and send it to the DAC.
An example code in C++ will help me a lot, I can created a new library for this.
I don't want use modules, I want to try to do my own circuit.
Edit:
I gonna use a third party microcontroller compatible with Arduino, because I need more capacity for audio.
PDT: I don't know if I had to post this in Arduino o electrict defined, so I put in general.

The Arduino does not have sufficient resources to do this. An MP3 decoder needs plenty of memory and floating point support. The AVR processors used for Arduinos have neither of these.
The only way you are going to do this with a Arduino is if you use a module.

Teensy base on ARM microcontroller (Cortex-M3 & M4) come with FPU, have capacity for play videos. Teensy is a board compatible with arduino. With DAC and SD slot. Adafruit have a library for play .mp3 on this board.
Well .mp3 is enough for me, but in the future I want to learn how to decode other audio file formats.

Related

Capture audio output from raspberry pi (for LEDs)

I have a Raspberry pi 4 and my goal is to connect it to some LEDs that will react to music that is playing through bluetooth (or AirPlay, ...). I've installed rpi audio receiver and so now I can stream music to it.
Now I need to write (or use some) code, that could parse what is being played to the audio output (via built-in 3.5mm jack), so the main question now is:
Is it better (or possible) to intercept the audio somewhere and analyse it with my own code, or does this require some deep modifications to the streaming program? Or do you know of a better solution that could point me to the right direction?
I saw a lot of people using an external mic, but the whole process is too different from mine.
Type of LED strip is not important right now, if I'm able to write my own code for it.
Thanks for any help!

Open field usage of Google Resonance Audio SDK

is there a scenario where we can use the Google Resonance Audio SDK not with headphones, but with real speakers (e.g. mounted in a 360° cyrcle setting)?
Or are all algorithms not working for real speaker outputs?
Thank you!
Currently, Resonance Audio is optimized for headphone playback. For example, HRTF processing is done in the Ambisonics domain, without generating (virtual) speaker signals - this is because it is a much more efficient way of generating binaural output.
However, in the Resonance Audio open source release, the Ambisonic Codec class can readily be used to decode Ambisonics to any arbitrary loudspeaker array. To use that with the rest of the Resonance Audio system, however, it would be necessary to modify/extend the audio processing graph by adding a new decoder node.
Please, feel free to add a feature request and, depending on popularity, we might consider adding that in the future!

Generate Simple Beep on Altera DE2 Board

I've been looking online for solutions on how to generate a simple beep with an DE2 Altera board using VHDL but I can not seem to find anything.
I've seen some things that are talking about Audio Codec but I haven't been able to get a firm grasp of what I would need to do with it.
Thanks a lot!
-Will
The "audio codec" is a separate chip (a Wolfson WM8731 in your case) which can turn information on digital form into analog information to be amplified/played through a standard sound system with amplifier/speaker/etc.
You'll need to find out how to interface to the audio codec chip from the FPGA (google a datasheet for the chip), and then send it the necessary information to generate you beep. Depending on how advanced the audio chip is, this task can vary rather much in complexity. As it's an educational board, you might be able to find people who've already done something similar, and then build on their experience.
If all you need is a simple beep though, you might also be able to create a simple circuit with a piezo-buzzer or similar yourself - that can be controlled without having to use an audio codec...

Driving the sound card in Linux

On a basic embedded systems speaker with a single line of output, wiggling the output as 0 or 1 in a for given periods produces sound.
I'd like to do something similar on a modern Linux desktop. A brief look-see of Portaudio, OpenAL, and ALSA suggests to me that most people do things at a considerable higher level. That's ok, but not what I'm looking for.
(I've never worked with sounds on Linux before, so if a tutorial exists, I'd love to see it).
Actually, it... kinda is. While you can generate the waveform yourself, you still need to use an API to queue it and send it to the audio hardware; there no longer even exists a sane way to twiddle the audio line directly. Plus you get cross-platform compatibility for free.
[...] embedded systems speaker with a single line of output, wiggling the output as 0 or 1 in a for given periods produces sound.
Sounds a lot like the old PC speaker. You might still find code for it in the Linux kernel.
I'd like to do something similar on a modern Linux desktop.
Then you need AFAIK a driver for ALSA. There you can find infos on how to write an ALSA driver. Use PWM to produce the sound.
Since there are many different sound cards and audio interfaces produced by different companies, there is no uniform way to have a low level access to them. With most sound I/O APIs what you need to do is to generate the PCM data and send that to the driver. That's pretty much the lowest level you can go.
But PCM data is very similar to the 0-1 approach you describe. It's just that you have the in-between options too. 0-1 is 1-bit audio. 8-, 16-, 24-bit audio is what you'll find on a modern sound card. There are also 32- and 64-bit float formats. But they're still similar.

Converting audio to code and vice-versa

Having just witnessed Sound Load technology on the Nintendo DS game Bangai-O Spritis. I was curious as to how this technology works? Does anyone have any links, documentation or sample code on implementing such a feature, that would allow the state of an application to be saved and loaded via audio?
Its the same old thing used in ZX Spectrum era. You load programs/games from tape.Only the sound quality and the filters are probably better.
In my opinion something like Bluetooth or WiFi is better. You can also send files that can be put on some storage and then load them. I find these methods much easier than sound because if there is a lot of noise around you cannot do much.
It is just a conversion of data to audio and then back from audio to data.
Search for Zotyocopy and Copy86M on google - these are the utilities used for saving a game to tape after loading it into memory on zx spectrum.
If you want to pass data as audio through the air there are a few things you need to be aware of though, such as how the speaker and microphone interact for example. It is important that they don't distort or alter the sound too much as what you are sending are in fact the raw bytes.
Some audio software will let you open any file as audio so that you may listen to it. If you record audio as data do not use lossy compression such as mp3 on the audio file!

Resources