A function generator is usually a piece of electronic test equipment or software used to generate different types of electrical waveforms over a wide range of frequencies. Some of the most common waveforms produced by the function generator are the sine, square, triangular and sawtooth shapes.
Some people prefer a standalone unit and others can use a smart phone or a computer to do the job. It all depends on the applications you plan to use it with.
Today we will focus on setting up a software based function gen in Debian Linux.
If you’re running a typical modern Linux box then chances are you will be using ALSA (Advanced Linux Sound Architecture) Most of the function generator software is pretty much outdated and is more geared for the OSS (Open Sound System). However there is a light at the end of the tunnel. If you have ROOT access then you can just emulate OSS within ALSA.
Lets start with setting up ALSA to use OSS.
Inside of a terminal window just run sudo apt-get install siggen It doesn’t take hardly any space and it’s quick. Now we need to add the ALSA-OSS emulation. Once again run in the terminal sudo apt-get install alsa-oss By now it should be good to go. As a normal user run the following command aoss siggen
If some how you run into issues you can install the oss-compact package with apt-get. Also take note it might lag a bit but there is another work around. If you installed the following packages correctly you could make OSS and ALSA run with each other but they could fight each other depending on the sound card your system is using. If all else fails you can revert back and just use the alsa-oss emulation.
With ROOT access we can manually load two kernel modules to memory.
user@mypc:~$ modprobe snd_pcm_oss
user@mypc:~$ modprobe snd_mixer_oss
After loading the modules try running siggen without the aoss syntax.
If everything works you can now add the modules to load up at boot time. To do this we need to edit the modules file located in /etc/
Open your favorite text editor and open /etc/modules/ from there go to the bottom of the file and add snd_pcm_oss and snd_mixer_oss. It should look something like this.
# /etc/modules: kernel modules to load at boot time.
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with “#” are ignored.
The software side is complete. The hardware side of things is the difficult part. Most modern computers have front audio jacks we can use the headphones jack for the output, however it can also be a backlash. If you use a plan old audio cable it can pickup some unwanted distortion from the computer’s switch mode power supply or even surrounding devices. Also you’ll have to fine tune the volume. Not to mention what kind of adapter you want to use to plug into such as a scope. Some simple coax cable or any shielded cable will do for plugging into the headphones jack. From there you can just use a small project box or even a old Altoids can and wire up a BNC, banna plug jack an a pot. Since the computer is stereo and siggen offers dual channels we can also make a dual channel control. I myself used this diagram.
On the outputs I have them running to switches so I can select between BNC and Banana jacks. The POT is a typical 100k. So all you have to do is have the headphone output on the computer set to mid volume and then use the POT to fine tune.