Arbitrary Waveform Signal Generator

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

vintageampfixer

Well-known member
Joined
Dec 28, 2021
Messages
104
Location
UK
I'd like to be able to play various arbitrary waveforms which have been generated in Excel or something and visualised using charts - a couple of examples below. I can export the waveform chart data in CSV format ... and I can then import it into PicoScope's Arbitrary Waveform Generator which replays it well but I'd really like something to allow the sound to be replayed via the Windows OS and output to my laptop ... because there are times when you want a quick (and dirty) answer, and where that'd be good enough ... it'd save me connecting my PicoScope, finding an amplifier and speaker plus all the cables to connect it ... OK, I'm being lazy really but I'd still really like a solution. Did I mention free? There must be something that's a free download ...

Any ideas?

1725486123066.png 1725486186855.png
 
Python can read CSV files (https://docs.python.org/3/library/csv.html) and write WAV files (https://docs.python.org/3/library/wave.html) so a quick script might do the job, if you don't mind some command-line action. If I get some time I'll knock something up.
Cool!

The CSVs started with 360 samples in the range -1 to +1 making up a single cycle but currently have either 1024 samples for PicoScope or 4096 for the National Instruments Waveforms software. Neither is time-bound in the CSV, rather a period is set in either PicoScope or the Waveforms software. The number of samples to make up one cycle is fairly easy to alter.
 

Attachments

  • linear csv.txt
    13.4 KB
OK, the attached Python script seems to work for me (I've had to rename it csv2wav.py.txt to attach it).

On a Mac you can run it (in Terminal) like this:
$ python3 csv2wav.py "linear csv.txt" out.wav
Read 1024 input samples
Wrote out.wav

Windows should be similar, using CMD.EXE.

Output WAV file is attached - looks like a low-frequency sawtooth-ish wave?
 

Attachments

  • csv2wav.py.txt
    1.4 KB
  • out.wav
    862 KB
Back
Top