comp.org.uk

Networking | Programming | Security | Linux | Computer Science | About

Linux Audio Conversion Tools

There are a number of sound tools in Linux capable of multiple tasks such as converting formats and applying effects.

sox

sox is the Swiss Army knife of sound-processing programs.

The simplest usage is to change file formats as follows:

sox audio.mp3 audio.ogg

This converts an MP3 file to an Ogg-Vorbis file (you may need to install the libsox-fmt-all package to be able to handle all file formats).

However, it can also perform many other functions such as the following:

Convert to mono, as shown here:

sox audio.mp3 audio.ogg channels 1

Double the volume, as shown here:

sox audio.mp3 audio.ogg vol 2

Change the sampling rate, as shown here:

sox audio.mp3 audio.ogg rate 16k

It can also perform more complex effects such as merging files, splitting files when it detects silence, and many others.

Its home page is at http://sox.sourceforge.net/.

FFmpeg/avconv

FFmpeg is generally used as a converter from one format to another.

There is a nice series of tutorials at the site A FFmpeg Tutorial For Beginners by shredder12.

It can also be used to record from ALSA devices such as hw:0 or the default device.

Recording from hw:0 can be done with the following:

ffmpeg -f alsa -i hw:0 test.mp3

It can be done from the default ALSA input with the following:

ffmpeg -f alsa -i default test.mp3

There was a fork some years ago of FFmpeg that produced avconv, which is the default on Ubuntu systems. There are some differences between the two, but not enough to justify the nuisance factor to users.

GStreamer

GStreamer allows you to build “pipelines” that can be played using gst-launch.

For example, to play an MP3 file using ALSA, you would have the following pipeline:

gst-launch-1.0 filesrc location="concept.mp3" ! decodebin ! alsasink

The pipelines can do more complex tasks such as format conversion, mixing, and so on.

Check out the tutorial Multipurpose Multimedia Processing with GStreamer by Maciej Katafiasz.

GStreamer can also play MIDI files with the following:

gst-launch-1.0 filesrc location="rehab.mid" ! wildmidi ! alsasink

Audacity

According to the Audacity web site, “Audacity is a free, easy-to-use, and multilingual audio editor and recorder for Windows, Mac OS X, GNU/Linux, and other operating systems.”

These are some of the user-level tools available for sound under Linux. The Wikipedia List of Linux audio software page has an exhaustive list.


Published on Wed 08 April 2009 by Larry Epson in Linux with tag(s): linux audio conversion