Hasty Briefsbeta

Bilingual

<antirez>

2 days ago
  • The Raspberry Pico is a well-made, durable chip with a ton of features, including state machines for GPIOs, and its lack of connectivity is resolved by the W variant.
  • The chip is well supported by MicroPython and the C SDK, though the build system is overcomplicated for small programs.
  • To generate sound without a DAC, PWM can be used with a high frequency and varying duty cycles to approximate different voltage levels.
  • A WAV file can be converted to raw 8-bit PCM at 24000 Hz using ffmpeg, then played on the Pico by reading the file and setting PWM duty cycles for each sample.
  • The playback speed may not match exactly, requiring manual delay adjustments (e.g., adding dummy statements) to correct the pitch.
  • MicroPython supports threading, which could be used to play audio in a separate thread to avoid blocking the main program.
  • A simple sin wave can be generated by precomputing duty cycle values and looping through them.