Is it possible to redirect speaker to audio device?

Is it possible to redirect speaker to audio device? How?

My computer does not have speaker, but has audio working. and I want to use it without monitor
running a special program. Perhaps the command morse helps.

And it would be nice to have a morse login shell, morsesh :).
 
Look at the output from cat /dev/sndstat. Those are the detected audio devices. You can switch the default audio with sysctl hw.snd.default_unit=<X> and switch it to an audio card with a speaker/line-out. Connect some speakers (or the line-out to an amplifier) and you should have audio through that.
 
SirDice: I think he is talking about spkr(4) (/dev/speaker), and the fact that either his mainboard does not have a speaker connector, or his PC case does not contain a speaker connected to it.

hruodr: Unfortunately there is no way to redirect the spkr(4) device to a sound(4) device. They work in completely different ways.

I noticed there is a “speaker” setting in the output from mixer, but it doesn’t seem to have any effect on my machine. Personally I have set the bell type to “visual” (see kbdcontrol(1)) so the terminal flashes when a program emits '\a' outside of X11. Personally I dislike the mainboard’s simple speaker anyway; it sounds awful. (YMMV, of course.)
 
I think he is talking about spkr(4) (/dev/speaker), and the fact that either his mainboard does not have a speaker connector, or his PC case does not contain a speaker connected to it.
That is the case. In my desktop there is no speaker. I do not know if that is also the case in the thin client that will be my MusicBox.

I personally prefer the sound of the speaker, or even nothing, than a flashing terminal or a blinking cursor.

Perhaps I get a way of generating sounds with tcl for communicating with the monitor-less thin client.
 
I noticed there is a “speaker” setting in the output from mixer, but it doesn’t seem to have any effect on my machine
I do not know if that is also the case in the thin client that will be my MusicBox.
I've seen some implementations that had the speaker output wired up to the audio card. Doesn't seem to be common though, probably because the speaker pretty much lost its function as more and more mainboards have audio cards integrated on them nowadays. In the old days that speaker had a real function besides the diagnostics beeps.
 
Perhaps I get a way of generating sounds with tcl for communicating with the monitor-less thin client.
Oh, you just want to generate sounds for your soundcard (or onboard audio hardware)? Why didn’t you say that in the first place? That’s easy, and you don’t need spkr(4) for that at all.

If you need to play short sounds from the command line or from shell scripts, the easiest way is to install sox (audio/sox).
To play a very simple short beep, you can use sox to generate a sine note, e.g. the famous 440 Hz a’:
Code:
sox -n -d synth 0.2 sine A4
The following is a longer note that sounds almost like a real stringed instrument:
Code:
sox -n -d synth 4 pluck A4
You can also use sox to synthesize more complex sounds. The following sounds similar to an organ. See the sox(1) manual page for details.
Code:
sox -n -c1 -d synth sin %-12 sin %-9 sin %-5 sin %-2 fade h 0.1 1 0.1

When you use other programming languages, you can also call sox, or you can create your own samples (e.g. create an array with sine data) and write it to /dev/dsp, or you can use one of the various audio API libraries (ALSA etc.).
 
Something like that is an alternative, if not a library for tcl. I must search for the simplest way.

The issue is to get some feedback from the computer since I dot have a monitor.
 
Back
Top