Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Aug 2011 21:39:21 +0200
From:      Polytropon <>
To:        Gary Kline <>
Subject:   Re: library with click built-in?
Message-ID:  <>
In-Reply-To: <>
References:  <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Fri, 12 Aug 2011 12:27:48 -0700, Gary Kline wrote:
> I only use my FreeBSD computer as a server; it isn't even hooked
> up to my speakers, so there is no way of testing anything i write
> that involves sound.  So....  does anybody know if any other toolkit
> outputs audio?  

There are two means:

The first one is the echoing of the ^G (BEL) character, 0x07
which is handled by the text mode console or terminal emulators
like xterm. In X, the sound that will be produced can be
controlled with a xset setting.

xset [-b] [b {on|off}] [b [volume [pitch [duration]]]]

See "man xset" for details.

The other one is the system speaker. If you have "device speaker"
in your kernel, you can access /dev/speaker (if the permissions
are set properly, see /etc/devfs.conf for an example. Using
the "note language" known from several BASIC dialects for
microcomputers, you can easily create sounds for that. A list
of the "note language" is in "man 4 speaker".

Here's a small example:

read -p "CW ===> " TEXT
echo ${TEXT} | morse | awk '{
	if(length($0) == 0)
	else {
		gsub(" dit", "P32L32E", $0);
		gsub(" di",  "P32L32E", $0);
		gsub(" dah", "P32L8E",  $0);
		printf("%sP16\n", $0);
}' | dd bs=256 of=/dev/speaker > /dev/null 2>&1

NB: The timing is slightly out of proper relation. :-)

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

Want to link to this message? Use this URL: <>