Comments (26)
Will investigate in a couple of days
from tasmota.
Okay, I have found my INMP441 and could fix the crashes with i2srec
.
It was possible to record raw audio in Berry, but the MP3 encoder ist totally broken at the moment, so no luck with i2srec
for now. This makes it impossible to stream MP3 for obvious reasons too, although there was another bug that would crash the ESP before the start of the (non working) stream.
There are a few more glitches.
from tasmota.
INMP441 works here now for MP3 audio recording and streaming on the S3 without distortion and the expected (mediocre) sound quality.
I hope this is repeatable on other platforms too.
Please allow some time for testing and code refactoring as we need some new variables in the driver setting.
from tasmota.
Thanks to @Staars for giving the hint on i2sconfig. And yes, I am using INMP441.
With "RxMode=0" and "Mp3Preallocate=1" the error in the console is gone, but still getting the issue that
IP:81/stream.mp3 does not load.
from tasmota.
Meanwhile @rug1024 could try the following things (with seriallog 3
):
-
Check general microphone functionality with
i2srec
, e.g.:
i2srec /test.mp3
(then after a few seconds)
i2srec
(to stop recording and finish writing)
Download and test MP3 file. -
Provide console output while accessing
http://IP:81/stream.mp3
from your browser.
Please also check output ofi2sstream
and test behaviour of switching stream server on/off withi2sstream 0
/i2sstream 1
.
from tasmota.
On executing i2srec the device instantly crashed and does not reboot anymore.
Power cycle also not successfull, think it needs to be reflashed with Esptool.
from tasmota.
Can you guys describe your configuration (especially template) when the crash happens?
Also the output of command I2SConfig
from tasmota.
The crashes in i2srec
will happen in every mic-only-configuration at the moment, because these calls can not work without an output instance.
The i2sstream does not start the mic at the moment and crashes without starting it by hand withi2smic 1
.
But I still only get garbage MP3 data from the encoder ... which I do not understand yet.
from tasmota.
After more bugfixing I have the driver working including MP3 streaming, but the INMP441 is a special animal, that seems to need an unusual I2S configuration. ATM this microphone produces garbled/distorted sound, but at least it works somehow. I have found more infos in other projects, but need to test this myself.
The good thing is, that the new driver is very flexible and can be extented quite easily to reflect very different configurations with one firmware image. You can already exchange the connected microphone (i.e. from Standard to PDM), reconfigure it and use it without reflashing the ESP32.
IMHO it is a huge step forward.
from tasmota.
Great news! Thanks for the effort!
The distortion you report has occurred here too, also in previous Tasmota-builds (afaik since 12.x).
Found out just yet: It's only there when streaming live, when recording via i2srec it's not.
I attached a sample of what it sounds like (recorded with my mobile in front of the speaker).
audio.zip
Next thing: the distortion is only with my ESP32S3, on two other ESP32S2 the stream is clean (Tasmota 13.4.0 Master, Core/SDK Version: 2.0.14 / 4.4.6.240105).
Since these mics don't cost much, what other types can you recommend? Willing to buy and test.
from tasmota.
Interesting point about the different behavior of different SOC's.
I will have to check this too as currently the INMP441 is connected to a S3. In theory it should not matter, but I would not be too surprised to find the same.
My PDM micro is a cheap clone of this:
https://learn.adafruit.com/adafruit-pdm-microphone-breakout/overview
But is not extensively tested by me so far. Initial impression is good.
from tasmota.
Great news! Ordered myself 2 of these PDM Mics for testing (like the JST-SH plug).
Will compare to INMP441 and report.
from tasmota.
@Staars
Can you please post your compiler options?
Not quite getting the PDM Mic working yet.
from tasmota.
Current state of changes here:
https://github.com/Staars/Tasmota/tree/i2s
There are more refactoring steps ahead, but with the next PR I would like to change as few things as possible.
[env:tasmota32s3-i2s]
extends = env:tasmota32_base
board = esp32s3-qio_opi
build_flags = ${env:tasmota32_base.build_flags}
-DFIRMWARE_TASMOTA32
-DUSE_I2S
-DUSE_I2S_AUDIO
-DUSE_I2S_MIC
-DUSE_SHINE
-DMP3_MIC_STREAM
-DUSE_I2S_AUDIO_BERRY
-DOTA_URL='""'
lib_extra_dirs = lib/libesp32, lib/libesp32_div, lib/lib_basic, lib/lib_ssl, lib/lib_i2c, lib/lib_audio
lib_ignore = Micro-RTSP
Out of the box this should work with an PDM microphone.
i2sconfig {"Rx":{"Mode":0}}
would change to standard mode with default settings for INMP441 with left channel.
i2sconfig {"Rx":{"SlotMask":2}}
would change this to right channel.
I2smgain
should be set to something like 30-60.
i2sconfig {"Sys":{"Mp3Preallocate":1}}
is needed for both. Correct pin settings are of course needed too.
from tasmota.
Will need some time for testing and trying to get this running.
Just wondering what that is for:
from tasmota.
Forget the current docs, the aim for the new driver was to configure "everything" at runtime.
So things like PDM, left/right, mono/stereo, ... do not need a different firmware. You will be even able to swap out the microphone to a total different type later or back and forth without reflashing.
from tasmota.
I tried to compile with Gitpod using your fork, unfortunately this does not work very well.
Since I also use ESP32S3 for testing, could you send me compiled binary just to find out if my mic is working at all?
from tasmota.
Then please head over to Discord and find me there or use Tasmotas compiling-development channel.
from tasmota.
Tested with M5stack core 2 and i2rec works. saytime does work too.
from tasmota.
@Staars Can we close this? Everything I tested is working.
from tasmota.
i currently focus on other things,
but after a short test on 2 esp32s3 devices i2splay does only produce some noise while it works on an esp32. i2ssay and i2stime works on all devices, so the i2s channel seems to be ok.
i have a couple of problems with core 3 with several devices such that i will stay at core2 for some more weeks.
e.g. jpeg decoder crashes, (now in rom, used to be in flash)
par8 and par16 display does no longer work. (currently no time to investigate)
from tasmota.
@gemu2015 not related to i2s but parallel display do work with core 3.0.0 and uDisplay driver.
EDIT: RGB Display is working. Don't have a parallel display to test.
from tasmota.
Unfortunately I don't have any PAR8/PAR16 display... So I can't help
from tasmota.
I was trying to get I2S audio to work with small 8Ω speaker connected to a board having a MAX98357A. Configured the I2S gpios for BCLK, WS and DOUT to match, and left the SD and GAIN pins unconnected, as indicated on the external DAC wiring suggestions in the docs. The board schematics indicate that GAIN is pulled down, and SD connected directly to the ESP32-S3, no pull-up/down, so unconfigured would be floating.
No luck with commands I2SSay
or I2STime
.
As MAX98357A specs says that SD_MODE pulled low means shutdown, I decided to config the ESP32-S3 pin as Output Hi
and now the test cases worked (not great voice quality, but I'm not very demanding).
Not knowing much about I2S audio, I'm wondering if this suggestion should just be made part of the docs, or if there are complications needing extra considerations.
from tasmota.
@sfromis imho mentioning SD_MODE
needs a defined state should be in the docs.
from tasmota.
Did a small test getting a WebRadio MP3 stream to play. Got a few seconds of garbled sound first, but then normal audio. Next step was interrupting it with the command I2STime
(saw no clean way of stopping a stream), and got:
[14:34:11.626] 14:34:11.037 CMD: I2SWr http://listen.livestreamingservice.com/181-jazzmix_128k.mp3
[14:34:12.517] 14:34:11.928 I2S: Tx i2s_channel_enable err=0x0000
[14:34:13.041] 14:34:11.934 MQT: t337blng/stat/I2SWR = {"I2SWR":"http://listen.livestreamingservice.com/181-jazzmix_128k.mp3"}
[14:34:13.041] 14:34:12.452 I2S: updateClockConfig i2s_channel_disable err=0x0000
[14:34:13.043] 14:34:12.454 I2S: updateClockConfig i2s_channel_reconfig_std_clock err=0x0000
[14:34:13.044] 14:34:12.455 I2S: updateClockConfig i2s_channel_enable err=0x0000
[14:34:57.870] 14:34:57.282 CMD: i2stime
[14:34:57.880] 14:34:57.290 I2S: updateClockConfig i2s_channel_disable err=0x0000
[14:34:57.880] 14:34:57.291 I2S: Could not write samples (count=1): 259
[14:34:57.880] 14:34:57.292 I2S: Could not write samples (count=1): 259
[14:34:57.881] 14:34:57.293 I2S: Could not write samples (count=1): 259
[14:34:57.883] 14:34:57.294 I2S: Could not write samples (count=1): 259
Last message in a loop until I killed it (power off). First set of time stamps from my terminal program.
(Found how to stop the stream, just the command I2SWr
without URL).
from tasmota.
Related Issues (20)
- Moes 2 gang zigbee 3 dimmer switch MS-105BZ not being fully recognised by Tasmota HOT 1
- How to add something in Tasmota Documentation HOT 1
- Incorrect power measurement on Shelly Puls PM Mini HOT 5
- SwitchMode 6 TOGGLE CMD on the wrong edge HOT 1
- Berry energy.read outputs invalid JSON (nan issue) HOT 14
- ESP32 and PZEM-004T v3 working intermittently HOT 2
- Documentation for comands 'subscribe' and 'subscribe2' is swapped HOT 1
- Add a new ZbState called ZbLoaded to indicate that all ZbDevices and ZbLoads have been loaded successfully. HOT 5
- A4988_Stepper , Motor commands doesnt give feedback while called without argument. Motor MIS not working ? HOT 4
- Berry script not returning sensors values in a given condition HOT 5
- Timers not working after power loss because time resets
- Web-UI does not load (v13.4.1.2 on ESP8266EX) HOT 5
- Events and arrays with mqtt
- Compiling tasmota32 fails
- KNX Support : Latest commit in development branch introduced a regression when using DHT11 sensor HOT 2
- tasmota32 freezing after displaytext more than 128 characters HOT 1
- Display SSD1306 not Working after Upgrade to Tasmota 14.0.0 an Universal Driver HOT 16
- Matter 1.3 - support for energy monitoring HOT 1
- Confict warning in xsnss_53_sml.ino HOT 5
- Deep sleep with timers can wake multiple times due to clock drift.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tasmota.