Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is bit-width 8 or 16? #2

Open
khanhhuyen-comnosoft opened this issue Sep 26, 2024 · 4 comments
Open

is bit-width 8 or 16? #2

khanhhuyen-comnosoft opened this issue Sep 26, 2024 · 4 comments

Comments

@khanhhuyen-comnosoft
Copy link

Hi, I just wonder why you are using a PCM file with a bitwidth of 8, but the I2S configuration is set to 16. How can it work? If I try to change the input file to a u16be bitwidth PCM, it produces noise

@liux-pro
Copy link
Owner

Hi,

16-bit data is too large for flash, so I’m using 8-bit data and converting it to 16-bit by shifting bits. Each 8-bit value is converted to 16-bit and stored in a buffer. This approach also allows me to control the volume by adjusting the number of left shifts.

for (int i = 0; i < EXAMPLE_BUFF_SIZE; i++) {
offset++;
buffer[i] = pcm_start[offset]<<3;
}

@liux-pro
Copy link
Owner

While the sound quality is indeed reduced, it still sounds fine to me.

@khanhhuyen-comnosoft
Copy link
Author

thank for response, if so, why you don't config i2s to handle 8 bit-width data? I try to do this but there is no sound, if I feed 16 bit-width input, it will play weird sound (noise).

@FAOEOYI
Copy link

FAOEOYI commented Jan 22, 2025

thank for response, if so, why you don't config i2s to handle 8 bit-width data? I try to do this but there is no sound, if I feed 16 bit-width input, it will play weird sound (noise).

I have the same problem as you, and the same noise is made. Have you solved it? Can you tell me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants