Memainkan file musik di terminal

Di Linux kita tidak hanya bisa memutar file musik kesayangan anda menggunakan aplikasi berbasis GUI tapi kita juga bisa memakai terminal . Terasa seperti programmer handal atau pun para hacker. Pertama – tama kita harus menginstall terlebih dahulu aplikasi bernama sox untuk memainkan file seperti ogg, wav dll dan untuk file mp3 kita bisa menggunakan mpg123 atau ffmpeg.
Untuk menginstall mpg123 ketikkan perintah berikut di terminal anda. Catatan anda harus mempunyai koneksi internet atau mempunyai DVD repo yang sudah siap digunakan jika anda tidak punya keduannya bisa cari di repo kambing dengan browsing di warnet dan download file mpg123.

najat@najat-desktop:~$ sudo su
[sudo] password for najat:
root@najat-desktop:/home/najat# sudo apt-get install mpg123

jika sudah terinstall maka anda bisa menggunakannya dengan mengetikkan

root@najat-desktop:/home/najat/Music# mpg123 *mp3

Catatan anda terlebih dahulu membuka dir musik anda atau folder yang berisi file musik
dan mpg123 hanya mendukung file mp3 jadi untuk file lainnya anda bisa menggunakn sox

cara installnya sama anda tinggal mengetikkan

sudo apt-get install sox

untuk memainkan file musik anda tinggal ketikkan

play .ogg atau anda juga bisa menggunakan play *.ogg

sebaiknya membaca manualnya terlebih dahulu untuk mengetahui fitur lainnya yang ada seperti untuk memindahka lagu anda bisa menekan Ctrl -C dan untuk berhenti tekan Ctrl-C dua kali ata melakukan control lainnya untuk di mpg123 kita bisa mengetikkan perintah
mpg123 -C -z *mp3
yang artinya untuk memainkan file secara acak(random) dan memiliki akses kontrol untuk membesarkan/mengecilkan volume suara dengan menekan +/-, f untuk forward dan lain sebagainya .
Untuk membaca manualnya ketikkan saja
man mpg123 untuk melihat manual dari mpg123 atau man sox untuk melihat manual sox.

Langka Nih Materi Yang jarang dipakai:


Ni Command Lengkapnya :


mpg123 - play audio MPEG 1.0/2.0 file (layers 1, 2 and 3)


mpg123 [ -tscCvqy01m24 ] [ -b size ] [ -k num ] [ -n num ] [ -f factor ] [ -r rate ] [ -g gain ] [ -a dev ] [ -o s | -o h | -o l ] [ -d n ] [ -h n ] [ -p proxy ] [ -u u ] [ -@ file ] file ... | URL ... |



mpg123 reads one or more files (or standard input if ``- is specified) or URLs and plays them on the audio device (default) or outputs them to stdout. file/URL is assumed to be an MPEG-1/2 audio

bit stream.


mpg123 options may be either the traditional POSIX one letter options, or the GNU style long options. POSIX style options start with a single ``-, while GNU long

options start with ``--.

-t, --test

Test mode. The audio stream is decoded, but no output


-s, --stdout

The decoded audio samples are written to standard output, instead of playing them through the audio device. This option must be used if your audio hardware is not supported by mpg123. The output format is raw (headerless) linear PCM audio data, 16 bit, stereo, host byte


-c, --check

Check for filter range violations, and report them for each

frame if any occur.

-C, --control

Enable control keys. By default use 's' to stop, 'p' to pause, 'f' to jump forward to the next song, 'b' to jump back to the beginning of the song, ',' to rewind, '.' to

fast forward, and 'q' to quit.

-v, --verbose

Increase the verbosity level. For example, displays the

frame numbers during decoding.

-q, --quiet

Quiet. Suppress diagnostic messages.

-y, --resync

Try to resync and continue decoding if an error occurs in the input file. Also try to recover from certain broken headers. Useful if you have a broken MPEG file, on which mpg123 normally gives up saying `Illegal header'. Be careful: Broken locations in MPEG files might cause sharp, loud pops or clicks, which might damage your speakers if

played too loud.

-0, --single0; -1,


Decode only channel 0 (left) or channel 1 (right), respectively. These options are available for stereo MPEG

streams only.

-m, --singlemix

Mix both channels. This option is available for stereo MPEG layer-3 streams only. It takes less CPU time than full

stereo decoding.

-2, --2to1; -4,


Performs a downsampling of ratio 2:1 (22 kHz) or 4:1 (11 kHz) on the output stream, respectively. Saves some CPU cycles, but at least the 4:1 ratio sounds ugly. Please note, that does not change speed of the song. Ie the --2to1 option is the same like forcing the sampling output rate to -r

22050 on a 44.1 kHz song.

-b size, --buffer


Use an audio output buffer of size Kbytes. This is useful to bypass short periods of heavy system activity, which would normally cause the audio output to be interrupted. You should specify a buffer size of at least 1024 (i.e. 1 Mb, which equals about 6 seconds of audio data) or more; less than about 300 does not make much sense. The

default is 0, which turns buffering off.

-k num, --skip num

Skip first num frames. By default the decoding starts

at the first frame.

-n num, --frames


Decode only num frames. By default the complete

stream is decoded.

-f factor, --scale


Change scale factor (default: 32768).

-r rate, --rate


Set sample rate (default: automatic). You may want to change this if you need a constant output rate independed of the mpeg stream rate. mpg123 automagically converts the rate (down/up sampling) . You should then combine this with

--stereo or --mono.

-g gain, --gain


Set audio hardware output gain (default: don't


-a dev, --audiodevice


Specify the audio device to use. The default is system-dependent (usually /dev/audio or /dev/dsp). Use this option if you have multiple audio devices and the default is

not what you want.

-o s, --speaker

Direct audio output to the speaker.

-o h, --headphones

Direct audio output to the headphone connector.

-o l, --lineout

Direct audio output to the line-out connector.

-d n, --doublespeed


Only play every n'th frame. This will cause the MPEG stream to be played n times faster, which can be used for special effects. Can also be combined with the --halfspeed option to play 3 out of 4 frames etc. Don't expect great sound quality when using this


-h n, --halfspeed n

Play each frame n times. This will cause the MPEG stream to be played at 1/n'th speed (n times slower), which can be used for special effects. Can also be combined with the --doublespeed option to double every third frame or things like that. Don't expect great

sound quality when using this option.

-p URL | none, --proxy

URL | none

The specified proxy will be used for HTTP requests. It should be specified as full URL (``http://host.domain:port/), but the ``http:// prefix, the port number and the trailing slash are optional (the default port is 80). Specifying none means not to use any proxy, and to retrieve files directly from the respective servers. See also the ``HTTP SUPPORT


-u auth, --auth


HTTP authentication to use when recieving files via HTTP.

The format used is user:password.

-@ file, --list


Read filenames and/or URLs of MPEG audio streams from the specified file in addition to the ones specified on the command line (if any). Note that file can be either an ordinary file, a dash ``- to indicate that a list of filenames/URLs is to be read from the standard input, or an URL pointing to a an appropriate list file. Note: only one -@ option can be used (if more than one is specified, only the last one will be


-z, --shuffle

Shuffle play. Randomly shuffles the files specified on the

command line and in the list file.


Force stereo output


Forces reopen of the audiodevice after ever



Forces 8bit output

-w, --wav file

Write the song using the WAV format to the specified file Instead of a real filename you can use a dash ``- to indicate that the data is to be written to standard


-Z, --random

Full random play

Share this

Related Posts

Next Post »