sharpie7 / circuitjs1

Electronic Circuit Simulator in the Browser
GNU General Public License v2.0
2.23k stars 621 forks source link

Feature request: Interpolate audio input file for smaller time steps #895

Open ericfont opened 9 months ago

ericfont commented 9 months ago

I was simulating a siulating an audio input waveform going into a simple RC differentiatior:

image

But because the Audio Input component doesn't provide any interpolation, the oscilloscope waveform output wasn't terribly useful for the desired application of analog audio:

image

My workaround was to resample the audio at a much much higher sampling rate, and then use a step size in circuitjs that was larger than that sampling period, so the oscilloscope waveforms now look smoother:

image

But unfortunately this workaround means I have to upsample the waveform and save it as a much larger .wav file.

So I would like to make a feature request to add an "interpolate" option to the Audio Input component, that would automatically interpolate the file for the time step size. Simple linear interpolation would suffice, but smoother interpolation would be better too. This option might also apply to the Data Input as well.

Anyway, just a feature request.