DeqingSun / ch55xduino

An Arduino-like programming API for the CH55X
GNU Lesser General Public License v2.1
433 stars 85 forks source link

[Demo] Ch554 USB Audio Speaker #155

Closed ziv2013 closed 6 months ago

ziv2013 commented 8 months ago

Hi,

Thanks for you great work on Ch55x with Arduino. It's quite easy to use.

I have made a USB Audio Speaker based on your USB MSD demo.

You can find my project at

https://mc.dfrobot.com.cn/thread-317671-1-1.html#lastpost

And you can have a try if you have a speaker.

Z.t

DeqingSun commented 6 months ago

Thanks, that opens a lot possibilities. I will check how it works.

ziv2013 commented 6 months ago

Thanks, that opens a lot possibilities. I will check how it works.

Yes, it would be intresting. But I have found a limitation that the max USB buffer size of Ch55x is 128bytes, which is smaller than 192 bytes. Data lost would happen in every package.

DeqingSun commented 5 months ago

I tried to reduce the sample rate to 24K and use mono sound, now the data packet is 48 bytes. Also I used timer interrupt to update PWM, and there is walk-around for PWM bug.

The sound is actually pretty good.

@ziv2013 here is the code

https://github.com/DeqingSun/ch55xduino/tree/9c81b75db732fda867513001db168247cd4bf64d/ch55xduino/ch55x/libraries/Generic_Examples/examples/05.USB/SoundCard

ziv2013 commented 5 months ago

I tried to reduce the sample rate to 24K and use mono sound, now the data packet is 48 bytes. Also I used timer interrupt to update PWM, and there is walk-around for PWM bug.

The sound is actually pretty good.

@ziv2013 here is the code

https://github.com/DeqingSun/ch55xduino/tree/9c81b75db732fda867513001db168247cd4bf64d/ch55xduino/ch55x/libraries/Generic_Examples/examples/05.USB/SoundCard

That's great. I will try your code later.

I'm studying the Ch32V305 these days which USB buffer is big enough. And it's support USB High Speed and I2S.

ziv2013 commented 5 months ago

I tried to reduce the sample rate to 24K and use mono sound, now the data packet is 48 bytes. Also I used timer interrupt to update PWM, and there is walk-around for PWM bug.

The sound is actually pretty good.

@ziv2013 here is the code

https://github.com/DeqingSun/ch55xduino/tree/9c81b75db732fda867513001db168247cd4bf64d/ch55xduino/ch55x/libraries/Generic_Examples/examples/05.USB/SoundCard

It works well. I have tested yesterday.