RPi audio device and App

Hi all,

I’m currently developing a device for my university project that emits sounds waves in an infinite loop, like 1s x sound, 1s y sound, 1s z sound and after 3 seconds the cycle is done and it starts again in the loop.
So this device I want to connect it to an App like this one [Control Your Raspberry Pi Remotely Using Your Phone | RaspController - YouTube] (Control Your Raspberry Pi Remotely Using Your Phone | RaspController - YouTube) but I want to develop my own App and in that App you can choose what sound you want to play at the certain second in the loop, how many sounds are in the loop, how long the sound waves can reach (in meters), so not very complicated App in my opinion, but can it be done the way I want it?
Also I’ve done some research in finding a RPi that can do this audio part, cause my RPi will control a sound device and the RPi i found is this
so is that a good RPi for what i want or I can find something else or better for what I need and maybe cheaper?
I want to mention that the RPi will be connnected through wires to my speakers not with a Jack plug like I see this one has so maybe this RPi is too much having those features that I basically dont need since I will connect the RPi with everything through wires and not plugs?

Thank you!

1 Like

Hi @Andrei246238

Welcome Andrei …

You can also try the DFRobot MP3 Player (DFR0768) as in my Borg Cube project. Go to this link

And scroll down about 20 lines until you find this line
“The UART, a control ‘array’, and string concatenation”

The description and the code following it describe controlling the MP3 player, picking a tune, and managing the sound duration.
The interface to the player is via the Pico / Pi UART pins, and the player itself has a direct audio output that can drive speakers, as well as separate signal level outputs that can be connected into a bigger amplifier.

You can scan over the rest of the project for more general info.



Hi Murray,

Thank you for the response, I already started to look through it and it kinda resonates with what I’m trying to make, however I want this device to be able to connect to an app that will be later developed specifically for this device, can Pico RPi be linked to such app or do I need a powerful RPi for that?

Thank you !

1 Like

Hi Andrei,

I am going to duck away here as I am not an app programmer - I tend to work on the low level programming (hardware interfaces, and operating system interfacing).

Obviously you will need your User Interface (UI) and eventually define a communication protocol to get commands to the PI/Pico sound system. The command link protocol could be as simple as a sequence of text strings - “Play #1 , Pause 2.5, Play #42” or you might bundle it all up in HTML-wrapped XML etc etc.

I have done coding to handle such messaging systems - from simple text string comparisons through to designing and creating a language interpreter for a Domain Specific Language, that was syntactically parsed for correctness and completeness before being ‘allowed’ further into the control system.

But the Human ‘pretty gadget’ interface with whatever embedded rules, functions and displays - nope not me :stuck_out_tongue_closed_eyes:



Hi Andrei,

I’d give flask(a Python module) a go, it creates a webpage that any device can access (Phone computer etc).

Otherwise you could create a webpage on a Pico, there are many options for device control!

1 Like

Hi Andrei,

Is there a requirement for your university project that you use a physical device like a Raspberry Pi to generate the sounds? You can control a Raspberry Pi with buttons or a touch screen you add on, so there isn’t strictly a need for an remote app at all to control it.
Alternatively, if you have to create an app could you have all the audio figured out on the software side and just use the output from a browser via any old computer as your hardware device. Then you wouldn’t even need a Raspberry Pi.

Knowing a bit more about why you’ve decided to have it remote controlled will help us know what parts of the project are must have, and what parts could be simplified. I agree with @Liam120347 if you only need super basic audio a Raspberry Pi Pico might be a cheaper option than getting a Raspberry Pi and an audio HAT. Or taking @Murray125532 's approach and using a purpose built MP3 player board.

Hi Andre

That is a strange request.
Would depend a lot on how an individual’s ears perform and the speakers.
Most decent speakers have a sensitivity figure which from memory is the sound pressure measured at 1Metre with a power input of 1W.
So work it out. You need to know the amp power output, then modify the sensitivity figure to suit. Every time you double the distance (2M, 4M, 8m, etc) you reduce the sound pressure by 6db.Apparently 0db (as in the sound pressure measurement) is what is perceived to be the lower threshold of human hearing. Once again this depends entirely on one’s ears.

And I have never even been inside a university. I thought all this research would be part of the learning curve required for your project.
Cheers Bob

So, I want to control remotely because lets say this device wont be ONLY 1 piece, lets say im taking the things to the next level, i want 1000 devices in 1000 locations on 1000 different phones that will acces them. Thats my approach, I’ve been given advices like a web server to control the RPi device, but that wont cut in my opinion because although its easier to me to create a control point for the RPi it will be much harder for example for someone who dont know how to acces a specified web page and control the device like that, so my thought was ohh, lets make an app, and easy one: when you enter the app you just introduce your RPi IP so the app connect your RPi device since every RPi has different IP, if you have more devices you just add “+” and introduces all the RPi IP’s and voila you have them all there, after you have a list with all the RPi or only 1 RPi you select it and you have your customization, lets say, I want x sound for 2s, or for 3s, then y sound for 2s, or for 3s, but then i want to change the sounds or modify the seconds, or add an z sound to the loop, and another costumization point, the distance(i know in sound domain the distance its not something EXACT, you cant just set the sound to reach 100m and it will stop exactly there after 100m you wont hear anything), lets say i want to device to reach 70m, or to change to 50m, simple things like this.
Also I want my device control remotely because I dont want to be near it when it’s functioning all the time, I want to be able to control it and change it to my own demands from afar.
I hope I cleared any question on why I want an app and to control it remotely, however guys the question stands, in your opinion can it be develop such an app to be connected to an RPi?
Another question would be, can I wire to the RPi another device, cause ok, I have the sound system, which will clearly have a TDA amplifier and speakers, so the RPi will be linked to TDA amplifier and the amplifier to the speakers so I can have clear sound and good distance reach, BUT CAN I ALSO wire to the same RPi a surveillance camera and watch through the app what the cameras are seeing and maybe if I buy some professional camera can I also introduce in my app/RPi an alarm when a movement is caught by the cameras or should it be also on the sound part, lets say I want my sound to reach 70m and within that range if an animal/human enters should i get the alarm through that? Which will be the easier way here to detect movement by the camera or by the sound and after that to send and alarm in the app so the cameras can be checked?

I know this sounds pretty complicated for a project, but I kinda got a thing for this device and maybe I dont want it to let it at the level of just a project so my implication and my research are very focused on pulling this out and I hope you guys can help me. :slight_smile:

So pretty much I want my RPi be linked with a sound device which in my mind and from what I’ve read so far would be good to have an amplifier and good speakers to have the outcome I want so in the sound part RPi–>TDA amplifier—>Speakers and the sound part should work and then figuring out the app connection and control, AND the second part, the surveillance camera which I would also want to wire it to the RPi since I want to check them from my specific app.

What I want to specified again, my device wont generate sounds, it will EMIT the sounds CHOOSEN with the app, music, simple sounds, etc. so he will not generate random sounds.

Guys, thank you again and I know it’s alot what I’m asking but if I can manage to pull this off I will always be grateful to you guys, that is how passionate I am about this and I know I sound like a beginner and a novice which I am to be honest, because compared to others project mine is very different and complicated and It’s so hard to get information from internet about this because everyone It’s saying opposite things and you guys sounds like experts to be honest and here is all my hope at this point.
Thank you again!

Firstly WOW :exploding_head:

Secondly - humans are not good with IP numbers … especially as you suggest about a 1000 devices - this would require a netmask of or if you start with the network this would be a netmask expressed as which would provide 1024 unique addresses. Ignoring the first and last addresses in that range (network base address and the broadcast address) the first address would be and the last usable address would be … IF you were using a common DHCP server. To do this though you would need to setup the DHCP server to serve fixed IP to each Pi based on its MAC address, unless you did not mind which Pi got which address …

To make it more humanly accessible I would also have a DNS server in the net setup to provide human names to all the PI’s ie Andrei200.test.net, instead of, or Node60.test.net instead of etc etc .
Actually you would need a netmask of /21 to give enough addresses if all the mobile phones were to be on the net also … or … this is assuming that a maximum number of phones join with one phone talking to one Pi. The alternate is to put the Pi network safely on the internet and provide an appropriate gateway device with the necessary permission controls in place so that ‘anyone’ with the app can access the Pi devices. And then you would definitely need an accessible DNS Name server or a very helpful network admin within the university … :smiley: In that case the human names could be something like PiNode600.university.edu.au …
Big networks get hard real fast - I would start out simple (low numbers of devices) first. (And take a Comp Sci Network Course)

Network numbers calculated here


1 Like

Hi Andre
70,100 metres for your audio. You are probably looking at a fair size public address amplifier and speaker.
Think outdoor concerts and they are talking in kilowatts with large speaker banks. You would want nothing like that but possibly 100s of watts and a pretty good speaker (s)
Racetracks and the like have banks of PA amps and horn type speakers.
Cheers Bob

To be honest, your response about IP numbers completely blew my mind cause thats literally not my domain, In my head, I have the server that hosts the application and everything that has to do with that is in the hands of a tech guy, and what I mean by 1000 phones and devices, they are not connected to the same Wi-fi in the same building, they are connected to different Wi-fi’s and with the IP address on every RPi, when I program the RPi’s that will be plug to the device I can easily find the IP address so i just note and stich it to the surface of the device and thats how you enter the right IP address of you RPi’s in app to be connected, however I think this part is a bit complicated and a tech guy will help me alot with it and until that I still need to figure the hardware, if all the parts I want my device to have can actually be put togheter and work. :slight_smile:

Hi Robert,

Isn’t this a little bit of “overkill” tho? Or maybe isn’t, but just consider this, my device will be put in open space, like a plain, so no building or car noises, or almost anything that will interfere with my device, so considering all this, would I still need those equipments that you mentioned?
If yes, can you please leave me some link so I can make an idea of what I need to acquire?

Hi Andrei,
Confusion here - your network is growing a lot especially as you don’t really have control of the IP numbers as almost all WiFi systems randomly assign addresses. And you are also outdoors a long way from buildings (which is where most Wifi nodes are – unless you plan on using 4/5G wifi where you really dont have IP number control.

And FYI a concert grand piano by definition puts out the equivalent of about 10 watts of audio. And that sound ‘intensity’ falls off under exponential decay conditions especially in the open as you have an expanding sphere so at 100m you would not have a lot of sound left …


1 Like

Hi Andre
The open air concert is probably a bit of an “overkill” because of the large number of people present absorbing the sound.

I have never had the need to research something like your situation so you will have to do the same as me. LOOK. you could start by googling “sound pressure” and you will find Wikipedia has an extensive text on the subject with a chart showing the approximate db(SPL) pressure for everyday sounds which is useful for comparison purposes.

Lets have a hypothetical situation.
The chart says normal speech is 40 - 60 db(SPL)
Say you need 60 db (will leave out the SPL from here on) at 64 Metres, This is a convenient figure as it can be halved down to 1.
You will need 96 db 1 metre from the speaker.
For convenience we will use a speaker sensitivity of 66 db. That is 1Watt will produce a pressure of 66 db at a distance of 1 metre as I mentioned previously.
That is a difference of 30db. Now your 1 Watt is now 1000W or 1kW. So this is the power you would have to input the speaker to get 60 db at 64 metres.
The problem then would be to find a speaker that would handle this power, not to mention finding an amplifier.

Keep in mind these numbers are only arbitrary and have been selected for convenience (to save me calculating). They should give you a start in calculating your requirements once you have made some decisions re what you are really after.
But this does illustrate how the sound pressure diminishes in a logarithmic manner and does not take long to disappear. I started with the following numbers
64M = 60db
32M = 66db
16M = 72db
8M = 78db
4M = 84db
2M = 90db
1M = 96db
You can do the same thing. Work out what you need at what distance. Every time you halve the distance add 6db. Subtract the db speaker sensitivity then the difference will be the required AMP power in dbW (db Watts where 0db = 1 Watt). You will be unpleasantly surprised I think.

In a practical situation Randwick Racecourse in Sydney has a heap of 100W AMPs and horn type speakers to satisfy their PA requirements. I did not count them but there seemed a lot, even allowing for redundancy and failures.
Cheers Bob

Yes, by my projection it might grow pretty fast, so what’s your advice on keeping a connection between the device that will be in open field away from any internet access in most of the case and the app?

1 Like

To be honest, those are big number, 1000W speakers would cost me insane, let alone the amplifier, it blows my mind that in an open space without basically no interference from basically anything I need such equipment to reach at 60-100m basically the ambient sound that is in a room.
I want you to ask something else, lets say human ear has a frequency that hurts, would it still make the human unable to stay in such frequency even at 50-60db sound?

Hi Andre

Don’t quite know what you mean here.
Please look at the Wikipedia web page on the subject. You may find most of your questions answered.
Cheers Bob
As signal reduction goes I might add that radio signals do much the same thing, reduce at a logarithmic

I will look up, but information are vague most of the time, but thanks for informations you provided to me so far.
What I mean is, if the human has a native frequency that it hurts the ear, does it matter how strong the sound is or it will do the same damage to the ear/brain as long as it can be heard because the frequency is harmful anyway?

The Wikipedia information is not vague, quite detailed in fact.

Not the frequency that hurts it is the level. Wikipedia includes the threshold go pain in the chart, 120db(SPL) I think it is.
Cheers Bob

Hi Andre

Yes they are big numbers. Those numbers are completely hypothetical and are only to illustrate how you would work out what you need for your situation.

A logarithmic reduction can be quite surprising when you work with it. Unfortunately it is a fact of life an that is how it is. For instance at Microwave frequencies (up into GHz) most of the signal is lost in the first 400 Metres or so.

This of course can work the other way. Say for instance you decide that 40dbspl is all you needed at 64M then that makes a difference of 20db and your Amp power required is only 10Watts. The same would apply if your speaker sensitivity was 86db (instead of 66db) and you require 60dbspl at 64M the same 20db difference would yield the same result, that is 10W Amp. If you improved things by 40db (20db at each end) your required audio power now would reduce to 0.1W or 100mW. A drastic reduction from 1kW.

So you see there is no need to panic just yet but to come up with a result you are going to have to do some work on what you actually require and what sort of speakers you can use. For this you will have to research which only you can do. I know this could be time consuming but it is the same for everybody and I thought research was part of the University learning experience. And only you know what you really want or need.
Cheers and hope you come up with something workable. Bob