Fwd: Re: Playing tone through speakers

Thomas Stivers stivers_t at tomass.dyndns.org
Sat Jan 22 13:37:37 EST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

- ----- Forwarded message from Sam Watkins <swatkins at fastmail.fm> -----

From: Sam Watkins <swatkins at fastmail.fm>
Subject: Re: Playing tone through speakers

I thought you might find this interesting.

On Fri, Jan 14, 2005 at 01:19:20PM -0600, Michael Satterwhite wrote:
> So the correct question would be: Does anyone know of a utility that
> would play a continuous tone of a specified frequency through the
> speakers attached to my SoundBlaster Live?

Yes, I wrote one, it's called "bell".  It's OSS specific at the moment,
but I suppose it would work with ALSA's OSS emulation.

  http://nipl.net/hacks/

It's written in my C dialect, which has a python-like syntax, and uses
some libraries I wrote.  Here is the source code:

  http://nipl.net/hacks/bell.b

I wrote a program yesterday to automatically make standalone source
files so I wouldn't have to burden you with my libraries.  Here is the
source code including the bits of my libraries it needs:

  http://nipl.net/hacks/bell.b1

Here is the C translation, this is the one you'll need if you want to
compile it yourself:

  http://nipl.net/hacks/bell.c

And here is an i386/linux elf executable:

  http://nipl.net/hacks/bell


To compile:

  gcc -Wall -lm bell.c

Usage:

  bell <freq> <amplitude> <duration>

Examples:

  bell 440 1 1
  
gives an A440 tone at max volume for 1 second.

  bell 220 0.5 0.1

gives an A220 tone (one octave lower) at half volume for 0.1 second.


If you are musically inclined, you might want to do something like this
to use semitones instead of hertz (beware, perl code):

sub bell {
	my ($pitch, $duration, $volume) = @_;
	$volume = $ENV{bell_volume} if @_ == 2;
	my $freq = 440 * 2 ** ($pitch / 12);
	system("bell", $freq, $volume, $duration);
}

I should probably modify the bell program to do this itself.


I wrote this bell program as part of my "voice editor", "ved", which is
intended for blind people to record and edit speech, or for people to
record audio-books, or for children who have trouble writing or typing
to be able to record stories for school then write them down later.
I found it was quite good for recording a diary too.

It allows you to record your speech, automatically splits the recorded
sound into sentences and omits stretches of silence.  You can browse
back and forth and change things, insert new recorded speech, etc., play
back the recording at various speeds (using sox), structure your work
into paragraphs and chapters and browse around a paragraph or chapter at
a time, etc.  I wrote it for my grandmother who cannot see very well.

I intend to release "ved" as free-software, would anyone be interested
in using it when I do?


- -- 
To UNSUBSCRIBE, email to debian-user-REQUEST at lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster at lists.debian.org



- ----- End forwarded message -----

- -- 
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan

Thomas Stivers	e-mail: stivers_t at tomass.dyndns.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFB8p1w5JK61UXLur0RAgjtAJ94cJFS6c090fVK+K+/0BkTa0Ys6wCZAcvh
v3+jyIAgcEWF2O/CIAYd+oc=
=dzI7
-----END PGP SIGNATURE-----




More information about the Speakup mailing list