Miscellaneous audio tools

Ripping compact discs

To encode the whole CD in a single file (in the lossless flac format):
abcde -1 -N -x -o flac -a default,cue
The above options are:
-1 Encode the whole CD in a single file. The resulting file uses the CD title for tagging. If the resulting format is a flac file with an embedded cuesheet, the file can be used as a source for creating other formats. Use "-1 -o flac -a default,cue" for obtaining such a file.
-N Non interactive mode. Do not ask anything from the user. Just go ahead.
-x Eject the CD when all tracks have been read.
-o [filetype][:filetypeoptions] Select output type
-a [actions] Comma-delimited list of actions to perform. Can be one or more of: cddb, cue, read, normalize, encode, tag, move, replaygain, playlist, clean. Normalize and encode imply read. Tag implies cddb, read, encode. Move implies cddb, read, encode, tag. Replaygain implies cddb, read, encode, tag and move. Playlist implies cddb. The default is to do all actions except cue, normalize, replaygain and playlist.

Making other formats: single FLAC into mp3 tracks

After encoding the whole CD as a single file (in the lossless flac format) with abcde -1 -N -x -o flac -a default,cue, convert into individual mp3 tracks:
abcde -d file.flac -N -o mp3 -a default,cue

Splitting large flac and ape files

To break a large flac file (cd1.flac, cd1.cue) into individual tracks cd1-track1.flac, cd2-track2.flac, ....:
cuebreakpoints cd1.flac.cue | shnsplit -o flac cd1.flac -a cd1-track
or, given the break point,
echo "10:56:48" | shnsplit -o flac cd1.flac -a cd1-track
The above commands are available from the following packages (Debian/Ubuntu?)
sudo apt-get install cuetools shntool

Merging FLAC files into one [after] generating the CUE file

shntool cue *.flac > merged.cue
shntool join *.flac -o flac

Merging mp3 files into one

avconv -i "concat:file1.mp3|file2.mp3" -acodec copy merged.mp3 
If the above gives

concat:file1.mp3|file2.mp3: Protocol not found
then the following seems to work:

sudo apt-get install mp3wrap
mp3wrap merged.mp3 *.mp3

Downloading music from youtube

Playing via external USB audio card (USB DAC): version 1

  • To play an audio file via the USB audio card (for best results, try an asynchronous USB DAC, such as Audioquest DragonFly or Cambridge Audio DAC10), find out which card and which device:
    aplay --list-devices
    card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 1: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    cat /proc/asound/cards
     0 [PCH            ]: HDA-Intel - HDA Intel PCH
                          HDA Intel PCH at 0xf7d20000 irq 42
     1 [CODEC          ]: USB-Audio - USB Audio CODEC
                          Burr-Brown from TI USB Audio CODEC at usb-0000:00:1d.0-1.7, full speed
    cat /proc/asound/card1/pcm*p/info
    card: 1
    device: 0
    subdevice: 0
    stream: PLAYBACK
    id: USB Audio
    name: USB Audio
    subname: subdevice #0
    class: 0
    subclass: 0
    subdevices_count: 1
    subdevices_avail: 1
    So, we will use card 1, device 0 (the USB audio card). One could say (depending whether using ALSA or OSS):
    mplayer -ao alsa:device=hw=1,0 filename.flac
    mplayer -ao oss:/dev/dsp1
    aplay -D hw:1,0

    Playing via external USB audio card (USB DAC): version 2

    For whatever reason, the above stopped working for me with the message `Failed to initialize audio driver'.
    apt-get install pulseaudio
    pulseaudio &
    pacmd list-sinks|grep card:
            card: 0 <alsa_card.platform-soc-audio.3>
            card: 1 <alsa_card.usb-Cambridge_Audio_Cambridge_Audio_DAC100_USB_1_0000-00-C1>
            card: 2 <alsa_card.usb-AudioQuest_inc._AudioQuest_DragonFly-00-DragonFly>
    pacmd set-default-sink 2 # for AudioQuest DragonFly
    mplayer filename.flac

    Disabling on-board sound card and playing exclusively via external USB audio card (USB DAC)

    Assume that cat /proc/asound/modules gives
     0 snd_hda_intel
     1 snd_usb_audio
    The onboard sound card "0" is served by snd_hda_intel. Say, we want to completely disable this sound card and use the USB card in all applicaions. Add the following line to /etc/modprobe.d/alsa-base-blacklist.conf :
    blacklist snd_hda_intel
    Then, to make sure that USB soundcard is the default from the point of view of browsers and all other applications (has number "0" when saying cat /proc/asound/cards), add the following line to the file /etc/modprobe.d/alsa-base.conf :
    options snd_usb_audio index=0
    The options will take effect after reboot.
    For more information,