Wednesday, May 11, 2011

Make your system run cooler this summer

My system is nearly 11 years old - quite a feat! And yet, with limited resources, it becomes a necessity to use whatever is at your disposal efficiently and with regard to the future. In short, we, the poor, have to take care of our hardware.

Linux has superior capabilities when it comes to fine-grained control over your hardware. Features such as Machine Check Exceptions make sure you don't fry your CPU. But you can do a lot more to keep your system running cooler and healthier:

  • Check to see if the CPU and system fans are installed properly and are running at optimal speed. The vents for airflow should not be blocked. Above all else do not cover the CPU or the monitor! I've seen systems catch on fire because the owner thought to cover them with plastic bags.
  • Use processor clock modulation when you're not doing CPU intensive stuff. For example, I tend to leave my system on through the night when I'm downloading a new Fedora release. So what I do is, I use the powersave governor to reduce the CPU speed to a minimum, and turn off the monitor. I have a Pentium 4 based CPU, so my frequency scaling driver is p4-clockmod. Here are the commands I use:
  1. modprobe p4-clockmod
  2. modprobe cpufreq-powersave
  3. echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

  • When you want to do something CPU intensive, switch to the "performance" governor:
  1. echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

  • You can use the "ondemand" governor too, which scales the processor frequency as and when required:
  1. echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Friday, April 29, 2011

The Creative Soundblaster 5.1vx on Linux: Update #1

Ok, so the capture works perfectly. You need to tell jack to ignore xruns, however, in case you have a slow system and you get too many and it gets stuck into an endless loop.

You might start jack like this:
jackd -d alsa -r 48000 -s

Monday, April 25, 2011

How to download videos from your favorite website automatically everyday using wget

Suppose that you have a favorite website that allows you to download videos in the mp4 format. Suppose that this website is updated everyday. Now, if you, like most people, have an always on internet connection, you might want to automate the task of downloading these videos and watching them at your convenience, or to transfer them to a portable device like a mobile phone or iPad or whatever and watch it later, instead of having to manually "right click, save, right click, save" many, many times. Here's a simpler way.

For our example, suppose that http://www.example.org is a video hosting site and there is a little button "Download" below the videos.

We tell wget to download the page recursively (r), upto 2 levels, without making directories for domains (nd):
wget -r -l 2 -nd http://www.example.org

Now, this will also download all html pages linked with this page. We can exclude them if we want:
wget -r -l 2 -nd http://www.example.org -R *.html

If you have a slow system, make wget use less CPU power:
nice wget -r -l 2 -nd http://www.example.org

Make this process automatically occur everyday at 6 in the morning - open your crontab file using the command
crontab -e

and add the following line
0 6 0 0 0 nice wget -r -l 2 -nd http://www.example.org

Saturday, April 23, 2011

How to make the Creative SoundBlaster 5.1vx sound card work on Linux

If you have ever tried this card on Linux, you must have encountered the "white noise" problem, which is that you can only hear white noise if you try to play any sound. You must have spent endless hours like me trying to make it work, but probably you couldn't. That's why you're still searching. Well, search no more.

You'll want to kiss me after you read this - it's really that simple.

First of all, get the latest kernel version from kernel.org. I'm using 2.6.38.4, and the performance boost is awesome! It's my favorite version yet!

Now, this is important - alongside the ALSA modules, build the old OSS system as a module, and specifically build the old "100% sound blaster compatible" driver as a module too. Build the kernel and reboot, and viola! It works!

Logic: I __think__ the old "sb" oss driver installs some sort of firmware or something that the card needs. But it works fine with the native snd-ca0106 alsa module - the oss module just sits there. But this system makes it work flawlessly.

I'm gonna report it back to the alsa developers so that they can perhaps have a better look at it.

Enjoy!

Sunday, April 10, 2011

Convert YouTube Videos with Maximum Quality Retention

The easiest way to download videos from YouTube is perhaps by using the VideoDownloaderHelper extension. It can not only download videos from YouTube, but from almost any website that features embedded video.

You need ffmpeg to convert videos.

1. Videos to Mp3:
ffmpeg -i video.flv -vn -acodec copy file.mp3


Note that some videos feature the newer aac codec, so the above won't work. Use
ffmpeg -i video.flv -acodec mp3lame -ab 128k file.mp3

2. Video to iPhone:
ffmpeg -i vcodec copy -acodec copy file.mp4


3. Video to Mobile:
ffmpeg -i video.flv -vcodec h263 -acodec copy -b 200k -s qcif file.3gp


There are what I use, and might not work for an older phone.

Saturday, April 9, 2011

Audio Production with Linux - The Poor Man's Studio

Linux has always been a high performance operating system for any use, and in an audio production environment, where low latency is of prime importance, Linux is of course the primary choice. In the following pages I will elaborate how I use Linux ( Fedora Planet CCRMA, to be exact ) to record my music.

-----------------------------
The Poor Man's Studio
-----------------------------

by Shaji Khan

-------------------------------
Part. I Preparing the system
-------------------------------

- Hardware

- Software

- Kernel

- Which distro to use?


--------------------------------
Part. II The anatomy of music
--------------------------------

- Outline the goal to be achieved

- The physiology of Sound Track: Layers

- Basic concept of keys, scales, tempo

- Binary formats and conversion among different formats


-----------------------------
Part. III Music production
-----------------------------

- Record drum track make realistic

- Record Bass

- Record from a Guitar

- Record from a Digital Synthesizer

- Recording Vocals

- Mixing and volume balancing

- Post production

- Maintenance of quality

- Music publishing and promotion of album

- Online publishing ( Jamendo.com, Opsound and others )

- Making the video

- You tube and video formats


---------------------------------
Part 4. Miscellaneous appendix
---------------------------------

- Writing lyrics

- Guitar riffs

- Chords with distortion effect

- Using LADSPA effects

- Making a virtual stompbox for your Guitar

- High quality software synthesizers



End of Series











-----------------------------
The Poor Man's Studio
-----------------------------
by Shaji Khan

-------------------------------
Part. I Preparing the system
-------------------------------


Ever since the conception of consciousness, the expression of elevated emotion has been considered as Art. This expression has over the ages transcoded itself to many different forms as pertaining to the contemporary popular society, but the one universal mode of expression has been music; historically, music production as an art form has been the privilege of an elite class. However, with decline in the price of technology and freely available open source software, music production has come within the grasp of the common man.


HARDWARE

Coming directly to the point, the aim of this article is to point the ordinary (Linux) user in the right direction so that he may be well equipped to take the first steps towards music production on Linux, and indeed any posix system (BSD-UNIX included). Each reader shall follow his or her own heart. We can only direct them at certain key places. The first choice, and the only decision that demarcates the hobbyist from the professional is the choice of what hardware to use. Today, with the falling prices of computers, most desktops boast of on-board audio chipsets that clock up to 192kHz - that is, professional studio quality. Of course, if you intend to actually run a studio with Linux, you need to have a multi-channel soundcard with ALSA support. Of course, most popular cards from major vendors are supported. Don’t try to club together multiple cards to record many channels; it won’t work that way. USB soundcards tend to cause issues, your mileage may vary. All in all, the soundcard you have inside your PC will do fine if you don’t intend to record more than one instrument at a time. I personally use an AC97soundcard that goes upto 48 kHz. This isn’t much, but I ensure high quality at all possible times by managing different things at various stages of the production process.



As for processors, those clocked higher will be better, and dual cores would be better than single cores. I personally have an Intel Pentium 41.5 GHz; very old, but with a realtime patched kernel I have minimal latency issues.



Along with a good soundcard, you should have a good speaker system or at least a good pair of headphones. If you have an old hifi-system with an aux input lying around, that will do fine as well. Just plug it in to the computer’s output jack with a crossover cable i.e. which has a 3.5mm pin at one end and component output plugs at the other. Be sure about what genre you want to record with what audio hardware, because it will be hard for you to record heart pumping bass if you cannot hear it yourself.



CONCLUSION : if you don’t want to open a recording studio, whatever your present configuration, the computer you have right now will do fine, and in fact you will yourself be amazed at the result you will get from your old computer. That is the power of Linux and open source software.



SOFTWARE

FIRST OF ALL, THE ONE THING TO pay attention to is that on Linux, audio production is all built upon the JACK audio server. Jack not only gives you the ability to record unlimited audio records from multiple channels to various virtual parts, you can actually feed video from one running program to another thereby creating a virtual studio inside your computer. This point is extremely important as it allows you to make do with things like virtual synthesizers and software guitar processors instead of paying huge amounts of money for the real thing. This is, after all, the poor man’s studio.

So, first of all things, the JACK server should be installed. There are two versions available, the outdated 0.118 branch and the upcoming 1.94 branch, and the one you install should depend on how old your distro is. Things that should be installed with JACK for a fully functioning audio platform are :-

- Ardour Hard Disk Recording System

- Hydrogen virtual drum machine

- Various synthesizers like

* amSynth

* alsa modular Synth

* Zynaddsubfx

* Spiral Synth Modular

* Bristol

- Various Guitar Effects Processors

* Rakarrack

* GNUitar

* Guitarix

- LADSPA plugin suite

* TAPS plugins

* CAPS plugins

* CALF plugins

* Steve Harris’ plugins

- Various encoders / decoders and players

* Vorbis tools ( oggenc, oggdec )

* FLAC

* MPlayer

* Lame ( for encoding to mp3 and therefore optional )

- Various miscellaneous editors for those ‘minor’ touches

* Sweep

* Audacity

* Sox

* Ecasound

Now, a very important question. What Kernel should we use? This is important because the Kernel will be the heart of the studio, and should be minimally bulky and overtly responsive. It is advised to patch the latest Kernel version from kernel.org with Ignor’s real time kernel patch, and to compile as little stuff in the kernel as possible to keep the lightweight and responsive.

Nowadays, there are plenty of distros that are specifically designed for audio production. I do not prefer them, because :-

- They might not have the latest software version.

- They are most hard to maintain.

I prefer a standard linux distro ( in my case Federa ) and compile each program by hand to finetune it to my needs and to make it use any specific extension available on my architecture.