# Discrete Cosine Transformation

**URL:** <https://forum.arduino.cc/t/discrete-cosine-transformation/952018>\
**Category:** Audio\
**Created:** [January 27, 2022, 11:03am UTC](https://forum.arduino.cc/t/discrete-cosine-transformation/952018 "2022-01-27T11:03:55Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![stamatakis](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stamatakis/32/732354_2.png) [@stamatakis](https://forum.arduino.cc/u/stamatakis)\
**Post date:** [January 27, 2022, 11:03am UTC](https://forum.arduino.cc/t/discrete-cosine-transformation/952018/1 "2022-01-27T11:03:55Z")

</div>

i want to develop an application that will get an audio signal in nano33ble sense or an esp32 and to extract the discrete cosine coefficients (or the wavelet coefficient ) of tha captured raw audio data. any help would be apreciated. Anyone ever implemented such a project ?

---

<div class="post-metadata">

**Author:** ![anon73444976](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@anon73444976](https://forum.arduino.cc/u/anon73444976)\
**Post date:** [January 27, 2022, 11:39am UTC](https://forum.arduino.cc/t/discrete-cosine-transformation/952018/2 "2022-01-27T11:39:18Z")

</div>

I've implemented DCT (and IDCT) for JPEG, but never for audio.  
How big ?

---

<div class="post-metadata">

**Author:** ![stamatakis](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stamatakis/32/732354_2.png) [@stamatakis](https://forum.arduino.cc/u/stamatakis)\
**Post date:** [January 27, 2022, 12:11pm UTC](https://forum.arduino.cc/t/discrete-cosine-transformation/952018/3 "2022-01-27T12:11:56Z")

</div>

at various sampling rates the 1D vector will be 1024 or maximum 4096 if that is possible.  
i want to extract that coeffs in order to use them as features to train a machine learning model to classify sounds.

---

<div class="post-metadata">

**Author:** ![hzrnbgy](https://avatars.discourse-cdn.com/v4/letter/h/90db22/32.png) [@hzrnbgy](https://forum.arduino.cc/u/hzrnbgy)\
**Post date:** [January 27, 2022, 1:05pm UTC](https://forum.arduino.cc/t/discrete-cosine-transformation/952018/4 "2022-01-27T13:05:12Z")

</div>

The first order of business is getting the raw PCM data. Do you plan on using Bluetooth? I would suggest getting the raw audio instead of some compress format for faster processing (at the cost of more SRAM)

---

<div class="post-metadata">

**Author:** ![stamatakis](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stamatakis/32/732354_2.png) [@stamatakis](https://forum.arduino.cc/u/stamatakis)\
**Post date:** [January 27, 2022, 1:20pm UTC](https://forum.arduino.cc/t/discrete-cosine-transformation/952018/5 "2022-01-27T13:20:58Z")

</div>

Thank you for your answer.  
No i will use a max4466 and esp or the model nano33ble mic. I won't uses Bluetooth. Will get raw data uncompressed.

---

<div class="post-metadata">

**Author:** ![hzrnbgy](https://avatars.discourse-cdn.com/v4/letter/h/90db22/32.png) [@hzrnbgy](https://forum.arduino.cc/u/hzrnbgy)\
**Post date:** [January 28, 2022, 1:43am UTC](https://forum.arduino.cc/t/discrete-cosine-transformation/952018/6 "2022-01-28T01:43:33Z")

</div>

The module is basically a microphone with an analog out. You can use the ADC peripheral of the ESP (if it has one) and sample the data at whatever sampling rate you desire. You save the sampled data set in SRAM and from there do your Math thing. That's the gist of it.

---

<div class="post-metadata">

**Author:** ![stamatakis](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stamatakis/32/732354_2.png) [@stamatakis](https://forum.arduino.cc/u/stamatakis)\
**Post date:** [January 28, 2022, 12:11pm UTC](https://forum.arduino.cc/t/discrete-cosine-transformation/952018/7 "2022-01-28T12:11:27Z")

</div>

Thanks for you kind interest  
I have the same thoughts about the procedure  
I just want to k ow if some one has something imemented as far as the dct or dwt just to save time ...

---

<div class="post-metadata">

**Author:** ![stamatakis](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stamatakis/32/732354_2.png) [@stamatakis](https://forum.arduino.cc/u/stamatakis)\
**Post date:** [January 28, 2022, 12:12pm UTC](https://forum.arduino.cc/t/discrete-cosine-transformation/952018/8 "2022-01-28T12:12:13Z")

</div>

Thanks for you kind interest  
I have the same thoughts about the procedure  
I just look for the dct implemented algorithm

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 27, 2022, 12:12pm UTC](https://forum.arduino.cc/t/discrete-cosine-transformation/952018/9 "2022-07-27T12:12:41Z")

</div>

Closed on July 27, 2022, 12:12pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
