How would you play sounds from a microcontroller (STM32 etc.)? [closed] - audio

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
For example, how would a washing machine play a specific sound (MP3 or WAV or whatever) when finished? Which external components are needed?
I know this is a really vague question but I could not find any real solutions except some kind of MP3 player module which seems to be more "end-user friendly" instead of being used programmatically (skip and pause buttons).

Various beeps can be made simply by toggling a pin, but I assume your are looking for something more melodious, and without using a sound synthesiser.
For short sound bites: you can store them in (external) memory and play them through a DAC, if your MCU has one. I put a basic implementation of this for SAMD21G-based Arduinos here; the idea is the same for all MCUs that have a DAC. If your MCU doesn't have a DAC, you can use an external one, or make a "poor man's DAC" by using PWM and low-pass filtering the output.
Another option is creating an I2S stream from stored samples and send them to an external amplifier (module) that accepts I2S. It helps when your MCU has an I2S peripheral.
For longer sounds, your best bet is probably playing them from a MCU-controlled MP3-player, because you need the SD-card storage or a similarly large storage anyway for large sound files.
In all cases, you'll need an external amplifier and speaker.

Related

Bluetooth Beginner, Need Advice [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
So I'm hopelessly lost right now. I found an attractive bluetooth chip from Nordic Semiconductor (the NRF52840) that I want to use for a couple project ideas I have. Now I have an HC-05 module for my arduino, so I'm not entirely lost on programming a bluetooth module perse, but I really need advice on how I can make my own. I want to make a bluetooth module that works exactly like the HC-05 but on a much smaller scale. I'm talking fitbit small. I'm not making a smartwatch or fitbit, but that's relatively the size I would need it to be.
So bottom line to whoever got lost in that mumbling explanation of my hopelessness, I need some advice on how to develop my own Bluetooth module PCB. The onboard chip will be the aforementioned NRF52480. Thank you to anybody who helps!!
Given that you are endeavoring in a very complex task, I would recommend you to start from the reference designs provided by the chip manufacturer. They are very valuable, especially when dealing with RF.
See here and here, for example. About RF design, this talk may be interesting for you as well.

Using your computer as a signal generator [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm not quite sure where to post this question, but I think Stack Overflow has a lot of smart people who could help.
I'm wondering if there is a way I can combine programming and electrical circuits. Can I somehow turn my computer into a signal generator to create AC waveforms which I could apply to an external circuit that I've created? Could I then program my computer with say C++ code to change the amplitude/frequency of the waveform (hopefully this if possible doesn't require assembly language which I know nothing about expect that its code that operates more directly with the CPU or something). Basically, I'm looking for a way to combine coding with electrical circuits. Anything will do. I just want to get better at both because they both interest me.
Yes, you can use your audio channel.
You have to consider its frequency response: (theoretical Maximum of 20kHz?)
You also have to buffer the audio output. Use an opamp as a buffer for that. You do not want to overload your audio jack.
You will run into challenges of how "Fast" you can send data to your audio channel. But I think it is possible.
Another way is to use a good old parallel port, IF you have one :). Those are nice to command some electronics.

How to build a simple application, that uses audio filter (eg. damping of sound level with distance) [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I would like to build a really simple app.
Let say, that apps GUI consists of 2 buttons: "5 meters" and "15 meters".
When the first button is clicked, an audio file would play. When the second button is clicked, the app would apply a filter to the same audio file, so that the user will be able to hear how that same sound sounds like 10 meters away.
Firstly I would like to know, in which programming language an application like this could be written. I have some experience in Java and C++.
Secondly, I would like to know, how to build audio filters (e.g. damping of sound level with distance) and how to integrate it into the app.
I really dont know, where to start.. Any practical example or similar application with available source code would be of much help!
The sound pressure decreases by 1/r. So a doubling of the distance results in a 6 dB lower amplitude. This should be easy to model by a distance dependent amplification.
The interesting part of the problem is the sound absorption caused by air. This absorption is frequency dependent (it is higher for high frequencies) and also depends or air pressure, humidity and temperature. You can find a detailed quantitative model in the ISO 9613-1 standard.
What would be the platform for your app? iOS, android, linux, windows ...? Anyway, I recomend you to have a look at SFML. It's a library in C++ that could help you for multimedia task
about audio in SFML
there is an example for audio levels that change with distance.
Good luck!

Linux Audio Sub Systems [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to know about Linux audio, i spent a lot of time on reading but i didn't understand(clearly). Can anybody give a brief information on various Linux audio sub systems(Like OSS, ALSA, JACK, Gstreamer, Phonon, Xine)?.
Any help, Thanks in advance.
I once wrote a famous blog post about the jungle of Linux audio output formats. You can find it here.
Regrettably, the picture is no longer there, here's a copy:
It's a bit old (dating from 2007), but I hope it gives you the general idea. OSS and ALSA are the layers closest to the actual audio hardware. All the other libraries and frameworks simply talk to those lower layers. And as you can see, some of these libs and frameworks actually have wrappers around other libs and frameworks.
Which layer you want to call upon depends largely on what you wish to accomplish.

helping getting started with audio programming languages [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have a small application I have been working on for some time to help my son with his speech delay. I am using gstreamer to play phonemes, small audio clips about 100ms long.
Things are fine but I find it a bit distasteful to use a library that has such powerful video features for an audio only application.
I was thinking that an audio programing language might be able to play short audio clips on-the-fly too.
I've been reading about these DSLs and there are quite a few of them. However it seems that csound, Supercollider and Chuck are the front runners.
All I really need to do right now is to play small audio clips, preferably from a C binding, in near real time and I only need to run on Linux.
Could anyone help me pick a language for this? There are so many features I "can't see the forest for the trees".
Once I have one picked out, I will have a tool for my immediate needs and a platform to grow with as my needs change.
SuperCollider has great real-time capabilities and makes it pretty easy to play sound files via its sclang interpreter. It's also not that hard to communicate with the supercollider server (scsynth, the part of supercollider that actually synthesize sounds) via open sound control (OSC) messages, so you can control the synth from another, separate application.
Don't know much about chuck but I hear it's good for on-the-fly, live audio programming too so it might work.
I wouldn't recommand CSound since it's meant to be used for composition, more like a "compiled" language vs interpreted. You basically write a score file and generate a whole sound file from that, so it's probably not what you want.

Resources