|
xor eax,eax Main Fireworks SparcZ Win32 asm Kunthrandum Linkz page Guestbook Misc... About me XXXXXXXX 803 |
Linux tweaks: how sputnik got so fast..?! This is intended for simple no-serious linux desktops (e.g. used for web browsing, multimedia ..etc), not 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 flowing free on floor like hot molten lava... hit by an asteroid came at 32km per second... pumbing out infra-red rays all around... and evaporating viscous bacteria colonies...! I'm not going to explain how exactly each one of the following to be implemented at ur side... yes.. being a bit lazy, i wish u have the spirit to experiment it by urself. so.. if u want to try... install it somehow.. 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 application launch There is two methods used inside the sputnik. 1. sputnik's ingenious trick, using a squashfs image of the entire '\usr'. Here is how it is done on sputnik: $ 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. 2. Running preload daemon. Stay away from hard disks To reduce disk access and hence gain some speed... the sputnik keeps its '/tmp' and '/var/log' directories in RAM..! using tmpfs mounts. ie. two more inserts to '/etc/fstab' $ echo "tmpfs /tmp tmpfs size=16m 0 0" >> /etc/fstab $ echo "tmpfs /var/log tmpfs size=4m 0 0" >> /etc/fstab drawback: contents of '/var/log' and '/tmp' will not remain between system boots. 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.
script used to for the test:
#!/bin/bash SOURCE="sox -V4 -4 -L -r 44100 -t au -n -t au - synth 10 sine 20:20000" SPECTRUM="sox -V4 -t au - -n spectrogram -w Kaiser -y4 -z180 -h -o" $SOURCE |sox -V4 -t au - -r 96000 -t au - resample |$SPECTRUM sox-resample.png $SOURCE |sox -V4 -t au - -r 96000 -t au - polyphase |$SPECTRUM sox-polyphase.png $SOURCE |sox -V4 -t au - -r 96000 -t au - rabbit -c0 |$SPECTRUM sox-rabbit-c0.png $SOURCE |sox -V4 -t au - -r 96000 -t au - rabbit -c1 |$SPECTRUM sox-rabbit-c1.png $SOURCE |sox -V4 -t au - -r 96000 -t au - rabbit -c2 |$SPECTRUM sox-rabbit-c2.png $SOURCE |sox -V4 -t au - -r 96000 -t au - rabbit -c3 |$SPECTRUM sox-rabbit-c3.png $SOURCE |sox -V4 -t au - -r 96000 -t au - rabbit -c4 |$SPECTRUM sox-rabbit-c4.png $SOURCE |sox -V4 -t au - -t au - rate -v 96000 |$SPECTRUM sox-rate-1-v.png $SOURCE |sox -V4 -t au - -t au - rate -h 96000 |$SPECTRUM sox-rate-2-h.png $SOURCE |sox -V4 -t au - -t au - rate -m 96000 |$SPECTRUM sox-rate-3-m.png $SOURCE |sox -V4 -t au - -t au - rate -l 96000 |$SPECTRUM sox-rate-4-l.png $SOURCE |sox -V4 -t au - -t au - 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" -4 -t wavpcm - | sox -t wavpcm - -4 -t wavpcm - rate -v 96000 | aplay -V mono -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
# Clean sounding 24/96 playback script using SoX.
# uses the best quality resampling algorithm (SoX 'rate' effect),
# the best mp3 decoder (SoX -> libmad) and 'aplay' for 24 bit playback via ALSA.
#
# last-resort of Rony B Chandran (http://www.ronybc.8k.com) - OCT2008
#
# NOTE:
# don't give a name containing 'sox' for this file, 'pgrep' will fail otherwise...
#
# e.g. $ ./clean-play *.mp3
#
clean_play()
{
echo
echo "=====> $1 <========================="
soxi "$1"
sox "$1" -4 -t wavpcm - |\
sox -t wavpcm - -4 -t wavpcm - rate -v 96000 gain -6 bass +6 120 0.7s |\
aplay -V mono -q -t wav - &
sleep 0.5
}
while [ "$1" ] ;do
WTFUT=""
clean_play "$1"
while pgrep sox > /dev/null ;do
read -t1 -n1 WTFUT < /dev/tty
if [ "$WTFUT" ] ;then killall sox ;fi
done
if [ "$WTFUT" = "q" ] ;then echo "Hit by 'Q'; bye..." ;exit ;fi
shift
done
exit
Thus... the sputnik became a wonderful linux rock with pure molten core..! If you have any doubts.. feel free to ask... drop an e-mail to: ![]() If you find this useful.. know the 'big idea' behind these pages... |