Comments (2)
Yeah, I know, it would make sense of course. But unfortunately it lacks a few features for now that I consider rather important. First one is probably quite easy to fix/implement. Currently sample rate/bits per sample are hardcoded there as 16bits@16kHz. Sound meter will of course work with it, but you might need to recalculate all IIR coefficients and probably loose some precision. I don't know how much the difference will be, but I'd prefer rather more precision than less :) I hope, ability to specify audio quality via config will be implemented in the official i2s_audio component at some point.
i2s_driver_config_t config = {
.mode = (i2s_mode_t) (I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_PDM),
.sample_rate = 16000,
.bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT,
.channel_format = I2S_CHANNEL_FMT_ONLY_RIGHT,
.communication_format = I2S_COMM_FORMAT_STAND_I2S,
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
.dma_buf_count = 4,
.dma_buf_len = 256,
.use_apll = false,
.tx_desc_auto_clear = false,
.fixed_mclk = 0,
.mclk_multiple = I2S_MCLK_MULTIPLE_DEFAULT,
.bits_per_chan = I2S_BITS_PER_CHAN_DEFAULT,
};
Second feature is probably more complicated. Currently I'm reading audio data in a separate FreeRTOS task, which means that it can read/process audio even if there are other long running tasks in parallel (like HTTP/MQTT requests). Depending on your config/setup you might have or have not them, but I do have and I'd like not to loose audio data.
Considering these 2 issues, I'd say I don't plan to use official i2s_audio for now, but if it will change in future, I can change my mind :)
from esphome-sound-level-meter.
Hi Stas,
bits_per_sample was added recently. Hopefully, sample rate would come soon too:
esphome/feature-requests#2289
Cheers!
from esphome-sound-level-meter.
Related Issues (8)
- Can't get value HOT 1
- WiFi implementation HOT 1
- SLM doesn't start automatically on boot when a switch is configured HOT 3
- Is it possible to stream the captured audio to Home Assistant?
- -256 or -inf db HOT 8
- SPH0645: values are wrong HOT 17
- Add ability to enable/disable component updates dynamically via actions HOT 2
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 esphome-sound-level-meter.