xor eax, eax




Ø main()
Ø fireworkx
Ø amp
Ø gallery
Ø feedbacks
Ø about




ronybc.com
45.113.122.52



flag counter

Linux tweaks: how sputnik got so fast..?!


This is intended for no-serious linux desktops (e.g. used for web browsing, multimedia ..etc), not recommended for any machine put up for some serious purpose... unless u know exactly what u are doing.

And i'm just sharing what i've done to 'the sputnik', my linux machine :) trying to make it fast fuming fluid, furious like hot molten lava hit by an asteroid came at 64km per second... pumbing out infra-red rays all around... and evaporating viscous bacterial colonies...!

Being a bad bit lazy... none of the following is a step by step guide to how to do it. Please do have the spirit to experiment (denatured) and install'em the apt way.. and RTFM...!! :)

For Fast Internet Browsing

run a local 'caching DNS server'. What 'the sputnik' have is pdnsd... because pdnsd is light and it stores the cache on disk.. so that the sputnik will not loose its hard earned dns cache when the power goes off.

handy options:
$ pdnsd-ctl server all retest
$ pdnsd-ctl status
$ pdnsd-ctl dump | less

Fast booting and launching applications

Make a compressed image of '\usr' using a squashfs

$ mksquashfs /usr /usr.sqfs
$ echo "/usr.sqfs /usr squashfs loop,ro,nouser,noatime,auto,exec,suid 0 0" >> /etc/fstab
$ reboot

drawback: squashfs is a compressed read-only filesystem. so it needs to do reverse and repeat above steps for updating the system.

Or the preload daemon.

CPU power saving

The sputnik have an AMD Athlon X2 4200+ processor.. which consumes 65 Watts at peak usage, running 2.2GHz. The sputnik likes to run fast but green tinted, don't want to get stared when the electricity bill comes in. So... the powernowd

$ powernowd -m1 -p250 -l15 -u25

Play songs clean (with less harmonic distortion)

sputnik's on-board HD audio uses 96kHz sample-rate natively. when feed with the usual 44.1kHz audio.. it must be resampled to 96kHz. if not done properly.. the process will be a big source of distortion. so.. sputnik went in search of a good sample rate conversion algorithm. SoX, the Swiss Army knife of sound processing programs, does the job best. Since version 14.1.0, the 'rate' effect got tremendous improvements. Currently it is the lowest distorting audio sample rate conversion available around, at sputnik's reach.

Here is a comparison of the outputs generated by different sample rate converters available with SoX ; when feed with a 20Hz to 20kHz sweep. It is clear that 'rate -v' produces no distortions even till -180 dBFS. The tests are done using SoX's own signal generator and spectrum analyzer.

freq-distorton graph
resample
freq-distorton graph
polyphase
freq-distorton graph
rate -v
freq-distorton graph
rate -h
freq-distorton graph
rate -m
freq-distorton graph
rate -l
freq-distorton graph
rate -q
freq-distorton graph
rabbit -c0
freq-distorton graph
rabbit -c1
freq-distorton graph
rabbit -c2
freq-distorton graph
rabbit -c3
freq-distorton graph
rabbit -c4


shell script used to geting above results:

#!/bin/bash

SOURCE="sox -V4 -r 44100 -n -p synth 10 sine 20:20000"
SPECTRUM="sox -V4 - -n spectrogram -w Kaiser -x5000 -y1200 -z180 -h -o"

$SOURCE |sox -V4 - -r 96000 -p resample |$SPECTRUM sox-resample.png
$SOURCE |sox -V4 - -r 96000 -p polyphase |$SPECTRUM sox-polyphase.png
$SOURCE |sox -V4 - -r 96000 -p rabbit -c0 |$SPECTRUM sox-rabbit-c0.png
$SOURCE |sox -V4 - -r 96000 -p rabbit -c1 |$SPECTRUM sox-rabbit-c1.png
$SOURCE |sox -V4 - -r 96000 -p rabbit -c2 |$SPECTRUM sox-rabbit-c2.png
$SOURCE |sox -V4 - -r 96000 -p rabbit -c3 |$SPECTRUM sox-rabbit-c3.png
$SOURCE |sox -V4 - -r 96000 -p rabbit -c4 |$SPECTRUM sox-rabbit-c4.png
$SOURCE |sox -V4 - -p rate -v 96000 |$SPECTRUM sox-rate-1-v.png
$SOURCE |sox -V4 - -p rate -h 96000 |$SPECTRUM sox-rate-2-h.png
$SOURCE |sox -V4 - -p rate -m 96000 |$SPECTRUM sox-rate-3-m.png
$SOURCE |sox -V4 - -p rate -l 96000 |$SPECTRUM sox-rate-4-l.png
$SOURCE |sox -V4 - -p rate -q 96000 |$SPECTRUM sox-rate-5-q.png

So.. the sputnik plays its audio files using following equation.. :)

$ sox "louis armstrong - what a wonderful world.mp3" -p |sox - -4 -t wavpcm - rate -v 96000 | aplay -V mono -D front -q -t wav -

To avoid the keyboard adventure.. try the following shell script:
copy 'n' paste this to a new file.. save it as 'clean-play'
$ chmod 755 clean-play
$ ./clean-play /your-mp3-folder/*.mp3

#!/bin/bash

# rbcplay - by Rony B Chandran ( http://www.ronybc.com )
#
# usage : (CLI-torous ways to play music :)
# ----------------------------------------------------
# right click on an mp3 file -> 'open with' -> 'use custom command' and give
# "xterm -geometry 80x16+1000+500 -e rbcplay" -OR-
# "gnome-terminal --geometry=80x10+1000+500 -x rbcplay"
# and set 'remember this application for this file type'

# Streamtuner 
# Edit->Preferences->Applications->Listen to a stream->"rbcplay %q"

# $ cd music
# $ rbcplay song1.mp3 song2.mp3
# $ ls |rbcplay
# $ find |grep .mp3$ |sort -R |rbcplay
# $ find |grep .mp3$ |sort -R |head -n1 |rbcplay
# $ find |grep -i "what a wonderful world" |rbcplay
# $ rbcplay http://dir.xiph.org/listen/23640102/listen.m3u

# $ streamripper http://streaming20.radionomy.com:80/Afriki-Djigui-Theatri -r
# $ rbcplay http://127.0.0.1:8000

clean_play() 
{
	echo ---=[rbcplay]=-------------------------
	echo $1
	sox $2 "$1" -p \
	| nice -n -15 sox - -4 -t wavpcm - rate -v 192000 gain -4 bass +4 320 2>/dev/null\
	| aplay -V mono -D front -q -t wav -
}

radio()
{
	if [ -n $2 ] ;then 
		clean_play "$1" "-V -t $2"
		return
	fi
	clean_play "$1" "-V -t ogg"
	clean_play "$1" "-V -t mp3"
}

PIDFILE="/tmp/rbcplay."$USER".pid"
[ -f $PIDFILE ] && kill $(cat $PIDFILE) > /dev/null 2>&1
echo $$ > $PIDFILE

# medium wave

if [ "$1" = "radio" ] ;then
	radio http://127.0.0.1:8000
	exit
fi

# streamtuner: Edit->Preferences->Applications->Listen to a stream->rbcplay %q

if echo $1 |grep ^http ;then
#	radio "$@"
	xterm -e streamripper $1 -d $HOME/radio -r 8000 &
	sleep 1
	while pidof xterm |grep $! ;do
		radio http://127.0.0.1:8000
	done
	exit
fi

# argument list

while [ "$1" ] ;do
	clean_play "$1"
	sleep 0.2
	shift
done

# stdin file list

while read -t2 FILE; do
	[ -f "$FILE" ] && clean_play "$FILE"
	sleep 0.2
done

rm -f $PIDFILE
exit

Thus... the sputnik became a wonderful linux rock with pure molten core..!

If you have any doubts..
feel free to drop an e-mail to:
no spam
NAVIGATION PANEL:

Ø Parallel Resistance Calculator
Ø Voltage Divider Calculator
Ø LM317 Calculator
Ø Volume Control Pot with Parallel Resistor Graph tool
Ø Power Dissipation Across Transistor/MOSFET
Ø Display PPI Calculator
Ø Blogandrum - The Complete Conundrum
Ø The Eight Queens Puzzle
Ø Fireworkx : Linux version
Ø Kunthrantum - very low distortion audio power amplifier
Ø Creative AudioPCI soundcard mods (Ensoniq ES1370, AK4531)
Ø Buffered Flash memory access routines for PIC microcontrollers
Ø Fireworks : Windows version, coded using Win32 ASM
Ø SparcZ - tiny telnet server with remote desktop administration powers