Thursday, July 16, 2015

podcasts, audio cds, wine

Links: Overview of burning options :: Tutorial for Linux burning :: Mixed Data-Audio :: More TOC information

I download 60 minute podcasts and burn them to CD's to play when driving. The problem with a long CD is having to listen to, say, the first 20 minutes to skip to minute 21. MP3 players overcome this, but I don't like MP3 players in traffic: I need to look down at the time stamp. Instead, I break the hour podcast into 12 x 5 minute tracks and burn them to a CD. I can keep my eyes on the road and just twist the knob a couple of times to the track I want, without looking down. Below is my process (about 15 minutes long) for processing a podcast onto a CD. There's also some information related to one-time software installation.

Note: processing audio is not hugely resource-intensive on any system built in the last 15 years. Therefore, no "system requirements" or "rendering" time estimates are included here, unlike posts for video processing.

Steps

  1. Convert podcast into a .wav (audio CD format: 44Khz, 2chan, 16bit little endian)
  2. Set levels and so on
  3. Pick 11 break points and insert a second of silence at each
  4. Save each of the 12 segments using a numbering convention, eg "chunk01", "chunk02", etc
  5. Double-check the folder contains all 12 segments
  6. (optional, time permitting) Provide meta-information to display during CD playback (requires creation of a .toc file)
  7. Burn the segments to a CD as 12 tracks.

1. Convert to WAV (1 min)

Sometimes a podcast will be in a video format, sometimes just an MP3, etc. The line below will convert any format, since it nulls the video.
$ ffmpeg -i podcast.avi -vn -ar 44100 -ac 2 podcast.wav

2. Set levels (2 min)

You can always "normalize" the audio, something useful if you have several WAV's. That would be something like...
$ normalize-audio -m *.wav
For a single large WAV that I'm going to divide into sections, I'll need an audio editor, so I just set the level manually when I open the WAV in the editor.

  wine installation sidebar
If you (like me) prefer some outdated Windows audio editor from the 90's that's like an old glove, installing Wine is necessary to use the app. Wine however requires 32-bit libraries. Therefore, in addition to the 500Mb of extra multilib crap, you risk occasional 32-bit multilib conflicts with your modern x86_64 installation. Accepting that, in Arch, add the "multilib" Arch repository and let pacman do the heavy lifting. Enable the "multilib" repo inside pacman.conf, so pacman can locate and add the libraries.
# nano /etc/pacman.conf
[multilib]
Include = /etc/pacman.d/mirrorlist
# pacman -Syu
# pacman -S wine winetricks lib32-alsa-lib lib32-ncurses
$ wine [path to some old app]
If some of the application sound controls don't work, open $ winecfg and check sound settings for the correct card, and so on.

3. Select, mark divisions (5 min)

With the WAV open in a sound editor, I can place 1 second breaks at the end of a sentence (or other pause in speech), about 5 minutes apart. The one hour podcast is thus divided into 12 segments, with 1 second silence pauses I can see on the timeline. Time permitting, if there are any commercials or unwanted portions of the podcast, I can trim them away at this point.

4. Save the segments (5 min)

Moving from silence divider to silence divider, I save each segment of the WAV as a smaller WAV, labeling each sequentially; "chunk01.wav","chunk02.wav", etc. Burning software will follow my numbering convention, re-assembling the segments, in numbered order, as tracks onto a CD.

5. Double check folder

Verify all 11 or 12 tracks (WAVs) are in the folder and are sequentially named.

6. (optional) provide track information, pre-listen

CD's have about 70-80 minutes available, given 700Mb. If you've trimmed a lot of the podcast, you might add additional tracks to the folder, change the order of play around, etc. Maybe you have time to listen to how the entire CD will ultimately sound, once burned. To do this, make a playlist using a text m3u or pls file and play the playlist using your media player. In this post, I reference simple .m3u files (see bottom of page), but I've used the more complex .pls format in other situations. Additionally, you may want to create a .toc text file for meta information during CD burning. An example of a .toc is
also at the bottom of the page.

7. Burn to CD (2 min)

  burning software sidebar
Because I added one second to each segment when dividing the WAV (see 4 above), I don't want to pad the tracks with additional silence when burning them -- too much silence between tracks. Avoiding padding means using DAO (Disk at Once) burning rather than TAO (Track at Once) burning. Secondly, in Arch, pacman cannot resolve both wodim (cdrkit) and cdrecord (cdrtools), because their libraries conflict. Pick one, in other words. I'm used to cdrecord, but Arch instructions only describe burning in terms of wodim and genisoimage (DVD), so I went with cdrkit. Cdrdao is the most important for my way of burning anyway, and that's a separate package.
# pacman -S cdrkit cdrdao


Installation completed, burning is available. Burn speeds may be tweaked up or down according to impatience or errors, but generally:

1) Burning without a Table of Contents, say from a folder in which WAV's are in numeric order:
$ wodim -v speed=1 dev=/dev/sr0 -dao *.wav
If you want to run a test on whether it burns OK first, insert the "-dummy" option in the line. For pads between tracks add the "-pad" option. Other options on the wodim man page.

2) Burning with a Table of Contents (.toc file) can utilize individualized track names and folder locations while burning, and can include track meta-information to display during playback. The application for this type of burning is cdrdao, but note that cdrdao actually requires a TOC file to burn:
$ cdrdao write --device /dev/sr0 --speed 6 --eject --driver generic-mmc-raw [tocfilename].toc

Other Audio Notes

BPM information: The Mixxx application (pacman -S mixxx) in the Arch repositories will calculate Beats Per Minute.

VLC note: During playback, to disable the orange cone when there is no album art: Tools, Preferences, Select All (Bottom), Interface, Main interface, Qt, unselect "Display background cone or art".

.m3u

This file type is good for doing a test of the CD before we burn it. Inside the m3u, we can move the track order around until it sounds the way we prefer. Below is a minimal example with two tracks -- you can expand the number of tracks using as many WAV's as desired, for example you may want to make a 4 hour playlist for a party. However, a CD cannot contain more than 70-80 minutes of audio, unless you have a stereo that plays MP3 format (a different post), so keep a general idea of your minute total if you ultimately intend to burn it.
$ cat sample.m3u
#EXTM3U

#EXTINF:-1,July 15 Podcast - Part 1 (4:08)
chunk01.wav

#EXTINF:-1,Musical Interlude (3:00)
/home/foo/tracks/sunnyday.wav

.toc

Links: TOC metadata explanation :: More TOC information :: Script for simple TOC production
The TOC is critical during DAO burning, so it's worth reading a couple of posts on them (see links above). A user may wish to modify the TOC from an existing audio CD, produce a TOC from scratch, etc. To examine a TOC from an existing audio CD:
$ cdrdao read-cd --device 0,1,0 --driver generic-mmc-raw somename.toc
These TOC files are easily manipulated with any text editor. Use two forward slashes ("//") to add comments inside the file. I make very simple TOC's, but there are many tweaks available for those who have the time to invest: get into those three links above.

Here's a truncated view of a TOC I made for a divided podcast burn. The actual TOC for the burn is obviously longer since it has more tracks, but you'll get the picture:
$ cat sample.toc
CD_DA

//Track 01
TRACK AUDIO
CD_TEXT {
LANGUAGE 0 {
TITLE "Part 1: 2014-09-24 Speech"
PERFORMER "Matteo Renzi"}
}
FILE "chunk01.wav" 0

//Track 02
TRACK AUDIO
CD_TEXT {
LANGUAGE 0 {
TITLE "Part 2: 2014-09-24 Speech"
PERFORMER "Matteo Renzi"}
}
FILE "chunk02.wav" 0
The information will be displayed for each track. Also, the tracks are only 5 minutes each: when driving, I can spin the knob between tracks without looking down. When stopped, I can glance down to see the actual title of the portion. Have fun and be safe!

No comments: