Doubt about sampling bits and SineWaveGenerator constructor (and maybe other constructors as well) #844
-
Hi there, Phil First things first: many thanks for all your work in this framework, it's helping us a lot by making our efforts a lot easier. Now the question: My doubts are:
I've read quite a lot of the wiki and the source code but it's still not clear to me (it's already a big framework), and maybe I'm getting it all wrong, so that's why I decided to ask: if I want a 10 or 12 bit kind of audio, I assume I need to use int16_t as the base type for all my classes (minimum able to cover my needs), but also establishing that "hard limit" (10/12) in the bits_per_sample field in the AudioInfo config, right? I'm also lost with where should I put "initialization" code: constructor, begin(), etc. and what happens if retrieving methods of a class (e.g. I'm working on a new class based on Best regards! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
The max amplitude is just a convenient way to define the volume e.g. in a test sketch. My recommendation would be to use the max volume and modify the volume with a VolumeStream. If you have some doubts, I suggest to have a look at the different examples. The bits_per_sample in the configuration is mainly relevant for the untyped classes, but it is recommended to keep things consistent: 12 or 10 is nonsense. The only meaningful values in audio are 16, 24 and 32. |
Beta Was this translation helpful? Give feedback.
-
The 8bits in the ESP32 is only working to my knowledge in some exceptional cases, so I would not recommend to rely on this The enum that I sent you is just an example for the esp32 i2s, that I used as a base line. In the first chapter of the Wiki I describe the PCM data format! |
Beta Was this translation helpful? Give feedback.
-
mgesteiro is right with his ideas that it would be much more flexible to work with the library, which is good, but little things are missing. |
Beta Was this translation helpful? Give feedback.
-
mgesteiro is right with his ideas that it would be much more flexible to work with the library, which is good, but little things are missing. |
Beta Was this translation helpful? Give feedback.
-
This is an open source project! If you feel that anything is missing feel free to contribute. |
Beta Was this translation helpful? Give feedback.
Did you already read the Wiki ? The bits_per_sample just describes the supported integer types which are int16_t, int24_t and int32_t. This corresponds with https://docs.espressif.com/projects/esp-idf/en/v4.2/esp32/api-reference/peripherals/i2s.html#_CPPv421i2s_bits_per_sample_t