Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Esp32 sending wav sound to a client

dr pepper

Full Member level 5
Joined
Mar 15, 2010
Messages
287
Helped
34
Reputation
68
Reaction score
37
Trophy points
1,308
Location
lancs
Activity points
3,413
I have a Esp32 running a server program, and on my webpage I can click a button that will play a .wav sound strored in the Esp32 using spiffs, simple enough.
I can change the .wav sound file in the program.
What I'd like to do is listen to a microphone connected to the Esp on said wepage live (delay acceptable).
As I understand it the wav file contains a header which defines things like sample rate, file ID, stereo/mono and filesize.
I was wondering if I could find a way to make the filesize either several minutes long or continuous, and send audio data via html or a websocket.
There seems to be little info on the net about sending audio from an Esp to a browser.
 

danadakk

Advanced Member level 1
Joined
Mar 26, 2018
Messages
489
Helped
98
Reputation
195
Reaction score
112
Trophy points
43
Activity points
2,430


Some possibilities you might be able to adapt.

Regards, Dana.
 

    dr pepper

    points: 2
    Helpful Answer Positive Rating

dr pepper

Full Member level 5
Joined
Mar 15, 2010
Messages
287
Helped
34
Reputation
68
Reaction score
37
Trophy points
1,308
Location
lancs
Activity points
3,413
I have played with the voice streamer, I think it works, not sure as it sends raw data to a raspberry, not a browser.
Seems like the way to do this is to use the atod with dma.
However the total lack of any sign of it being done makes me think the esp32 isnt the device for the job.
I made an assumption that the chip could do it as the esp eye has a mems mic built in, however I couldnt find anything were the audio is streamed to a browser, just code that is triggered by sound.
If I was to go ahead with this then I think I'd need a more powerful chip, a codec or some other hardware.
I had visions of connecting something like this to a vintage comms receiver & be able to operate it over the net.
Thanks for that.
 

dr pepper

Full Member level 5
Joined
Mar 15, 2010
Messages
287
Helped
34
Reputation
68
Reaction score
37
Trophy points
1,308
Location
lancs
Activity points
3,413
There is a version of the Esp32 called a Lyra T, it has a audio codec on board, and has the capability of streaming audio over the net, however its failry new and theres no examples for using it as an audio streaming server yet.
I think the reason why this isnt done with the esp is unlike video if an audio stream is interrupted the result is annoying, whereas a gap in video isnt so bad.
 

dr pepper

Full Member level 5
Joined
Mar 15, 2010
Messages
287
Helped
34
Reputation
68
Reaction score
37
Trophy points
1,308
Location
lancs
Activity points
3,413
I think it is possible.
I have a program that records .wav files using the analogue port, and a program that plays files back.
The issue is that browsers want to download the entire .wav before playing it, but I found a control preload = none, this will make a browser play sound when its got enough data to start playing, before the entire file loads.
The max file size is 4gb, at 8kc sample rate thats a long time.
I'm going to try modding the .wav record code so that it generates the header as usual and sends it to the browser, then grabs a block of samples then bungs it direct to the browser and repeats in a loop until the 4gigs is up, then ask the user if they want to re-start.
 

Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top