I want to play sound from an progmem array using max98357 using I2S.
In the basic example with the driver/i2s.h library, there is only reading from an external ADC, but I need to write to an external DAC. Examples from the ESP8266Audio library are very heavy, take a very long time to compile and often with errors, and often the ArduinoIDE does not even complete the compilation, the application does not respond, although even this library uses the driver/i2s.h standard library.
Please give an example of how easy it is to build and send an array via i2s to max98357 using the driver/i2s.h library.
How to use this instruction ?
esp_err_t i2s_write(i2s_port_t i2s_num, const void *src, size_t size, size_t *bytes_written, TickType_t ticks_to_wait);
/**
* @brief Write data to I2S DMA transmit buffer while expanding the number of bits per sample. For example, expanding 16-bit PCM to 32-bit PCM.
*
* @param i2s_num I2S_NUM_0, I2S_NUM_1
*
* @param src Source address to write from
*
* @param size Size of data in bytes
*
* @param src_bits Source audio bit
*
* @param aim_bits Bit wanted, no more than 32, and must be greater than src_bits
*
* @param[out] bytes_written Number of bytes written, if timeout, the result will be less than the size passed in.
*
* @param ticks_to_wait TX buffer wait timeout in RTOS ticks. If this
* many ticks pass without space becoming available in the DMA
* transmit buffer, then the function will return (note that if the
* data is written to the DMA buffer in pieces, the overall operation
* may still take longer than this timeout.) Pass portMAX_DELAY for no
* timeout.
*
* Format of the data in source buffer is determined by the I2S
* configuration (see i2s_config_t).
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
*/
I'm looking for an example for I2S
Re: I'm looking for an example for I2S
The examples only show how to use with I2S driver, which is only for low critical task.
I cannot find the example for S3 either. I only found I2S driver for ESP32 which located here.https://github.com/bdring/FluidNC/blob/ ... I2SOut.cpp
I cannot find the example for S3 either. I only found I2S driver for ESP32 which located here.https://github.com/bdring/FluidNC/blob/ ... I2SOut.cpp
Who is online
Users browsing this forum: No registered users and 40 guests