Page 1 of 1

I2S audio streaming?

Posted: Mon Aug 07, 2017 2:56 pm
by martinB
Let me start by apologising if this has already been discussed - I'm an experienced programmer, but not experienced in audio streaming, so I'm not sure of what to search for!

We are developing a product that needs audio streaming between remote stations and a central server, The ESP32 looks like an excellent platform and we've rapidly managed to get it talking to both an I2S microphone and an I2S audio amplifier (both Adafruit). I've got the Megaphone sample application working and the quality looks promising - but that is simply looping the I2S audio stream between the two devices via the ESP32. I'm not averse to some low-level programming if necessary, but I've no wish to reinvent wheels - I have a higher level product to develop! Is there anything I should be looking at to implement the streaming of the captured audio from the ESP32 to a server running Linux in an industry standard format that can be processed as if it were coming in from a local microphone?

Many thanks in advance!

Martin

Re: I2S audio streaming?

Posted: Tue Aug 08, 2017 10:54 am
by BuddyCasino
Uncompressed audio is a simple byte stream, sometimes with a header. Doesn't get more simple than that. I can however tell you from experience that this only works with a really good wifi connection (Alexa / mono 16khz 16bit stream).

I'd worry more about the following issues:

- can you drop data? if yes, might want to go UDP
- is it a stationary product? might want to add a high-gain antenna
- you can try encoding the stream (LAME has been ported)

Re: I2S audio streaming?

Posted: Tue Aug 08, 2017 2:43 pm
by martinB
mmm, thank you - Michael, isn't it?

After I posted my request, I came across your ESP_Alexa project in GitHub and have been looking at that as an example of the sort of thing I want to do! I am actually attempting to implement a crude Alexa using PocketSphinx on a Raspberry Pi with an ESP32 serving as a remote microphone and speaker. As a first step, I have spent the last couple of hours trying to get your code compiled and loaded. I was onn the point of sending you some feedback and asking a question when I saw your reply pop up on this forum...

As an observation, I assume that you developed your code on GitHub using a Windows machine... I downloaded the source into my Linux laptop and tried to build - and hit several compile errors due to missing files. The problem is that your code does not compile on an OS that is case-sensitive - your source file includes "freertos.h", but the file name is "FreeRTOS.h" 8-)

More fundamentally, your code uses BearSSL - which is not one of the ESP-IDF standard components. I am now in the process of trying to learn how to package up the BearSSL code in the right format for inclusion in the ESP-IDF component library - but if you can spare the time to tell me, I will be eternally grateful!

TIA

Martin

Re: I2S audio streaming?

Posted: Wed Aug 09, 2017 7:28 am
by BuddyCasino
Thanks for the case-sensitivity hints. Pull requests welcome.
There is a Github issue for the BearSSL thing that says how to make it work. The component.mk is currently missing.

Re: I2S audio streaming?

Posted: Sat Oct 27, 2018 1:41 pm
by Tao_spartan
Hi Martin, did you get anywhere with this? I’m trying to achieve the same goal, having a I2s mic attached to an esp32 then udp the data to a server, my issue seems to be with timing the pop of the I2s sample

Tao