Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Saturday, January 22, 2011

Vim, rdesktop, external monitors, and X Forwarding on a Google CR-48

While there are my other impressive hacks going around for the CR-48 (minecraft, ubuntu) I needed a few utilities that were more pragmatic. The following assumes that your CR-48 is in developer mode and you have a basic understanding of bash, scp, and compiling source code under GNU/Linux.

Vim

When I first went into the developer shell I saw approximately 1000 different binaries to run, but not one of them was a text editor. Eventually I stumbled upon qemacs, but we're just on a CR-48 not the middle ages. It was time to figure out how to get vim up and running.

Although ChromeOS is it's own GNU/Linux distro, it appears to mimic Debian/Ubuntu and is adhering somewhat to the LSB. I first just tried a straight copy of the vim binary from a Ubuntu 10.04 system but after some investigating with ldd saw it had a lot of shared libraries that weren't available on the CR-48 (most notably libselinux.so). So the quickest way to get around this was to build a static binary on a 32-bit Debian host (Ubuntu works as well).

On a 32-bit Debian Squeeze I downloaded latest VIM source code and built a static binary with a limited set of features and disabling GUI and selinux options:

USER@DEBIAN ~ $ wget ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2
USER@DEBIAN ~ $ tar -xvjf vim-7.3.tar.bz2
USER@DEBIAN ~ $ cd vim73
USER@DEBIAN ~ $ export LDFLAGS=-static
USER@DEBIAN ~ $ ./configure --with-features=small --disable-gui --with-vim-name=vi --disable-selinux
USER@DEBIAN ~ $ make

This will make a static binary called vi in the src directory. On the CR-48 in /home/chronos/user make a directory called bin and scp the vi binary to it.

Try and execute it, but you'll get a Permission Denied error because by default the /home/chronos/user directory is mounted with the noexec option. Fix this by remounting it with exec.

chronos@localhost ~ $ sudo mount -i -o remount,exec /home/chronos/user

Now the binary will run and you have a basic vi editor.

rdesktop

Rdesktop is much easier to put on the CR-48 since all of the libraries are available. From a 32-bit Debian/Ubuntu host, or by downloading the rdesktop i686 package from packages.debian.org, copy the rdesktop binary to the /home/chronos/user/bin directory. If it's mounted with exec then it will just run. Pass it whatever options you like, and it will open a new GUI window on the CR-48, completely independent of the Chrome UI and any shells.

chronos@localhost ~ $ ~/bin/rdesktop -u USERNAME -g 1280x800 -K -z -r clipboard:PRIMARYCLIPBOARD HOSTNAME

Copy/paste works well, although the arrow keys may not function properly due to the keymap not getting set correctly. This may be due to a libiconv issue and I'll need to spend some more time figuring it out.

External Monitors

While the CR-48 works just fine with it's VGA output without much tweaking, you'll either need to sign in/out or reboot the laptop for it to display to an external monitor. In dev mode xrandr is available making it easy to switch between display resolutions.

Mirror to a monitor that can do 1024x768:

chronos@localhost ~ $ xrandr --output LVDS1 --mode 1024x768 --output VGA1 --mode 1024x768

Turn off the external display and reset the CR-48 display back to the default 1280x800:

chronos@localhost ~ $ xrandr --output LVDS1 --mode 1280x800 --output VGA1 --off

X Forwarding

The simplest piece to enable is X-forwarding from a remote X client. Connect over ssh with the& -Y option and run any X applications:

chronos@localhost ~ $ ssh -Y USER@HOSTNAME

Bringing It All Together

Now that all the binaries are in place let's set it up so they work across reboots.

Edit /home/chronos/user/.bashrc with our new vi editor and append the following:

#Setup our environment
source ~/.bash_aliases
PATH=$PATH:~/bin

#Remount /home/chronos/user as exec so anything in ~/bin runs
sudo mount -i -o remount,exec /home/chronos/user

Create a /home/chronos/user/.bash_aliases and add in any aliases:

alias rdesktop-home='~/bin/rdesktop -g 1280x800 -u USER -K -z -r clipboard=PRIMARYCLIPBOARD HOSTNAME'
alias projon='xrandr --output LVDS1 --mode 1024x768 --output VGA1 --mode 1024x768'
alias projoff='xrandr --output LVDS1 --mode 1280x800 --output VGA1 --off'
alias ssh-host='ssh -Y USER@HOSTNAME'

Now you have a much more flexible environment to add your own aliases, functions, and binaries.

Sunday, November 07, 2010

Cutting the Cord

Sometime in the mid summer of this year my brother and I spoke briefly about canceling cable TV and going to an Internet only feed. The idea quickly faded since the alternatives, while there, just weren't up to meeting our entertainment requirements. A few weeks ago with an deal between Time Warner and ESPN (more on this later) and the new media server I built it was time to cut the cord. With broadcast HDTV, a PS3, and Linux based media server here's how we did it and ended up saving a ton of $.

Movies

We had the movie option in our cable TV package, with Encore, Starz, and a few other channels excluding the more premium ones like HBO and Showtime. This was by far the easiest to check off by using Netflix. The PS3 is capable of streaming all of the on-demand Netflix catalog, as well as play blu-ray and DVDs with the 10$ one-at-a-time plan. Netflix is only expanding their streaming library in addition to making more HD streams available. I also have many movies ripped to the linux media server and pushed out to the PS3 via a UPnP server software called fuppes for streaming of my movie collection.

Network TV

With cable we had a DVR package to record and replay shows back later on in the week. Time Warner also had a nice On-Demand feature to play a majority of network and cable channels shows anytime even if it wasn't recorded on the DVR. Since HDTV came about a few years ago network TV looks just as good, if not better, than it's HD cable counterpart. By purchasing a HD antenna and putting it over the bookcase we're able to get the local SD network channels in 1080i. Now this isn't as ideal as having the DVR or On-Demand on TW, but the biggest piece in this puzzle was the software called playon.tv.

Playon.tv runs on a Windows computer and scrapes streaming websites like hulu.com, cbs.com, tv.com, etc. It transcodes the streams on the fly and then presents them as a UPnP media server to various devices such as the Wii or PS3. It also has a mobile feature, and devices like an iPad or iPhone can connect to the media server over a remote 3G connection for playback anywhere. The one downside is the streams are not in HD, although HD support is promised by the developers soon. Total cost is 40$ a month with 20$ a month renewal and it more than makes up for the lack of DVR. On a technical note, playon.tv will run just fine in a Windows XP KVM guest on my linux media server with 2 vCPUs and 4GB of memory dedicated to it.

Sports

By far the most asked question I get when talking to people about this is "what about sports?". There's almost this myth that you NEED cable to get live sports, which is absolutely not true. With the advent of espn3.com almost any live sporting even can be watched via a web browser. There's even sports on there I've never heard of. The only downside here is that in order to get espn3.com your ISP needs to have inked a deal with ESPN3. Up until a week ago Time Warner had not done this but now is available, in addition to a new TW only website called espnnetworks.com which adds even more live sports content. Time Warner unfortunately requires you have ESPN as part of your video cable package, which we do not. Logging into another TW customers account however gets around this. Right now playon.tv supports ESPN3 for non-login ISPs, so for TW customers you still need to go through the web browser. With a media server connected to the same TV this isn't much of an issue. HDTV sports broadcasts look even better than cable since they're still in 1080i but don't suffer from the compression artifacts that most cable channels seem to add. Finally, if you really want to see a live sports even and you can't get it at home, it's probably time to leave the living room.

Notes

While we own all three major gaming systems the PS3 was chosen since it can do everything we need and we have a nice bluetooth remote that looks like it belongs in the living room.

We tried out Hulu+ for streaming over the PS3, and even though it had excellent HD output, it was lacking many of the shows available on the website. Strange since it's 10$ a month and you're paying to get less content... In the future if Hulu decides to do things different I'll revisit it.

Since a lot of this is network dependent, I upgraded our router to one capable of 802.11n and gigabit ethernet speeds so the media server and PS3 aren't laggy when talking to one another.

Time Warner is still in use for the Internet connection, but Verizon is planning on rolling out their LTE network to San Diego before the end of 2010. Hopefully they start offering service as an ISP and we can replace the cable connection completely.

Update


I switched from Windows XP to Windows 7 due to XP seeming to crash daily. Along with improved stability,Win 7 is also 64-bit and can handle all 4 cores when Playon moves to HD streams. The only issue was the AC97' sound card that KVM emulates doesn't have 64-bit Win 7 drivers, and other sound card options don't work either. Playon ships with a virtual audio device that takes care of transcoding the audio to work around this.

Monday, November 01, 2010

Jezebel 7.0

This fall I decided it was time to update my Atom based media server to a more power version.This was driven mainly by the want to rip and encode blu-ray disks and run KVM for virtualization. While the Atom setup was great for power efficiency (using about 40 watts at peak load) there were other tweaks I wanted to make. Below is my new system specs for Jezebel 7.0:

All of the parts were new except the case and blu-ray drive since they integrated without a problem. I originally purchased a micro-ATX motherboard which had more PCI, memory, and SATA slots, but the majority of the SATA connections went right up against the drive bay wall. The smaller board had less expansion space but fit better into the case and didn't limit any of the other components I purchased.

I went through about 4 graphics cards before landing on the GT430. Two were too large, and one was passively cooled but used a ton of power and put out a lot of heat. The GT430 has a fan on it that is a bit louder than I would have liked, but it can underclock itself when not in use to 50MHz to save power and heat. The GT430 is a bit overpowered for what I wanted to do, but it's CUDA support has me hoping for encoding programs like ffmpeg to use it for faster blu-ray encoding.

By far the biggest improvement is the quad-core processor, with two cores and 4 gigs of memory dedicated to KVM for a Windows XP guest install. I haven't tested it for video encoding yet but it has turbo-boost to go to 3.0GHz if needed. I also enabled an on-demand CPU governor and it runs at 1.2GHz while idle.


The drive setup was a big improvement as well. Before it was running the OS off a compact-flash card plugged into a parallel IDE connection, two 1TB drives on the onboard SATA, and the blu-ray into a SATA PCI card. This was less than ideal from an IO perspective and was still running on legacy technology. The new board has 4 SATA connections and I swapped the two drives for one 2TB disk. The SSD has shown a huge IO boost and the OS boots in less than 10 seconds. The 2TB drive is actually slow at 5900 RPMs, but it makes it quieter and is very power efficient.

The system setup is 64-bit Debian Squeeze installed onto the SSD, with /home all on the large disk. I also installed Windows XP into a KVM guest which resides on the SSD as well. GNOME is setup and running off the video card. HDMI out works for video and looks great, however I kept getting stumped on trying to pass sound through it and settled on a 1/8 audio connection from the line out.

The main use of the system is for pushing out content to our LCD TV via a variety of methods which I'll explain in a different post, and ripping/encoding DVD and blu-rays. It's also hooked up to our LCD TV and the wireless Apple keyboard and mouse is great for a living room setup with a range of approximately 10 meters.

Overall the system uses more power than the Atom setup, but the performance ratio makes up for this exponentially due to the advances in efficiency of the other components over the last few years. I'm looking forward to seeing what this system can do with it's virtualization capabilities and performance capabilities.

On some future notes, the next Intel architecture Sandy Bridge is looking to integrate video directly into the CPU. I looked into the on-die graphics available now since this motherboard can support them, but unfortunately the only Core i series CPUs that have it are dual core. Sandy Bridge will have 4 and 6 core CPUs to use it, but it will use a different socket, making this board unsuitable for it. Soon though we'll have HTPC systems like this that don't require any additional peripherals, increasing performance while at the same time driving down power usage even more.

Friday, December 05, 2008

SATA Drive Power Management in Linux

I recently purchased a new 1TB HDD for a new power efficient server I built and I wanted to share a few of the power saving tips I discovered after reading a few sites.

File system

I was originally going to use ext3 for compatibility reasons, but after reading into JFS more I found that it's lighter on CPU and a bit more power friendly, so I used it to format this new drive. I also disabled atime and diratime within /etc/fstab.

/dev/mapper/jezebel-homevol /home jfs noatime,nodiratime 0 1
hdparm

Many newer drives support advanced power management on the drive itself, mostly at the sake of performance but since this is a data drive that sits idle most of the time the hit is negligible.
sudo hdparm -M 128 /dev/sdb
sudo hdparm -B 100 -S 240 /dev/sdb
The first will enable Acoustic Mode and the second will set spin down after 20 minutes of idle time. You can make the permanent by adding them in /etc/hdparm.conf.

Kernel params

Most of these tricks are for laptops, but they work just as well on an always-on server by enabling them in /etc/sysctl.conf.

#Specific Flash and Power Tweaks
#
#Set Laptop mode for less disk writes
vm.laptop_mode = 1
#
#Set Dirty writeback higher
vm.dirty_writeback_centisecs = 1500
vm.dirty_expire_centisecs = 1500
vm.dirty_ratio = 25

#
#Set swappiness
vm.swappiness = 20
Swappiness is set lower than default to keep swap around in case it's needed but to not use it very much.

Friday, September 12, 2008

Ubuntu Inside of Etch Inside of Sid

Fun screen shot I took today while seeing if Ubuntu Linux I installed on a laptop was up;

Debian Sid->Debian Etch->Ubuntu Hoary

Saturday, June 14, 2008

Sierra Wireless MC5725 on Debian Linux

When I started my new job I was given an HP Compaq 6910p as a work laptop, which came with a nice embedded 1xEVDO (Sierra Wireless MC5725) card that I could use to get online anywhere where there is a Verizon signal. Over the past week or so I've been migrating from Windows XP to Debian, and this was the last bit of hardware I needed working. Here are my notes on how to get it up and running:

Requirements:
Kernel 2.6.21 or newer with sierra module compiled or latest from http://www.sierrawireless.com/faq/ShowFAQ.aspx?ID=607
Device activated in Windows and powered on (disable turning power off in preferences)

Load the modules:
sudo modprobe usbserial vendor=0x03f0 product=0x211d
sudo modprobe sierra

Setup kppp:
Uncomment noauth in /etc/ppp/peers/kppp-options
Modem device: /dev/ttyUSB0
Flow Control: Hardware
Line termination CR
Connection Speed 921600
Phone Number: #777
Authentication: PAP/CHAP
Login ID: your_device_phone_number@vzw3g.com
Password: vzw

Automatically load modules in Debian:
edit /etc/modprobe.conf/usbserial and add:
options usbserial vendor=0x03f0 product=0x211d
edit /etc/modules and add:
sierra

Refrences:
http://www.ka9q.net/5220.html
http://www.linuxquestions.org/questions/linux-networking-3/motorola-e815-evdo-cant-dial-phone-592375/
http://tuxmobil.org/ibm_lenovo_thinkpad_t61_nc216ge_umts_linux.html

Some Technical Info:

lsusb -v:
Bus 002 Device 003: ID 03f0:211d Hewlett-Packard
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x03f0 Hewlett-Packard
idProduct 0x211d
bcdDevice 0.02
iManufacturer 1 HP
iProduct 2 HP ev2210 1xEV-DO Broadband Wireless Module
iSerial 0


dmesg:
[ 1976.898309] usbcore: registered new interface driver usbserial
[ 1976.898435] drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
[ 1976.898527] usbserial_generic 2-1:1.0: generic converter detected
[ 1976.898645] usb 2-1: generic converter now attached to ttyUSB0
[ 1976.898738] usb 2-1: generic converter now attached to ttyUSB1
[ 1976.898828] usb 2-1: generic converter now attached to ttyUSB2
[ 1976.898897] usbcore: registered new interface driver usbserial_generic
[ 1976.898957] drivers/usb/serial/usb-serial.c: USB Serial Driver core
[ 1982.544979] drivers/usb/serial/usb-serial.c: USB Serial support registered for Sierra USB modem
[ 1982.545685] usbcore: registered new interface driver sierra
[ 1982.545762] drivers/usb/serial/sierra.c: USB Driver for Sierra Wireless USB modems: v.1.2.8

Friday, February 15, 2008

Screenshots Over the Years

Going through my fileserver recently I stumbled upon the directory I'd put screenshots in over the years that I've used Linux. It covers back from 1999 until the present, enjoy.

My first linux computer running Redhat 6.1 using GNOME v1.0.39 from 1999, this shot was taken in 2000 and shows all the fun of connecting via dial-up.

Still running GNOME this time I believe it's Mandrake in 2001


My Windowmaker fetish begins while running on Debian circa fall of 2001

My Fluxbox fetish begins in 2002

More Fluxbox goodness, from senior year in 2002

Fluxbox again after college graduation in 2003


Final Fluxbox shot after I moved to San Diego in 2004

Moving onto XFCE in 2004

And finally, full circle we come back to GNOME running on Debian in 2008

Wednesday, January 23, 2008

Debian Work Desktop


This is my new Debian Unstable work desktop running GNOME on a Dell Optiplex 755 Intel Core Duo Quad with 4Gb of memory.

Getting it up and running wasn't as smooth as I first expected. First, due to the strangeness of the on-board Intel non-analog DVI connector, I put the dual-head ATI Radeon I was using on my old desktop. Because I have one wide screen and one standard LCD setting the resolutions was tricky, and I finally gave up on the ATI flglx driver after I discovered it couldn't do 1600x1050. It also caused weird corruption in the lower right hand of the screen and major stability issues. moving to the open source ATI driver and a combination of Xrandr I was able to setup each monitor properly and get them working as a "Big Desktop". Originally the on-board gigabit ethernet didn't have support in the kernel, and I used a common 10/100 PCI card, the latest 2.6.24 kernel added the e1000e module which took care of that.

Performance wise it's a beast, at first it was sluggish due to the AHCI and NCQ enabled on the hard-disk, but disabling it in BIOS solved that problem. The quad-cores absolutely scream, and it's a huge improvement over the original Vista install. In order to run our more MS specific apps (IE, Outlook, SQL Manager, Cisco), I installed the free Vmware server and setup a Windows XP virtual machine with 2gigs or memory and 2 processors. Enabling remote desktop and then logging in via the terminal server client makes it seem like Outlook is it's own "app". Native Debian apps I'm using are are mostly GNOME centric: Iceweasel (aka Firefox), GNOME Terminal, Gedit, Rhythmbox, Pidgin, Picasa, and a variety of other GNU programs.

Once I got everything up and running using the desktop has been a dream.
Using GNOME as a desktop manager works wonders, since I can place menu bars in any location with any number of apps that I'd like to use. Creating a "quick launch" section on the menus is also nice, since before I was using a multi-media keyboard to launch my common apps in an attempt to slim down the memory footprint of Windows. Other benefits are the copy/paste highlight/click functionality and sloppy window focus, which makes using multiple monitors more intuitive.

Overall I'm glad I spent the extra time getting Debian running on this new desktop, since it makes my workstation a lot more usable and I feel I can garner more out of this new machine that I would have with Vista.

Friday, January 18, 2008

Thinkpad T42 and Debian

The other week my wonderful girlfriend came over with a "present". While I was expecting food or something another I was pleasantly surprised when she handed me a relatively unused IBM Thinkpad T42. I have sort of a fetish for laptops, and at last count have around 6. All are in some state or working order save my poor iBook G3 which has suffered one to many logic board failures to resurrect again. This one however was different, it's almost perfect. It has all of the features and non of the defects than the others have. Each always had one thing that would bother me: trackpad would go crazy, lid was too loose and kept falling back, or simply ran way to hot. So far this Thinkpad is not only the best Linux laptop I've had but the best one I've owned period. Here's the specs:
  • Intel Pentium-M 1.7Ghz with SpeedStep
  • 1GB DDR Memory
  • 80Gb Hard Drive
  • DVD/CD-RW Drive
  • 802.11 B/G WiFi
  • 1 Gigabit Ethernet
  • ATI Mobility 7500 on a 1024x768 LCD
Desktop:


In the week or so leading up to getting the thinkpad I had been configuring my Dell Inspiron 8500 with Debian GNU/Linux Sid and found to my delight that transplanting it's 80Gb hard drive worked beautifully. All I needed to do was change the xorg.conf drive from the nvidia one to the Xorg ATI one. After that I was in business and with a few tweaks I got many things working properly:
  • ATI 7500 Mobility: Yes, Direct Rendering enabled using ati driver in xorg.conf (listed below)
  • Intel Pro Wireless 2100 3B MiniPCI: yes, after firmware download
  • Intel 82540EP Gigabit Ethernet: yes, with e1000 module
  • Intel SpeedStep: Yes, using cpufreq the processor will scale from 1.7Ghz down to 700Mhz depending on power settings
  • Suspend and Hibernate: Yes, using acpid. video and network come up correctly
  • HDAPS (disk head parking): sort of, works after a kernel patch, but seemed to cause instability and it was a bit too sensitive, somethings making the system unusable while it was parked.
The best resource I found when setting everything up and learning about the capabilities of the hardware was the ThinkWiki site that has excellent Linux information on almost all Thinkpad models.

Overall this is a solid laptop, I guess you could say the lid is a bit flimsy, but it's metal hinges are leagues above what Dells have. The gigabit ethernet is a big plus too, since we have gigabit connections at work and I'm planning to update my home router too. With auto-dim on the display, speedstep, and the tickless kernel option in 2.6.24 it's power management is capabilities are great. Hopefully this lasts me for a while with the only replacement part being the hard drive, but future laptop purchases will be guaged against this superb piece of hardware.

Some Linux info:

lspci
micheal@ruth:~$ lspci
00:00.0 Host bridge: Intel Corporation 82855PM Processor to I/O Controller (rev 03)
00:01.0 PCI bridge: Intel Corporation 82855PM Processor to AGP Controller (rev 03)
00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 01)
00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 81)
00:1f.0 ISA bridge: Intel Corporation 82801DBM (ICH4-M) LPC Interface Bridge (rev 01)
00:1f.1 IDE interface: Intel Corporation 82801DBM (ICH4-M) IDE Controller (rev 01)
00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 01)
00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 01)
00:1f.6 Modem: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller (rev 01)
01:00.0 VGA compatible controller: ATI Technologies Inc Radeon Mobility M7 LW [Radeon Mobility 7500]
02:00.0 CardBus bridge: Texas Instruments PCI4520 PC card Cardbus Controller (rev 01)
02:00.1 CardBus bridge: Texas Instruments PCI4520 PC card Cardbus Controller (rev 01)
02:01.0 Ethernet controller: Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile) (rev 03)
02:02.0 Network controller: Intel Corporation PRO/Wireless LAN 2100 3B Mini PCI Adapter (rev 04)
/proc/cpuinfo
micheal@ruth:~$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 13
model name : Intel(R) Pentium(R) M processor 1.70GHz
stepping : 6
cpu MHz : 1400.000
cache size : 2048 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr mce cx8 sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss tm pbe bts est tm2
bogomips : 2792.87
clflush size : 64
xorg.conf (touchpad is disabled here)
Section "Files"
EndSection

Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc104"
Option "XkbLayout" "us"
EndSection

Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "Emulate3Buttons" "true"
EndSection

Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizScrollDelta" "0"
Option "VertScrollDelta" "0"
Option "MaxTapTime" "0"
EndSection

Section "Device"
Identifier "ATI Mobility 7500"
Driver "radeon"
BusID "PCI:1:0:0"
Option "RenderAccel" "true"
Option "backingstore" "true"
Option "AllowGLXWithComposite" "true"
Option "AddARGBGLXVisuals" "True"
Option "TripleBuffer" "True"
EndSection

Section "Monitor"
Identifier "Generic Monitor"
Option "DPMS"
HorizSync 28-64
VertRefresh 43-60
EndSection

Section "Screen"
Identifier "Default Screen"
Device "ATI Mobility 7500"
Monitor "Generic Monitor"
DefaultDepth 24
SubSection "Display"
Modes "1280x1024" "1024x768"
EndSubSection
EndSection

Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
InputDevice "Synaptics Touchpad"
EndSection

Section "Extensions"
Option "Composite" "true"
EndSection

Monday, March 26, 2007

Ripping Vinyl with GNU/Linux

Recently my Dad started sending me pieces of his vinyl record collection. He has a ton of good stuff from Led Zeppelin to The Beatles and everything in between from 65'-75'. My plan is to archive all the albums to my computer and do some other fancy things with them like converting each track to an MP3, allowing for easy distribution via CD or over the Internet. Below is the process that I used after doing many hours of research on and off line.

1. The Equipment
In high school I was able to acquire some relatively decent vintage stereo equipment before the prices shot up on eBay in recent years. Here's the list of hardware I used:
  • Technics SL-20 Belt Drive Turntable
  • Technics SA-110 Stereo Receiver
  • Technics SH-8XXX Graphic Equalizer
  • 64-Bit Debian GNU/Linux Computer
All the equipment except the turntable was in excellent condition, but after taking it to Classic Audio Repair in Normal Heights they replaced the RCA cable, belt, checked the speed, and recommended a Grado Green MM cartridge for improved playback. They also showed me how to adjust the tone arm's counter balance and the correct anti-skate setting. Everything is hooked up through the record inputs/outputs on each device and the sound is excellent.

2. The Software
Noticeably I'm a huge Geek, and one of my requirements for doing this was everything application must be Free Software. The one exception is I compressed the tracks to MP3 instead of OGG, this decision was made since my parents are the final destination and it will just make things simpler on their end. Here's the software I used for ripping, analyzing, processing, and encoding:
3. The Process
Before I rip a record I clean each record with a RCA disc washer kit, clean the tip of the stylus, and check that the EQ levels on the equalizer are all set to zero.

In Audacity I play the record watch the levels when it peaks, moving the record level slider correctly so it's right around 0 since I don't want it to be too loud and end up distorted. I hit record in Audacity and start playing the record, checking the levels and making sure the sound is coming through and then sit back and listen to the wonderful sounds of 30 year old vinyl playing away. Once the side is recorded I cut off the beginning and end silence and save it as a WAV file which is usually around 190Mb or so. I do this for each record, being careful not to bump the turntable or cause any excessive disk activity on the computer that would distort the sound.


Once all the vinyl is ripped digitally I process each WAV file through normalize-audio, which will boost the sound levels up to a normal volume acceptable for playback. The command is straightforward, just pass it a filename and it will only take a few seconds to up the levels.

After the audio is normalized I re-open the WAV with Audacity and use the Edit->Split feature to find the gaps between songs and cut the WAV into individual tracks. After the tracks are found I use File->Export Multiple to export through LAME each track as a 192-kbps MP3 file, with a generic file name and no ID3v2 tags.

Using the program EasyTag I then load that directory, and use the GNUDB manual lookup to find the proper album, click apply to all tracks, then save the tags and file names. This will rename the tracks correctly and fill out all the ID3v2 tags, making it a lot easy to catalog and use with MP3 players.


The final step is to archive the original WAV file into FLAC, which is a lossless compression codec, cutting the size of the file by about 65% but maintaining the fidelity of the original WAV. The command I use to do this takes a while but as you can see the compression is impressive:
flac --lax -mep -b 8192 -l 32 -r 0,16 SideA.wav -o ../flac/SideA.flac

190M SideA.wav
116M SideA.flac
4. Results
I tested the resulting MP3s in XMMS, Winamp, iTunes, and streaming through MusixIndex, which all worked as expected:


5. Conclusions
Fortunately my Dad took great care of his record collection, and they still sound great. The packing itself is still in top condition and even better than what I'd expect it to look like after 30 years. Unfortunately no matter how much you do to improve the sound quality, through equipment, cleaning, and filters it's unrealistic to expect the records to play as well as when they were new. The sound was still amazing, but occasionally there are the pop/clicks and sometimes distortion of the sound. Each record is different, some sound flawless while others (New Riders of the Purple Sage) are actually not circular anymore which causes the tonearm to skate some, adding a sort of swishing sound every revolution.

Even with some of the sound flaws, I've come to accept that that's the way it is. If I wanted a clean error free recording I'd pick up the CD and just rip that instead, but then where's the fun in that? Plus the MP3s and FLAC sounds exactly like the original record, pops and all, which when listening on a portal MP3 player gives you the feeling of warmth you'd expect from original vinyl.

Update

To address some comments:

The equipment is hooked up like this:
Tunrtable-> RCA-> Receiver-> RCA-> Equalizer-> RCA to 1/8 Headphone jack -> Line-In on a PCI SoundBlaster Live!
The sound card is roughly 7 years old, but has excellent Linux support and Creative was one of the first hardware companies to produce open source drivers back then. All other inputs and channels on the card are muted to avoid any noise.

The sound is through the equalizer to make sure all the levels were 0 before being send to the computer, it also gave me a visual clue to if the music was playing (occasionally I would mute the speaker volume). Plus, have you ever seen a Technics EQ from the early 1980s? The thing just looks damn cool when it's doing what it's doing.

When I recorded with Audacity I set the record level to coincide with the VU level, making sure it peaked at 0. Normalizing the audio was minimal and since each album had a different record level I don't have the annoyance of one being louder than the other.

I wanted to get the best quality I could (The new cartridge and cleaning gave the most improvement) but being that it is ~30 year vinyl I'm not going to be a huge stickler for perfection.

References
http://www.delback.co.uk/lp-cdr.htm
http://www.br0wn.co.uk/vinyltocd.htm
http://www.atpm.com/9.03/under-the-hood.shtml
http://www.kuro5hin.org/story/2004/9/13/11498/3759
http://www.linuxjournal.com/article/6628
http://home.att.net/~halbower/music.html
http://www.turntablebasics.com/advice.html

Tuesday, February 20, 2007

Xfce Desktop on Etch

Last week I decided to make the jump from Debian Sarge to Etch on my home media server. The upgrade was for the most part painless, although there were a few snags I hit that I will explain in more detail in another post. For now though I wanted to post a nice screen shot of my new Xfce desktop:


On the left is the main app panel featuring: xterm, K3b, VMware, GAIM, Grip, XMMS, DVD::RIP, Iceweasel (aka Firefox), and Konqueror. Finally the little mouse with the X is the Xfce application menu, then hardware temperature sensors (a little high actually) and system load information. The top panel is running six virtual desktops with a taskbar on the right side. The app that is currently running is DVD::RIP in GUI mode making an Xvid video out of the Talladega Nights DVD I recently purchased.