Skip to content

Commit f3d40af

Browse files
authored
I2S-Audio: decoder_types, loop, build options
1 parent a3e96d7 commit f3d40af

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

docs/I2S-Audio_ESP32.md

+24-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@
99
-DUSE_I2S_ALL
1010
```
1111
Also requires `lib_extra_dirs = lib/lib_audio` added to the build environment
12+
13+
You can create smaller firmware versions with selective use of the build flags:
14+
```
15+
#define USE_I2S ; base flag - always needed
16+
#define USE_I2S_AUDIO ; base flag - always needed
17+
#define USE_I2S_MIC ; microphone support
18+
#define USE_SHINE ; MP3 encoder support for microphone
19+
#define MP3_MIC_STREAM ; streaming from microphone to local network
20+
#define USE_I2S_AUDIO_BERRY ; the I2S module for Berry
21+
#define USE_I2S_AAC ; AAC decoder - needs about 75 kB flash
22+
#define USE_I2S_OPUS ; OPUS decoder - needs about 25 kB flash
23+
```
1224

1325
The main difference to the older ESP8266 sound driver is the configuration of the various settings at runtime with the command `i2sconfig`, which uses a hidden driver file.
1426

@@ -138,12 +150,21 @@ Those channels can be driven via the I2S driver when using the “built-in DAC m
138150
|CMD DAC|action|
139151
|---|---|
140152
|I2SGain | `0..100` = sets the volume of the audio signal |
141-
|I2SPlay | `/file.mp3` = plays a .mp3 audio file from the file system, the systems blocks until sound is played<BR>`+/file.mp3` = plays a .mp3 audio file from the file system, sound is played in a separate task not blocking the system|
153+
|I2SPlay | `<decoder_type> file` = plays an audio file from the file system, sound is played in a separate task not blocking the system|
154+
|I2SLoop | `<decoder_type> file` = plays an audio file from the file system in an endless loop<br>Example: `i2sloop2 file.opus`|
142155
|I2SRtttl| `string` = play [Ring Tones Text Transfer Language (RTTTL)](https://www.mobilefish.com/tutorials/rtttl/rtttl_quickguide_specification.html) ringtones (requires defined `USE_I2S_RTTTL`) |
143156
|I2SSay | `text` = speaks the text you typed (only English language supported)|
144157
|I2STime | tells current Tasmota time in English (requires defined `USE_I2S_SAY_TIME`)|
145-
|I2SWr | `url` = starts playing an [mp3 radio](http://fmstream.org/) stream, no blocking (requires defined `USE_I2S_WEBRADIO`)<BR>no parameter = stops playing the stream|
158+
|I2SWr | `<decoder_type> url` = starts playing a [radio](http://fmstream.org/) stream, no blocking (requires defined `USE_I2S_WEBRADIO`)<BR>no parameter = stops playing the stream|
146159
|I2SStop | stops current play operation|
160+
161+
Tasmota can support multiple audio decoder types for file play/loop and web radio, which are MP3, AAC and OPUS. For the referring commands the type is provided at the `index` position of the command (right behind the command without a space). The filename does not matter, there is no check for naming conventions. Wrong combinations can lead to crashes.
162+
163+
|Decoder index|Decoder name|
164+
|---|---|
165+
|0| AAC - must be provided as `AAC` format, not embedded in an `M4A` container!|
166+
|1| MP3 - if you do not provide the type explicitly, this is the automatic default
167+
|2| OPUS - most modern and open standard, but has highest memory requirements. Allows nearly perfect gapless looping.|
147168

148169

149170
## Audio Input
@@ -216,4 +237,4 @@ build_flags = ${env:tasmota32_base.build_flags}
216237
|---|---|
217238
| I2SBridge | `ip` = sets the IP of the slave device<BR>`0` = stop bridge<BR>`1` = start bridge in read mode<BR>`2` = start bridge in write mode<BR>`3` = start bridge in loopback mode<BR>`4` = set bridge to master<br>`5` = set bridge to slave<br>`6` = set microphone to swapped<BR>`7` = set microphone to not swapped<BR>`p<x>` = sets the push to talk button where `x` is the button's GPIO pin number|
218239

219-
If a push to talk button is defined the bridge goes to write mode if the button is pushed and to read mode if the button is released
240+
If a push to talk button is defined the bridge goes to write mode if the button is pushed and to read mode if the button is released.

0 commit comments

Comments
 (0)