Sunday, October 26, 2008

Audio - SiS966 (Realtek ALC660-VD) Drama

A strange case appeared recently that might be helpful to someone. I updated ALSA on an SiS966 card and the sound died. Alsamixer was unmuted, etc, proc shows the card as a single unit with a single interrupt:
$ cat /proc/asound/cards
0 [SIS966 ]: HDA-Intel - HDA SIS966
HDA SIS966 at 0xfbfe8000 irq 22

Aplay shows more information about the card.

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: SIS966 [HDA SIS966], device 0: ALC660-VD Analog [ALC660-VD Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: SIS966 [HDA SIS966], device 1: ALC660-VD Digital [ALC660-VD Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
So it appeared hw=0.0 was the analog card, and hw=0,1 was the digital version. If followed that, for the analog portion...
$ cat /proc/asound/card0/pcm0p/info
card: 0
device: 0
subdevice: 0
stream: PLAYBACK
id: ALC660-VD Analog
name: ALC660-VD Analog
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 1
....and for the digital portion...
$ cat /proc/asound/card0/pcm1p/info
card: 0
device: 1
subdevice: 0
stream: PLAYBACK
id: ALC660-VD Digital
name: ALC660-VD Digital
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 1
Why no sound when levels are tested in alsamixer? I took a look at a reliable page alsa-hw that has helped me in the past. From here, I checked to see which of the cards was default:
$ aplay -L
default:CARD=SIS966
HDA SIS966, ALC660-VD Analog
Default Audio Device
front:CARD=SIS966,DEV=0
HDA SIS966, ALC660-VD Analog
Front speakers
surround40:CARD=SIS966,DEV=0
HDA SIS966, ALC660-VD Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=SIS966,DEV=0
HDA SIS966, ALC660-VD Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=SIS966,DEV=0
HDA SIS966, ALC660-VD Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=SIS966,DEV=0
HDA SIS966, ALC660-VD Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=SIS966,DEV=0
HDA SIS966, ALC660-VD Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
null
So it's clear the analog portion of the card is the default. Can we hear anything from the digital portion of the card?
$ aplay -D hw:0,1 alsatest.wav
Playing WAVE 'alsatest.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
No sound here on the digital, what about the analog...
$ aplay -D hw:0,0 alsatest.wav
Playing WAVE 'alsatest.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
...and here I have sound. Apparently the analog portion only will be available.
testing
To check microphone settings, a nice way to check the levels is to open two terminals. Record a couple minutes using arecord in one terminal and use the alsamixer in the other window to vary levels until it works.
$ arecord -d 60 -f cd -t wav -D hw:0,0 foobar.wav
This will record for 60 seconds, but we can change the number of seconds to any value we wish. I call out the changes into the microphone as I make them. To play foobar.wav and check the various settings, we just
$ aplay -D hw:0,0 foobar.wav
After the settings are correct, don't forget
# alsactl store

Thursday, October 16, 2008

Radeon 3100HD RS780MC drama

On install, Zenwalk loaded a stock vesa driver in /etc/xorg.conf, providing resolutions of 800x600. Common sense and the command # gtf seemed to indicate higher resolutions were available. In /etc/xorg.conf, I replaced "vesa" with, alternately, "ati", "radeon", and "radeonhd"; these did nothing but break X. I then relented for the proprietary driver "fglrx" described on most blogs as bloaty and slow, but operational. The driver was avialable here by selecting the Linux x86_64 -> Radeon -> ATI Radeon HD 3xxx Series and pressing "go". One note about installing this - I received checksum errors when I attemped to install it with # ati*; I had to explicitly invoke bash #bash ati*. However, following this installation, I simply replaced "vesa" with "fglrx" in the Device section of /etc/X11/xorg.conf, rebooted, and everything worked. With the vesa-fglrx swap, the /etc/X11/xorg.conf file looks like this:
Section "Device"
Identifier "Videocard1"
VendorName "ATI Technologies Inc"
BoardName "Video device"
Driver "fglrx"
BusID "PCI:1:5:0"
Option "RenderAccel" "true"
EndSection
Adjustments to the fglrx module "Options" can come some other weekend; resolution and display appear sharp currently.

software rendering


It appears the problem with slow, boggy rendering continued after installation and a few different option tweaks. The card appears to default to software rendering instead of rendering with the considerable hardware memory available. The test program glxgears crashed, and the information tool glxinfo noted direct rendering is currently not enabled. The best post I could find about this was here at phoronix. Accordingly, I changed xorg.conf to the following:
Option "KernelModuleParm" "string"
Option "KernelModuleParm" "agplock=0"
Option "KernelModuleParm" "agp_try_unsupported=1"
Option "KernelModuleParm" "debug=1"
Option "KernelModuleParm" "maxlockedmem=256"
where 256 represents the memory size in mb.
Unfortunately, this had no visible effect. Snooping with lsmod yielded nothing like "fglrx" or "glx", etc. Following with a find -name fglrx* however revealed two modules: fglrx_drv.so and fglrx_dri.so, that is two "shared object"(so) modules, but no "kernel object"(ko) modules. That explained the lsmod blank, and also rules-out kernel object loaders such as modprobe, which could have been handy in rc.local. So what next? Is a kernel module available and preferable? Why the "so"'s? Checking dependencies with ldd glxgears does not yield much either, and I'm unclear if it's possible to depmod .so's to check their dependencies.

radeonhd


As noted above, the open-source radeonhd driver, which appears to be a .ko, is improving. The radeon site has information about this driver as well as some useful "phoronix forums" to assist. The source code for the radeonhd is available by looking under item 6 on the wiki. The source was most recently updated on Oct. 13,2008.

more fglrx considerations


The fglrx driver, although supplied by Radeon, does appear to have significant Googleland complaints for slowness. For me, it renders well, but very slowly: I'm experience update lines even scrolling through a simple text page on Mousepad, etc. So, it appears something either a)very inefficient, or b)very underpowered, is taking place in terms of memory usage with the fglrx driver. From Google, it appears there are a few things to investigate: 1) does flglrx load as a module? (lsmod |grep fglrx). Mine does not appear in lsmod, and this apparently means xorg.conf loads a substandard fglrx_drv.ko module. Lsmod failed to locate this module either. Odd. 2) Settings in /etc/X11/xorg.conf for the fglrx driver, under "Options" may be important. 3)Settings (don't know syntax or location) for whether the ATI card uses SIDEPORT mode (card uses its own memory),UMA mode (card shares system memory), or another unnamed mode where it uses a mix of SIDEPORT and UMA. One thing for sure, a lifesaver in these forum boards is fglrxinfo or fglrxinfo -v:
# fglrxinfo
display: :0.0 screen: 0
OpenGL vendor string: Mesa project: www.mesa3d.org
OpenGL renderer string: Mesa GLX Indirect
OpenGL version string: 1.4 (2.1 Mesa 7.0.3)

glxinfo is also important. On my system, glx is not enabled, though this may be a different problem than the overall slowness of screen panning and scrolling that I'm experiencing. A good forum thread for these issues is here, not for solutions but for the many aspects of the problem. I located a Zenwalk specific ATI installation wiki which informed me of the aticonfig command. This command didn't seem to change much, other than append an "Extensions" section to the end of /etc/X11/xorg.conf. That is, following the use of aticonfig, lsmod continues not to show any fglrx module.

Monday, October 13, 2008

screencasting - slackware

links: ffmpeg commands
Lee Lefever videos are not screencasts but they reveal the value of a simple idea. His guiding philosophical considerations are well-described in his blog. Educational screencasts do well to follow similar lines. Screencasts from teacher Joe Wood, have a similar flavor to Lee Lefever's videos, and Wood clarifies his ideas well.

What about screencasts in Linux? My previous work making a required video for an education class left me feeling underwhelmed. It was initially raw AVI from the camera, but I muxed it to MPEG2. There appeared to be resolution issues - the picture wasn't as clean as I hoped. This time, I'm starting with screencasts. I'll eventually work back to recording and cutting video when I can easily manage screencasts. Another side of it is the computing power required for rendering -- I want to increase the efficiency there.

istanbul


First attempt was with Istanbul, which was pre-installed with Zenwalk 5.1. Something was wrong with the framerates, and all I was seeing was flashing screens, which appeared to indicate a large number of frame drops. Then I looked at this guy's post and it appears that there might also be screen size as well as framerate issues. Istanbul has no sound supplied, it must subsequently be muxed. What could possibly be more annoying?

recordmydesktop


Includes sound and screen, and outputs in Ogg-Theora as .ogv files. Seems the most useful, but the ability to record sound varies with systems. When it works, it works well. The .ogv file can be shifted to .flv format for YouTube uploads or website. I used a script for doing so from here  though I'm sure it's also around at other sites. I had to modify the script slightly for CLI use, and libmp3lame.so.0 must be installed for the mencoder inside it to follow the script properly. I renamed the script ogv2flv.sh and it runs on command line once libmp3lame.so.0 is installed:
$ ogv2flv.sh input.ogv
There is no config file for the CLI version of recordmydesktop, which means hideously long command line entries. Further, typing $ man recordmydesktop only produced "No manual entry for recordmydesktop". Nice going. It appears the best thing is the sourceforge version, until that URL breaks. Strike two. However, a nicely sized screen which works well from command line for capturing browser without the status bar, but including the URL bar is
$ recordmydesktop -x 14 -y 55 -width 988 -height 674 -fps 12 -o wobbly.ogv
This seems to default constantly to 44100 and 2 channels in spite of my entering 1 channel and 22050 frequency and the device hw:0,0, so I eventually deleted these parameters from the line.

Recordmydesktop also has a python based GtK front-end available to those who are interested. This program does have a config file .gtk-recordmydesktop, which appears to be an advantage over remembering the complex CLI commands necessary to avoid the inevitable "broken pipe" commands if you forget one parameter. Each time I edited the config file by hand, the program overwrote my screen size settings each time it opened. Strike three.

xvidcap


Solid, but a few quirks. 1) .xvidcap.scf is supposed to be available for a config file, it apparently doesn't work well or is not read. Accordingly, right clicking on the gui controls provides preferences. Not too bad and they can be saved there too. 2) Have to adjust the box size each time. 3) On at least one occasion, it might have muted my microphone during start-up. 3). Sound is garbled unless using oss emulation aoss. So, I might start xvidcap to do 10 frames per second like this:
$ aoss xvidcap --fps 10
Once screencasting is complete, ffmpeg can shift the mpeg into a YouTube flv in a single command
$ ffmpeg -i test2.mpeg -ar 44100 test2.flv

sound levels


Microphone settings become significant in screencasting. Here are a couple of cards.

Realtek ALC660-D
I set "Mic" as the capture source, and vary the relationship between Mic Boost, Digital, and the Capture bar. The settings which avoid clipping and feedback have been Mic Boost=33, Digital~65-70, and Capture~77-82. Digital seems to be the most important for hiss and I play trade-off between Digital and Capture until the hiss disappears while attempting to avoid clipping distortion if Capture is set too high.

Friday, October 10, 2008

slackware - application list

A baseline group of applications we typically install, mostly to solve the problem of how to retrieve various types of media or other information quickly. Slackware has several by default. The configuration file locations are not given. Whether or not they are command-line or gui apps is not always included.

ffmpeg: necessary media translator
streamtuner: media stream consolidation
recordmydesktop: screencasting. best with command-line settings.
audacious (netpkg): gui, audio, skins
eclipse (netpkg): C++/Java IDE
unison (netpkg): folder comparison and merging
cycas ($300): professional architectural program ($128 - basic)



database apps
Nola Pro: bookkeeping/accounting. MySQL, PhP, Browser

Friday, October 3, 2008

fall 2008 - celly status

I've waited a while for new cell service. For several years I've run a Motorola V3 on Cingular -> SBC -> ATT service. In other words, I've used a basic second generation (2G) cellphone with 2G service. When I selected a 2G provider several years ago, I selected the GSM (ATT) version of 2G over the CDMA (eg. Metro PCS/Verizon) version of 2G because GSM is prevalent in Europe. When visiting Europe, I use my Motorola V3 relatively cheaply by purchasing a European plan with a SIM and swapping out my US SIM. Further, in the US, GSM phones hold about 75% of the market share.

3G

Last year, the iPhone debuted, the first interesting third generation (3G) device, at least in my opinion. I've since watched the developments around 3G data/voice with the idea of jumping-in at the right moment. The types of service are somewhat complex and I made a little chart (click to enlarge) for this blog entry, simplifying what I understood about these services:

I assume like most people, the reason I'm migrating to 3G is web and phone access in a single device. Until the iPhone, a person needed a (bulky) laptop for that level of service. I considered an iPhone when they first appeared last year but the iPhone seemed too outrageously priced for the product and services package. More recently, I noticed Sprint "Wi-Max" (CDMA-2000 service) was scheduled for availability in August of 2008 on Nokia phones. That was interesting but, upon researching further, WCDMA devices look like a better choice than Wi-Max devices. WCDMA succeeds GSM (see chart above) and accordingly are backwards-compatible with GSM. That plays a role when traveling to Europe where cell phone service exists at different stages of development in different regions. Having a phone that is backwards-compatibile with European (2G GSM) networks makes it possible to travel there with less phone hassles. I set my mind to finding WCDMA service.

3G drawbacks

As seen in the chart above, there are two versions of 3G, WCDMA (formerly GSM) and CDMA-2000 (formerly CDMA). If I understand correctly, geo-locating in the CDMA branch used GPS from the start. GSM users, on the other hand, turned-off their phone to have locational privacy, and had to be triangulated via cell towers when their phones were turned-on. Stated otherwise, it's beneficial for security agencies if the public migrates to CDMA. Luckily for them, the data transfer requirements of 3G require the transmission style of CDMA. Accordingly, as GSM providers attempt to provide 3G on previous GSM networks, GSM phones will have to morph into a version of CDMA phones for 3G availability. This means a degree of privacy reduction for GSM users. Secondly, although CDMA has a single advantage - it can manage more users - battery life suffers for managing this transmission methodology. Finally, Qualcomm holds the patents for both forms of 3G (WCDMA and CDMA-2000). Qualcomm is an American company, and we may assume their chips integrate CALEA backdoors or other monitoring options. Any backdoor is subject to exploits and so can be considered a privacy drop. All told, our initial 3G phones would appear to suggest decreased privacy in at least two ways, and decreased battery life.

TMobile

TMobile, the American wing of Deutsche Telekom, is of interest to me as a 3G provider. They currently sell both 2G GSM and 3G WCDMA service in the US, and are rolling out WCDMA in more and more cities. In the Bay Area, TMobile already (10/2008) has 3G, The phone which interests me, the G1 phone, uses a SIM and is backwards-compatible to 2G GSM networks. According to one or two sites I've seen, the price is $199 via a pre-order that arrives Fed Ex by Nov 10. It requires a 2 year contract that appears to be $89 a month for 3G voice and data service. If that's correct, it's a significant improvement over iPhone prices plus G1 software (Android OS) is supposedly open-source in cooperation with Google. Pre-order link: http://www.t-mobileg1.com/