Sound Through the PC-Speaker
Linux supports most of the popular sound cards. If you don't have a sound card, you can still get a degree of sound support from the humble speaker that came with your PC. In this article, I will discuss one way of obtaining sound output without a sound card.
PC-Speaker is a driver for the modest sound output device that comes standard with most (perhaps all?) IBM PC clones. It is installed as part of the kernel or as a loadable module; either way, the kernel needs to be changed. PC-Speaker comes with a small set of programs to use with it—I have compiled these programs on my system without trouble.
The driver comes as a patch file, which must be applied to the Linux source directory (/usr/src/linux). When make<\!s>config is run after applying the patch, it will ask whether you want PC-Speaker support—answer “yes”. Give the commands:
make depend; make clean; make zImage
and your new kernel will be ready. The patches to the source include some header files for /usr/include/sys, which are necessary to make the utilities that accompany the driver.
The driver supports the following devices :
/dev/pcsp: The raw data device
/dev/pcaudio: The SUN-audio device
/dev/pcmixer: The mixer-device
I have /dev/pcsp only defined on my machine:
crw--w--w- 1 root root 13, 3 Aug 27 20:25 /dev/pcsp
The program pcsel sets options for PC-Speaker and is used to configure the /dev/pcsp device at system startup and to test new devices. You can also assign an output device to /dev/pcsp using the pcsel program. The supported output devices are:
Stereo-on-One (designed by Mark J. Cox), which is auto-detected during kernel startup and selected by default.
PC-Speaker, which is selected if Stereo-on-One was not found.
Mono DAC, which is for one lp-port.
Stereo DAC, which is for two lp-ports.
Listing 1. Help Output from pcsel
Specifying the help option on the pcsel command line:
$ pcsel -help
gives you a listing of all the pcsel options and what they mean. With no options specified, pcsel reports the actual output-device and its parameters in this way:
$ pcsel PCSP driver version 1.0 Actual PCSP output device: PC-Speaker Volume : 100 %, real samplerate : 18356 Hz Maximum Samplerate is 51877 Hz 16bit Stereo Emulation enabled
These two programs, vplay and vrec, can be used for recording and playing the following types of files:
Creative Labs voice files
Microsoft wave files
raw audio data files
Both programs accept the same options, which can be listed by specifying the help option:
vplay --help
The output of this command is shown in Listing 2.
Okay, confession time—the main reason I had for adding this driver to my kernel was to have sound effects in Doom. Here is another trivial example of what you can do with PC-Speaker. I have a directory of .wav and .au files. This shell script, called from my .profile file, plays one of these audio files at random each time I log in.
#!/bin/sh
# random-sound.sh: play a random file from the
# sounds directory
export count="`ls sounds/*|wc -l|sed s/ //`"
export count=`expr $count + 0'
(1>/dev/null 2>&1 vplay `echo sounds/*| \
awk BEGIN{srand()}{x=1+int(rand()*number)
print $x} number=$count') &
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.
Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.
Sponsored by ActiveState
| Speed Up Your Web Site with Varnish | Jun 19, 2013 |
| Non-Linux FOSS: libnotify, OS X Style | Jun 18, 2013 |
| Containers—Not Virtual Machines—Are the Future Cloud | Jun 17, 2013 |
| Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer | Jun 12, 2013 |
| Weechat, Irssi's Little Brother | Jun 11, 2013 |
| One Tail Just Isn't Enough | Jun 07, 2013 |
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




13 min 3 sec ago
3 hours 44 min ago
6 hours 37 min ago
7 hours 3 min ago
9 hours 32 min ago
10 hours 5 min ago
10 hours 6 min ago
10 hours 7 min ago
10 hours 9 min ago
10 hours 10 min ago