Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm interested in creating musical programs like these:


Essentially these programs just generate sequences of integers, which (apparently), when fed directly into a 8khz audio stream (like "/dev/audio"), produce interesting music.

My problem is that my system does not have /dev/audio. In fact, looking through my /dev, it's unclear to me whether any of the devices is a direct audio interface.

I have two questions:

  1. Is there a nice package which will let me pipe in a stream of numbers from the command line, and produce a matching 8Khz audio output?

  2. If not, how might I go about directly accessing my audio device?

share|improve this question
Answered my own question, but can't put it in as an answer yet (not enough reputation). This works fine for me: ./a.out | aplay – John Doucette Oct 2 '11 at 5:20
up vote 2 down vote accepted

This worked out fine for me:

./a.out | aplay
share|improve this answer
Thanks! And you probably have enough reputation now to mark that as the answer. – phyzome Jan 21 '13 at 2:52

From the video it looks like they are using PCM. On Ubuntu try using /dev/snd/pcm*

share|improve this answer
So I've tried ./a.out > /dev/snd/pcm[some identifier] for all /dev/snd/pcm*. None of them produce audible sounds. Is there something extra I need to do? – John Doucette Oct 2 '11 at 5:06
You might need to set the volume: manpages.ubuntu.com/manpages/gutsy/man1/amixer.1.html – polynomial Oct 2 '11 at 5:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.