Add square wave to generators


It would be great to see square wave as an option for the audio generator function.
It’s useful when debugging digital things.


Hi @audio-dav, the rise time is so poor with audio-based generators I’m not sure waveforms other than sine are that useful. Here’s a square wave with ~ 10nS rise time from a proper sign-gen that is captured by the audio ADC on the QA401. Note this is the opposite of what you’ve proposed, but it’s still relevant because it shows what the ADC (or DAC) filters do to square waves:

Note the rise time is about 50 uS (0.02 V/uS) and it has horrid overshoot (Gibbs phenom). The overshoot you see is the result of the step function being pushed-through the massive DAC (or ADC) filters.

For driving digital, unless you have Schmitt trigger inputs, most logic families want to see edge rates that are 100X to 1000X faster, otherwise the slow edge rates cause the logic to consume a lot of current.

A common request is also square waves to check amplifier stability. But it’s really the same problem: The edge rates aren’t fast enough compared to the amp. Above we see about 0.02V/uS rise time. A modern power opamp such as the OPA564 has slew rates of 40V/uS, or about 2000X faster.

In the end, the very sophisticated filters in all audio ADC/DACs make them unsuitable for just about anything other than audio.

For our use-cases, it’s totally fine with a “non perfect” square-wave. if you measure I2S in the digital domain, it’s nice to run altering data 1111 vs 0000 so a bit of overshoot is fine