Audio examples

Convertitore USB / audio

arecord -f cd -Ddefault:CARD=LX3000 | aplay -Ddefault:Set &
arecord -f cd -Ddefault:Set | aplay -Ddefault:CARD=LX3000 &

Per avere la lista delle schede audio presenti:

arecord -L

Save 5 second of stereo audio in CD format

$ arecord -d 5 -f cd first_part.wav

Play a .wav file

$ aplay first_part.wav


$ arecord -f cd | aplay

Combine multiple audio files to single File

With the -m flag, sox adds two input files together to produce its output. The example below adds first_part.wav and second_part.wav leaving the result in whole_part.wav.

$ sox -m first_part.wav second_part.wav whole_part.wav

Extract Part of the Audio File

Trim can trim off unwanted audio from the audio file.

Syntax : sox old.wav new.wav trim [SECOND TO START] [SECONDS DURATION].
  • SECOND TO START: Starting point in the voice file.
  • SECONDS DURATION: Duration of voice file to remove.

The command below will extract first 10 seconds from input.wav and stored it in output.wav

$ sox input.wav output.wav trim 0 10

Increase and Decrease Volume Using Option -v

Option -v is used to change (increase or decrease ) the volume.

Increase Volume

$ sox -v 2.0 foo.wav bar.wav

Decrease Volume

If we need to lower the volume on some files, we can lower them by using negative numbers. Lower Negative number will get more soft . In the following example, the 1st command (-0.5) will be louder than the 2nd command (-0.1)

$ sox -v -0.5 srcfile.wav test05.wav
$ sox -v -0.1 srcfile.wav test01.wav

Get Audio File Information

The stat option can provide lot of statistical information about a given audio file. The -e flag tells sox not to generate any output other than the statistical information.

$ sox foo.wav -e stat
Samples read: 3528000
Length (seconds): 40.000000
Scaled by: 2147483647.0
Maximum amplitude: 0.999969
Minimum amplitude: -1.000000
Midline amplitude: -0.000015
Mean norm: 0.217511
Mean amplitude: 0.003408
RMS amplitude: 0.283895
Maximum delta: 1.478455
Minimum delta: 0.000000
Mean delta: 0.115616
RMS delta: 0.161088
Rough frequency: 3982
Volume adjustment: 1.000

Get audio from remote

$ ssh remote_user@remote_server arecord | aplay

Related links