/usr/share/doc/lirc/html/audio-alsa.html is in lirc 0.9.0-0ubuntu6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>LIRC - Linux Infrared Remote Control</TITLE>
<LINK REL=stylesheet TYPE="text/css" HREF="../lirc.css">
<LINK REL="shortcut icon" HREF="../favicon.ico">
<META NAME="description" CONTENT="LIRC - Linux Infra-red Remote Control">
<META NAME="keywords" CONTENT="linux, kernel module, remote control, animax, multimedia">
</HEAD>
<BODY BACKGROUND="../images/marb18.jpg"
BGCOLOR="#FFFFFF" TEXT="#000000" ALINK="#8080FF">
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD CLASS="menu" WIDTH="100%" HEIGHT="150">
<IMG SRC="../images/diode.gif" ALT=""
WIDTH="300" HEIGHT="150" BORDER="0" HSPACE="20"
VSPACE="0" ALIGN="LEFT">
<IMG SRC="../images/lirc.gif" ALT=""
WIDTH="300" HEIGHT="150" BORDER="0" HSPACE="20"
VSPACE="0" ALIGN="RIGHT">
</TD>
</TR>
<TR>
<TD WIDTH="100%"> <BR>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD WIDTH="15%"> <BR></TD>
<TD WIDTH="70%" ALIGN="LEFT" VALIGN="TOP"> <BR>
<!-- Text ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- ALSA audio receiver driver ++++++++++++++++++++++++++++++++++++++ -->
<A NAME="audio_alsa_hw"></A><HR>
<H1 ALIGN=CENTER>Using the ALSA audio IR receiver driver</H1>
<H2 ALIGN=CENTER>Hardware</H2>
<P>
This driver supports the <A HREF="http://www.lirc.org/ir-audio.html">IR-audio</A>
IR receiver module. A more detailed description of how to build
and set up the hardware can be found by following the link.
</P>
<H2 ALIGN=CENTER>How to use ALSA</H2>
<P>
Because I haven't seen yet any noticeable ALSA documentation for
users, I should explain a little here about how to use ALSA
itself. Still I will presume you already have installed ALSA and
it is running.
</P>
<P>
ALSA provides a lot of mixer controls, and it is not always
obvious how to enable recording from a specific input, although
as soon as you get the idea it turns to be relatively
simple. Launch the alsamixer application (you can use the -c
switch to select the desired sound card by number). Now scroll to
see that you have a lot of controls :-) and many of them have
unknown functions. Suppose your IR-audio module is connected to
the CD-IN input; let's first test if your hardware works at
all. Find the "CD" control, move the volume up and unmute it
(with the 'M' key). Then take some remote control and activate
it in front of your IR receiver. You should hear some kind of a
bubbling, squeaking or beeping sound (depending on you remote
control type). If you do, then your IR receiver works (I'll be
surprised if it doesn't :).
</P>
<P>
Now mute the channel again and select this channel for capturing
by pressing "SPACE" on it: on the top you should see the text
"CAPTUR" which means that this channel is connected to the
analog-to-digital converter input (the level of CD control
doesn't matter - it can be set to zero). Then look for a control
called "Capture". Press SPACE on it (if it is applicable to your
sound card) and move the "volume" up. On most sound cards this is
enough, but on my Yamaha YMF754 I also had to move up the level
of the "ADC Capture" and "Digital" controls (there are also ADC
Capture 1 and Digital 1 but those are for SPDIF as far as I
understand).
</P>
<P>
Finally, let's test if recording from selected input works. In a
separate window (I did it in X11) launch the arecord tool with
the following parameters:
</P>
<PRE>
arecord -D hw:# -c1 -r8000 -f U8
</PRE>
<P>
where # is the number of your sound card (0, 1, ...) (if your
sound card has more than one ADC and your device is connected to
the 2nd, 3rd, ... ADC you will have to use the extended form
"-D hw:#,#" where second # selects the ADC device number on the
sound card). The <B>-c1</B> parameter tells arecord to sample
monophonic signal (left channel), the <B>-r8000</B> sets the
sampling frequency to 8kHz and <B>-f U8</B> selects "unsigned
byte" sampling format.
</P>
<P>
You should see a lot of garbage symbols. If you move the
"Capture" lever down to zero, arecord should type just one or
two symbols (that is "silence"). Now try to raise "Capture" and
to disconnect from ADC all unneeded signals (e.g. turn "CAPTUR"
off, if possible, from all inputs except CD). It still should
show silence (because you don't press any buttons on IR control,
aren't you?). Finally, press some buttons on IR control and you
should clearly see how signal changes. If it doesn't (and you
heard the signal in the previous experiment) you connected to
the wrong (right) channel. If you used a BLS-04 connector (like
me :-) you have to re-plug it after rotating by 180 degrees
(since the center two pins are ground and L/R pins are on
sides). Otherwise you will have to redo the connector (well, see
yourself...).
</P>
<P>
Okay, now if arecord shows correct results like described above,
you're ready to use lirc (ugh... finally!).
</P>
<H2 ALIGN=CENTER>Using the driver</H2>
<P>
The input device is by default "hw" (to see a list of available
devices try "arecord -L"); this can be overridden with the
--device command-line switch. For example, my IR module is
connected to the second sound card, thus I run (for example)
irrecord this way:
</P>
<PRE>
irrecord -d hw:1,0 file
</PRE>
<P>
You also can use ALSA library internal environment variables
such as ALSA_PCM_CARD and ALSA_PCM_DEVICE to specify the values
for card number and card device number.
</P>
<P>
Also you can specify the sampling rate (in Hertz) by placing a
'@' after device name and then the numeric sample rate. The
default value is 8000, however, you can play with it:
</P>
<PRE>
irrecord -d hw@11025 file
</PRE>
<P>
The basic sampling frequencies (supported by most sound cards)
are: 8000, 11050, 16000, 22050, 32000, 44100, 48000 Hertz. The
higher the sampling frequency, the more accurate results
(e.g. space/pulse lengths in microseconds) you will get, but
with all remote controls I've tried 8000Hz is quite enough.
</P>
<P>
However, when you create configuration files (e.g. with
irrecord) I'd recommend you to set sampling rate as high as
possible:
</P>
<PRE>
irrecord -d hw@48000 file
</PRE>
<P>
This could help create more accurate timings in the config file
and then you can use this config with lower sampling rates.
</P>
<P>
Some sound cards do not support capturing in mono which is the
default for audio_alsa. If you come across this you will receive
a message stating an invalid argument when setting the capture format.
You can get around this problem by telling audio_alsa to capture in
stereo:
<PRE>
irrecord -d hw@44100,l file
</PRE>
or:
<PRE>
irrecord -d hw@44100,r file
</PRE>
<P>
The l (left) or r (right) character instructs audio_alsa on which
channel it should inspect when reading the samples from the IR receiver.
<H2 ALIGN=CENTER>Quirks</H2>
<P>
I have found that on my motherboard the built-in audio card has
a bug that could influence other sound cards too. When xmms was
playing something very loud and master volume was close to 100%
I observed that lirc become "deaf" for some time. Investigations
shown that there is a bug in audio card schematics that causes
CD-IN pre-amplifier to shutdown because of not enough power when
too much power goes to the master amplifier (well, this is just
my suspicion). When I lowered master volume to 90%, everything
started to work fine. In any case, playing at 100% volume was
causing sound distortion (because master amplifier is also out
of power and clips output signal, although it does not shutdown
like pre-amplifier does) thus lowering master volume does only
good.
</P>
<P>
Another bug I've come across and you should be aware of is that
some ALSA drivers (notably my driver for Yamaha YMF7[2,4,5]4)
are buggy and sampled data sometimes contains noise (clicks)
which influence badly recognition of proper command
sequences. This happens for me, however, only at 11025 and
22050Hz rates, so you may wish to test if you're not affected by
recording a wav file with <B>arecord</B> and the listening to it
- the clicks are <B>very</B> noticeable by ear. A sign of this
situation may be that while you're keeping the button on remote
control pressed, the <B>irw</B> tool will repeatedly drop the
repeat count (2nd column) to 0 after 2-6 repeats.
</P>
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<BR><BR>
<CENTER>[<A HREF="http://www.lirc.org/">LIRC homepage</A>]<BR>
<I>The LIRC Manual, last update: 24-May-2009</I></CENTER>
<BR><BR>
</TD>
<TD WIDTH="15%"> <BR></TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD CLASS="menu" WIDTH="100%"> <BR>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
|