Search found 9 matches
- Fri Oct 13, 2023 9:11 pm
- Forum: ESP-IDF
- Topic: Unable to do simple audio transformations
- Replies: 17
- Views: 3045
Re: Unable to do simple audio transformations
sample = (int32_t)(((int8_t)buffer[sIndex + 2])<<16 | (buffer[sIndex + 1])<<8 | (buffer[sIndex + 0])); So the byte order actually was little-endian all along ;) Btw, for performance reasons, I would definitely steer clear of using double, and generally would avoid/reduce floating point calculations...
- Fri Oct 13, 2023 5:46 pm
- Forum: ESP-IDF
- Topic: Unable to do simple audio transformations
- Replies: 17
- Views: 3045
Re: Unable to do simple audio transformations
I don't know how and why, but I finally managed to do it. Two months, I tried every witchery and randomly when clearing the bloated lines and the commented definitly not working ones, it works ! I thank both of you guys (MicroController and ESP_Sprite) Here is the working code (for one channel), if ...
- Fri Oct 13, 2023 5:24 pm
- Forum: ESP-IDF
- Topic: Unable to do simple audio transformations
- Replies: 17
- Views: 3045
Re: Unable to do simple audio transformations
Here's how I would probably draft it: static const uint32_t bytes_per_sample = 3; static const uint32_t samples_per_frame = 2; // Read a big-endian, signed 24-bit value from src static int32_t read24(const uint8_t* const src) { int32_t r = (int8_t)src[0]; // takes care of the sign-extension r = (r<...
- Thu Oct 12, 2023 7:17 pm
- Forum: ESP-IDF
- Topic: Unable to do simple audio transformations
- Replies: 17
- Views: 3045
Re: Unable to do simple audio transformations
(Before treatment) sample[Left] = 0X831700 (8591104) That would be a large negative value (-8186112), very close to the maximum amplitude representable in 24bits (-8388608). Double-check the byte order in the buffer. And make sure you operate on the signed values. (int32_t signed32 = ((int32_t)(sam...
- Wed Oct 11, 2023 11:11 am
- Forum: ESP-IDF
- Topic: Unable to do simple audio transformations
- Replies: 17
- Views: 3045
Re: Unable to do simple audio transformations
Erm... you sure the I2S doesn't require 24 bits of sample data in 32-bits variables? Do you mean using 1 u32bit variable instead of a 3 u8bit ? I already tried that as well In the datasheet of the UDA1334 (page 10 https://www.nxp.com/docs/en/data-sheet/UDA1334ATS.pdf#page=10 ), in 24 bit mode, the ...
- Wed Oct 11, 2023 12:34 am
- Forum: ESP-IDF
- Topic: Unable to do simple audio transformations
- Replies: 17
- Views: 3045
Re: Unable to do simple audio transformations
Plus, the samples are signed , two's complement values; so you have to sign-extend them to int32_t before multiplying. I also tried converting the values into signed int32_t, either by bit shifting or by map() (to get a more accurate conversion, I guess). Nothing works. I don't know why, because wh...
- Tue Oct 10, 2023 5:40 pm
- Forum: ESP-IDF
- Topic: Unable to do simple audio transformations
- Replies: 17
- Views: 3045
Re: Unable to do simple audio transformations
I tried to set manually the sample into little endian and in big endian, still noise. // @return Returns the first 24 bits #define as24bit(n) (uint32_t)(n&0xFFFFFF) #define CONVERT32bits(b,o) (uint32_t)(b[o]<<16 | b[o+1]<<8 | b[o+2]) /* @param n The number to convert @param o Byte offset (0:Right, 1...
- Tue Oct 10, 2023 7:10 am
- Forum: ESP-IDF
- Topic: Unable to do simple audio transformations
- Replies: 17
- Views: 3045
Re: Unable to do simple audio transformations
Both I2S port are configured as little endian (or big endian to false) through this parameter Do you think this is the source of the problem ? https://docs.espressif.com/projects/esp-idf/en/v5.1.1/esp32s3/api-reference/peripherals/i2s.html#_CPPv4N21i2s_std_slot_config_t10big_endianE (extract from th...
- Mon Oct 09, 2023 9:55 pm
- Forum: ESP-IDF
- Topic: Unable to do simple audio transformations
- Replies: 17
- Views: 3045
Unable to do simple audio transformations
I'm trying to do a I2S microphone + headphone example program with basic audio manipulation (eg: gain, delay, etc...) I have successfully done the simple part that gets the data from the microphone (using the INMP441, 24bits @ 48kHz), and sends it to the headphones (using the UDA1334, 24bits @ 48kHz...