Play music on command line

January 19, 2011 at 12:53 am (Audio / Video, console based, linux apps, Linux codecs) (, , , , , , )

There are many popular audio players for linux; to name a few they would be XMMS, audacious, amarock . But all of these players are GUI-based; and they does not feel like ‘home’ when you are so addicted to using the command line. So i did some searching on possible options, and i found many. I’m only listing two of the best here, mplayer and Music On Console (Player) or MOC. The command line players have the advantage of less crashes, less usage of resources, playability in CUI only OS’s, remote logging to play sound files on a remote machine. The MPD (music player daemon) server can stream audio using any sound output server to a remote machine.


Music on Console (MOC or MOCP) (homepage)

moc player

MOC 2.44 running on my fedora 14 (64 bit)

The MOC has a decent UI for a CLI program. Consists of two panes, one displaying the music files in the current directory and the other showing the current playlist. Play stats and tag info are displayed in the bottom, with the progress bar. Navigation within playlist and song can be done using keyboard. It’s updated support for pulse, OSS and alsa output.

Installation

for debian based sytems use, sudo apt-get install moc

for rpm based systems, it is unlikely that moc would be on the repository. Try yum install moc and see. If that’s the case, we need to compile from source which can be downloaded from this link. You would need following packages

for mp3 support: yum install libmad-devel libid3tag-devel

for wma,mp4,aac,ra support: yum install ffmpeg-devel (This caused a compile error due to ffmpeg-devel relocating its .h files .. so please don’t do this if you know how to use linking). To activate support for other codecs, see README.

then decompress the file, go to the folder and type usual

./configure && make && install as root to compile and install. See my article on compiling from source for more information.

After installation to run, type

mocp <filename>

press q and type mocp -x to end program. Otherwise the server will still be running πŸ™‚

Mplayer

mplayer

Mplayer running on console

This doesn’t need much introduction; which is as my perception is the best multimedia player ever, which can play videos too. Apart from the gmplayer (or mplayer-gui), the mplayer command can be used to play music on command line, with showing in depth info. Mplayer can play any audio file, it’s heavily stable and takes less resources. You can see my previous post on mplayer.

to install,

sudo apt-get install gmplayer (for debian based systems)

yum install mplayer-gui (for rpm based systems)

Advertisements

Permalink Leave a Comment

cowsay:How to make a cow talk on terminal startup

January 17, 2011 at 6:04 pm (console based, linux apps) (, , , , , , , )

Cowsay/cowthink (visit homepage at http://www.nog.net/~tony/warez/cowsay.shtml )

My hacked terminal startup using cowsay and figlet

Now you know what they use in Linux Mint to make a cow β€œtalk” when the terminal starts :). I’m going to tell you how to do it in a much more awesome way. The programs they use are cowsay and fortune-mode. Cowsay can show any string, a text output of a command,program to appear as a dialog generated by an ascii art (including cow).

You can install program by

sudo apt-get install cowsay (in debian-based systems)

yum install cowsay (rpm based sytems)

Now try these in the terminal

cowsay “$USER is my boyfriend” ($ shows string value of environmental variable USER)

ls | cowsay (output of ls is piped to cowsay)

There are options to decide the appearance of the cow and its eyes. For example the switch -d will cause the cow to appear dead. But the most important hack can be done by -f which forces to use a files called cowsay files, so that we can get anything other than cow. Type

cowsay -l

to find the path of these files. Try each file with following syntax

cowsay -f <cowfile name, without extension> <string to display>

ex: cowsay -f tux $USER

The cowfiles can be edited to appear as we want. Only edit the stuff rounded by the circle. Do not edit anything else, and save by giving a different file name. Or we can simply download an ascii art from internet and replace the stuff in rounded area.

Editing a cowfile - only edit stuff on the red area

 

You can download ascii arts from sites like http://www.chris.com/ascii/ or simply you can build your own using these programs http://www.ascii-art.de/tools/. I’m not going to mention about them here. But the program Jave5 is a good one with a easy to use GUI, and runs on linux.

http://www.jave.de/download/download.html

Linux mint uses an additional program called fortune-mod to get’s stuff. Other than the command cowsay, cowthink can be used to appear like the cow is thinking, not speaking.

Fortune-mod (The classic fortune cookie program)

Fortune-mod is so far the funniest FOSS program i have come across with. It generates a random text string of a joke, a saying by a great person, something useful etc… Can’t be saying it all just try it by yourself. I haven’t seen the same thing twice after using it for some time.

Sudo apt-get install fortune-mod (for debian based systems)

yum install fortune-mod (for rpm based systems)

to use type fortune in the command line.

This can piped to above cowsay easily

ex: fortune | cowsay

a fortune | cowsay piped output

for other options of fortune, refer man pages.

Making the cow talk

To make this show on terminal startup (or run any program) you can put the above command in your bashrc file.

gedit ~/.bashrc

and add above commands, as you wish in it. You can add figlet command too. Open a new terminal to see the change.

So, mine produced something like the first picture in this post by these commands

cd ~/Desktop/figlet222/

./figlet -c -f script “lmpeiris rocks”

fortune | cowsay -f love

cd ~

Permalink Leave a Comment

Figlet: Show text in ascii art

January 17, 2011 at 2:06 pm (console based, linux apps) (, , , , )

Mmmmm…….. it’s me after a long time writing on this blog. I’ve almost forgotten that there was a blog of mine just waiting to be refreshed by it’s author. Within the last year i changed my PC and the operating system twice, and now using the Fedora 14 x86/64 edition. So I guess we should start from some ascii arts on the terminal to show up whenever it’s started. This type art is familar to the Linux Mint users who will see an animal saying something in ascii art upon start of each terminal. However, it requires use of multiple commands. This post is part one.

Figlet – print a text as a logo http://www.figlet.org

Happy new year on figlet version 2.22

How to install – figlet is not provided with most of the Linux distributions, and it’s not included in their package hosting servers. Hence using yum or apt-get simply may not work. If that’s the case, we need to compile it from the source. You can download the source from here. Decompress it and change in to it’s directory in the terminal and type;

make

to compile figlet. For further information on compiling from source, see my article. Unfortunately, there’s no make install here so we need to change in to figlet directory always to use the command (you can copy the binaries and man pages in to correct directories but this is complex).

cd <path to figlet folder>/figlet222/

./figlet <the text you want to show as a logo>

figlet features

I’ ll be mentioning only the important ones here.

Change style/font : A sub directory called fonts holds some .flf files which contains style info.

./figlet -f <fontfile_name> text

ex: ./figlet -f script Happy new year will produce something like above picture.

change alignment : To center -c , -l for left and -r for right

change right to left: -R

layout: -t will fit the text to terminal width, -P paragraph mode

figlet using some tweaks above

There’s a lot more; see figlet man page for more details. http://www.figlet.org/figlet-man.html

Part 2 of the post is about using cowsay and fortune-mod. Will be followed soon.

Permalink Leave a Comment

The doomsday engine – doom reloaded!

October 30, 2009 at 7:44 pm (Games) (, , , , , , , , )

There was a time computers were a luxury ….. There was a time when a computer with a 100MHz processor speed was called a power horse… I bought my first PC in those times. I started computing when the games Doom and Heretic was on the rock.

Heretic running on DENG - extracted from dengine.net

Made by the ID software inc. these games became so immensely popular with the then younger generation, because they were the first, 3D first-person shooting games (like call of duty) ever to be on the market requiring just only a few hardware requirements, and first ones to exploit the power of creative sound-blaster sound cards. And the gaming experiences, still thrilling. The gaming innovation and logic behind doom and heretic keeps players playing it after 17 years.

Of course, I played these within MS-DOS at those times, but many people who are now using Linux likes to play the game. They can do so by choosing the dosbox emulator, and play the original game as in those times.

But many people thought of hacking (to improve) the game and came up with an open source emulator called doomsday engine (DENG) which uses the original id3 core files (.wad files); only to get the games strategic data (how the game goes, maps). The coolest thing is that every texture, unit, player, effect, weapon can be loaded from different ones from the original. Simply, people got together and re-designed textures etc.. to give superb 3D performance like in a new game! So you’ll be playing the same games (doom,heretic,hexen), with superb graphics! (and hacks) . Visit there homepage, for more information.

Doom running on DENG - extracted from dengine.net

Installation

Installation is some what tricky. I heavily recommend compiling from source. You can download from here.

Tar -xvf deng-1.9****tar.gz ‘unpacking the tar file

cd <source directory> ‘ go inside the source directory , from here on i will use deng-1.9*** for the source folder.

cd doomsday

mkdir mybuild ‘create this directory if doesn’t exist

cmake .

If dependency problems found, install them. See installing from source (in my blog) for more info.

make

make install ‘(for debian systems, sudo make install)

We still need some stuff. This is the downloading part. These are called resource packs which includes open-source textures,units for the games. Download below things and copy each to deng-1.9***/snowberry/addons folder, after unzipping them. (you can go and have a look at the addons folder, it includes examples how unzipped things should be there).

http://files.dengine.net/jdrp-packaged-20070404.zip

http://files.dengine.net/jhrp-20090703.zip

this is enough for now. When you start to get things correctly, go to http://files.dengine.net/index.php and download other stuff you want. Go to http://www.doomsdayhq.com/ if you don’t know what to download.

Now you need some .wad files from the original games. Download those from this torrent. http://torrents.thepiratebay.org/3555137/Doom_Heretic_Hexen_WADs.3555137.TPB.torrent Unzip and put those in somewhere you can find. (if the above link doesn’t work, try searching for β€œdoom heretic hexen wads” in torrentz.Com.

Configuration

cd deng-1.9****/snowberry ‘Goto deng-1.9***/snowberry .

Snowberry is the graphical configuring tool for deng, which makes our life easy. Type,

python snowberry.py

If you have WxPython and pyGTK (i actually cannot remember) installed correctly, it will show a gui like below.

Snow berry GUI

Snowberry graphical deng configure running on my FC11

Configuring doom2

From the mini bar click profile and select new. A dialog box will appear, give it a name which you can identify, and select jdoom from the combo-box. You should see it on the left panel under shared settings.

Now it’s time to change some settings. Select the jdoom from panel, and click on the settings tab. Something like below should appear. For the game data file, browse the doom2.wad from the torrent download folder. Click on display and adjust resolution, and full screen view. Click on the addons tab and check jdoom-resource pack if it’s not checked.

Configuring doom1 and heretic

For the jheretic, choose heretic.wad and jheretic resource pack. (use your brain).

For doom1, choose doom.wad or ultimate.wad(something similar) and do as above.

The Playing part ….!

Just tell me whether you understand the stuff above and got it running …. then i will start telling you something about the games itself. Enjoy!

Permalink 5 Comments

Skychart (Cartes du Ciel) – explore and map the skies

July 8, 2009 at 2:35 pm (Maths and science) (, , , , , , , )

When I was little, I always happened to wonder about the millions of stars which light up the night sky. I needed to be a astronomer some day, and I wanted to buy a telescope. Anyway, I couldn’t have enough time to do it. Anyways, for the people who are armature astronomers, the skychart is an excellent program.

Skychart 3 alpha running on my fedora 11

Skychart 3 alpha running on my fedora 11

It renders sky of any time of the day, at any location of earth (or anywhere), at any angle using the supplied data with the program. As you can see in the screen shot above, you can rotate, select,zoom any star object in the map to gain information about it. The Field of Vision (FOV) can be changed, deciding the angle you want to look at (the pane to the right). The standard markers like equatorial coordinates, galactic coordinates etc… are on the left pane. Did I tell you that this program can show sky from 3000BC to 3000AD?

As you know, the galaxies contain huge amount of star objects so it’s not possible to render everything in the data files. Program settings allow to change what you want to see… it could be galaxies, nebula or even asteroids. Powerful search functions enable to find desired object in seconds. The core of the program is built with freepascal and the GUI is built with lazarus.

The professional approach

Without just looking at the map, skychart has the ability to edit them, label objects and build a map from the scratch. It can conect with SQL databases and standard astronomy catalogue sites like CDS or ADC. It uses catgen to convert these to a format which is readable by skychart. You can add a telescope (manual or automatic) to the program, and process the data directly from it. (These data can be sent to SQL databases too).

Additionally, program can predict a whole astronomical calendar.. eclipses, twilight, sun-rise, comets etc…

A fascinating feature is the night vision mode. This is heavily required when you looking at the stars from naked eye. (You loose sensitivity in dark if you see a bright light for some seconds). You can visit their homepage for more details from this link.

Skychart running on night vision mode

Skychart running on night vision mode

Installing

Binaries

For Fedora,suse, mandriva people type in terminal as root

yum install skychart

For ubuntu,mint,debian use

sudo apt-get skychart

Or you can go to sourforge download page to download what is best for you.

source

Anyways, the Version 3 was released late, so you may get beta versions with above method. The source code for the latest version can be downloaded from this link.

Permalink Leave a Comment

Next page »