Saturday, February 26, 2005

Audio recording in KDE/Mandrake

I had a sudden desire to hear my own voice. Installed kdemultimedia-krec which contains the nice, small sound recorder 'krec'. The Krec gui seemed pretty intuitive but nothing would get recorded. I had always thought that the line-in/mic/capture etc. controls in the mixer (kmix) confuses me; 15 minutes of fruitless messing with them only added to my fear.

Configuration:
I have an onboard Intel Corp. 82801DB/DBL/DBM AC'97 audio card with pci-id (lspci -n) 8086:24c5. I use arts as my KDE soundserver. kmix (and alsamixer) both shows several input controls -
Line, CD, Mic, Video,...,Capture. In kmix, each control has
* a green LED at the top (showing whether the input control is turned off or on)
- there can be many controls turned on at the same time
- turn the input controls off (mute them) when not in use to prevent feedback noise (sound of typing, humming noise etc.)
* a slider showing the playback volume (which I guess, is the volume at which input audio will be played). The slider for the Capture control does not move in kmix but I can manipulate it via alsamixer to change the capture/recording volume)
- I noticed that if I set the 'PCM Out Path and Mute' control to 'pre 3D' (the other value is 'post 3D') then I whatever I say in the microphone comes out via the speaker (headphone). The volume of this feedback can be controlled (besides the normal Master etc. controls) by the slider of the currently enabled input control.
* a red LED showing the current capture source. There can be (besides capture control - it has be turned on to capture/record) only one capture control which is enabled. Turning one on turns the others off. (In alsamixer, use 'space' to set capture device).

Okay, now whats wrong with my krec ? It has VU-Meter on the main window which (irrespective of recording or not) shows the audio signal level coming in through the recording device. No activity was observed there. Since kmix was not allowing me change the 'capture' control I decided to fall back to the good old and trusted amixer. After a little playing, I could make it work. This is my working configuration (as seen in the output of 'amixer' - only relevant controls):

// line-in turned off
Simple mixer control 'Line',0
Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-joined cswitch-exclusive
Capture exclusive group: 0
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: Playback 0 - 31
Front Left: Playback 18 [58%] [off] Capture [off]
Front Right: Playback 17 [55%] [off] Capture [off]

// mic turned on, playback ... dont care, set as capture device
Simple mixer control 'Mic',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined cswitch cswitch-joined cswitch-exclusive
Capture exclusive group: 0
Playback channels: Mono
Capture channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono: Playback 25 [81%] [on]
Front Left: Capture [on]
Front Right: Capture [on]

// capture control
Simple mixer control 'Capture',0
Capabilities: cvolume cswitch cswitch-joined
Capture channels: Front Left - Front Right
Limits: Capture 0 - 15
Front Left: Capture 11 [73%] [on]
Front Right: Capture 11 [73%] [on]

- I used
$ amixer sget Capture,0
to get the control details. To change/set controls, use sset as in this example
$ amixer sset Capture,0 80%,40% unmute cap

Things started working. Oh - after I heard myself in krec, I almost shouted (to myself) - "Slow down, dude!".

- d.

Thursday, February 24, 2005

KDE Performance Boost


http://wiki.kde.org/tiki-index.php?page=Performance%20Tips


My KDE installation is fast enough ... but who does not want more. Gotta play with it ... once I need to waste time.

Sunday, February 20, 2005

Bored ... understood font fundas

Bored ... need to do something other that working on the current proof. Options include

* Going out with the camera - its too cold outside. I cant manage the camera with gloves.
* Work on showing the access points in the right click context menu of kwifimanager. Its halfway done but once I start working on it, I wont have any work done tonight.
* Fine-tune my KDE 3.3.0/Mandrake 10.1 system. Vote for that!

I recently saw a couple of screenshots of OS X. One of the reasons their display look so smooth and nice is their text engine. Like Adobe and Microsoft, Apple has invested a lot in their text rendering. Anti-aliasing (AA), sub-pixel hinting and other sophisticated font technology give users a feel of ~1200 dpi print medium on their ~75 dpi (my Dell LCD panel) laptop display.

The recent mandrake distributions use fontconfig. One can use the KDE control panel or manually set up AA and hinting. I initially excluded AA for range 8-12pt but then didnt like it and turned on AA for all sizes. I also changed the menu/window title etc. fonts. Things look a lot smoother and better (for the eye too) now. One of the problem that still stays is the ugly bold font of the taskbar buttons. I could not find a font which would look good on the current button (with bold face) and inactive buttons (with normal face). Anyway - its not that bad.

And oh ... after you change the AA settings you need to restart the (relevant) app to see the change. For the taskbar (which cant be restarted that easily) you can just go to a text console (alt+fn+1) and come back or hide the panel and then show it; all of these will force font rendering with the new setting.

Back to latexing.

- d.

Saturday, February 19, 2005

Floating calendar - JS+XMLHttp+PHP+XML

Gone are the days of Websites and Webpages. Its all Web-applications now. And the recent hype seems to be centered around XMLHttpRequest and DOM,DHTML. From Google-maps to Switzerland-maps (doesnt use flash, XMLHttp but DHTML based tiling), new technology is creating richer and more useful web-content. I thought to have a quick glance at XMLHttp since I already have some experience in DHTML (this page was created when DOM was not in full effect and cross-browser coding was a major headache; so you need Netscape 4.7 or IE 5.0 to view this page. I did not update the page to use DOM so recent browsers will not work). But first I need to think of some useful application. Thinking... thinking... thinking...

How about a floating calendar. Like the one here (calendar icon at the top-left corner). I can put such a calendar on my blog page. At the backend I would just have to write a small tool to feed the events (that I want to share) to an (XML) file (which will stay on my server). So, whenever any user clicks on a date, the event information for that date will retrieved from the XML file via a (PHP) script using XMLHttpRequest which can then be displayed. Cool! I like the idea.

How should I start ... IE and mozilla have different ways of creating XMLHttpRequest object. And then again, for old browsers, I have to use the old style of accessing div. While its not impossible to write them from scratch, its easier to use an existing one. The rest was smooth. Created a simple xml event file and a simple php script to parse the xml file on request and retrieve the event for a given date.

Everything worked, except the most crucial part. I soon came to realize that under normal browser-security policy, XMLHttpRequest can only query the same server as the current web-page. That means I cannot have the events file on my server and calendar on the blogger server.

Without trying further, I put the calendar on my start page and stopped worrying about XMLHttpRequest for the time being. If anybody has a better idea (other than hosting my blog on my own server), please let me know.

- d.

Sunday, February 13, 2005

Linux yahoo messenger online contacts/friends are shown offline

Moved from Yahoo to Kopete.

Reason: The official linux yahoo messenger client has suddenly stopped working (strange that the other clients are still able to work). None of the online contacts are shown online. Only the 'idle' status is reflected but the yellow 'online' icon does not appear. Initially I thought it to be a gtkhtml... bug but later confirmed 'summary' tab that the client actually thinks only 'YahooHelper' is online and nobody else. Strangely whenever a contact comes online or goes offline I still get the notification messages.

Explanation: None :(! The ymessenger client stopped working suddenly... there was no update or install of ymessenger. I have also checked with old releases - same problem. The web-messenger is working properly and I guess the ports are using the web-messenger protocol. Its possible that yahoo (once again) changed their protocol. Till another version comes up... stuck with kopete (I somehow like the lightweight ymessenger over Gaim/Kopete etc.).

-D.

Saturday, February 12, 2005

Site design changed

Changed blog temnplate. The previous template used 'div's for content placement and there was some problem with firefox/win with overflowing contents. Should have changed the CSS ... but decided to go for a quick hack and used another template with contents etc to the right - so that overflow will be handled trivially :).

Friday, February 11, 2005

Solution to Firefox Problem - XDM authorization

Problem:
$ ./firefox
Xlib: connection to ":0.0" refused by server
Xlib: XDM authorization key matches an existing client
(firefox-bin:4083): Gtk-WARNING **: cannot open display

Where did I encounter: My officemate has this problem (on his Suse 9.0 - 64 bit).

(Possible/Google-recommended) Solution Idea: Run firefox as root once (preferably first time).

Solution Steps:
(Commands as root are in Red, those as user are in black)
As the user, in the firefox directory
$ xhost +
$ su
< give root password >
# ./firefox
< if firefox starts succesfully, close it and continue >
# exit
$ xhost -
$ ./firefox

If any of the steps fail, then there might be a different problem. Try Googling again.