Another one! CircuitPython SynthWaveform Helper Library

Starting out with synthio and tired of using your bog standard square and sine waveforms? Well… this library still does that, but it can do a lot more too, I promise!

The CircuitPython_SynthWaveform library is designed to make it easy to generate common waveforms and mix them together to achieve complex results. Want to create a triangle wave with 3 octaves of sawtooth harmonics embedded into it? Easy as pie. 🥧

import synthwaveform
waveform = synthwaveform.mix(
    (synthwaveform.triangle(), 0.7),
    (synthwaveform.saw(frequency=2.0), 0.1),
    (synthwaveform.saw(frequency=3.0), 0.1),
    (synthwaveform.saw(frequency=4.0), 0.1),
)

I’ve included a video deep dive into how this library works with a demonstration of each example including the cool one, examples/synthwaveform_oscilloscope.py. 😎 It’s a bit off-the-cuff and loooong, but hopefully there’s enough interesting content there to keep you watching.

Features

  • Generate sinusoidal, triangle, sawtooth, and square waves
  • Amplitude, phase, frequency, and direction/duty cycle parameters
  • Import waveform from WAV file
  • Waveform mixer

2024-09-14 Update: The documentation has been completed and is live on readthedocs.io.

Posted on

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *