TinyTapeout / vga-playground

Playground for VGA projects on Tiny Tapeout
https://tinytapeout.github.io/vga-playground/
GNU General Public License v3.0
48 stars 8 forks source link

Audio output #12

Closed rejunity closed 2 weeks ago

rejunity commented 2 weeks ago

Implemented WebWorker to resample output audio according to difference between browser FPS and expected (60) frame rate of VGA output from Verilator.

New audio pipeline: 1) first generated audio samples are low-pass filtered (20 kHz) to approximately simulate Audio PMOD behavior and reduce occasional high-pitch noise especially when browser FPS significantly differs from 60 Hz 2) filtered samples are accumulated in the ring-buffer (approximately 5 frames for data) of audio Web Worker running on a separate thread. Ring-buffer helps to amortise uneven framerate and keeps worker thread from starving or overflowing. 3) finally, audio Web Worker thread is responsible for resampling available audio data so that it is stretched or compressed to match the sampling rate of the audio driver.

urish commented 2 weeks ago

Superseded by #13