I want to generate a PWM signal on Ubuntu. My first try was to use siggen package. Upon launching signalgen I have the following error:

$ signalgen -v sin 120
signalgen  Ver. 2.3.10 (May 2008)   Digital Signal Generator
/dev/dsp : DAC Opened for output
22050 mono, signed 16 bit, little endian, samples/sec.
8192 bytes per DAC buffer.
[signalgen] Invalid argument : Sound card doesn't support format requested.
$ sudo signalgen -v sin 120
signalgen  Ver. 2.3.10 (May 2008)   Digital Signal Generator
[signalgen] Input/output error : /dev/dsp

What is wrong ?

1 Answer 1


The last Ubuntu release with /dev/dsp support was 10.04. After that support for /dev/dsp was removed.

To still be able to use older software that rely on /dev/dsp there is a compatibility wrapper padsp which redirects sound output meant for dsp to a running pulseaudio server. We may use this wrapper with the following terminology:

padsp [options] APPLICATION [arguments ...]
padsp signalgen -v sin 120

By this we may be able to also play the output of signalgen to our soundcard. The OSS complatibility layer will be installed as a dependency with siggen Install siggen.

If we do not want to output the sound directly we can use signalgen to directly write a raw audio file to then play this file through ALSA using aplay

signalgen -w filename -t 5 sin 120 & aplay filename

Note that signalgen will exit if filename already existed.

A better approach to generate waves without the need of a compatibility layer would be applications that are able to directly address ALSA or PuleAudio.

Sox Install sox.

Sox will install the command line utility play which will not only play sound files but can also generate audio waveforms and can add effects to them:

play -n synth sine 120.0 gain 0.0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .