December 15, 2007

Audio in Linux is awesome

I’ve got some poorly recorded MP3s of people speaking. I want to try to make them a little easier to hear. In Windows I’d reach for Sound Forge. How about in Linux?

  1. Search Google for “sound forge equivalent for Linux.”
  2. Find several references to “Wave Forge.”
  3. Find “Wave Forge” hasn’t been updated this century. Move on.
  4. Decide to try Audacity because it’s in the back of your head, and Ardour because you found a bunch of links to it somewhere.
  5. yum install audacity ardour. That was easy.
  6. Run Ardour. Tells you it needs JACK. WTF is a JACK? Move on.
  7. Run Audacity. Loads. GUI looks a little silly compared to Sound Forge, but it looks functional enough.
  8. Try to load the MP3 file. Get told this version doesn’t have MP3 support.
  9. Fish around for something to decode an MP3 to a WAV file. Feel bad about considering installing xmms just because you remember how to do this with WinAmp. Rejoice when you find lame --decode.
  10. Load the WAV in Audacity. Looks good.
  11. Hit the play button. Get told there’s an error in sound output.
  12. Check sound preferences. Note that there are no available playback devices.
  13. Read around for a while about JACK. See references to jackd. Eventually realize that this is something you need to run yourself, as your own user.
  14. Run jackd. Get told that it can’t open the hardware device, presumably because other things (Amarok, Flash) are using it.
  15. Find the correct invocation to run jackd which is something like jackd -d alsa -d default (-d twice, WTF).
  16. jackd seems to keep running. Cross fingers, run Ardour. It opens.
  17. Look at the Ardour interface. Decide that (1) it’s not what I want, and (2) dear god that is ugly. Is that Tk? Motif? Holy hell. Run away.
  18. Open Audacity back up for the shit of it. Lo, there is some sort of JACK playback device now. Select it, hit OK.
  19. Click play button in Audacity. Error with sound card.
  20. Go into settings, change record device from OSS to JACK. (But I’m not recording?) Click play button in Audacity. Sound comes out! Rejoice.
  21. Select a section, figure out how to zoom in. Click play. Get an error telling you it can’t play.
  22. Try playing different selections, no selections. Keep getting the same error.
  23. Restart Audacity. Same error.
  24. Restart jackd. Restart Audacity. Same error.
  25. Read about qjackctl being very helpful. yum install qjackctl. That was easy.
  26. Run it. Not sure what I’m looking at. Says JACK is started. Try to turn on logging. Tells me I have to restart something. Whatever.
  27. Restart Audacity. Hit play. Same error.
  28. strace jackd. Hit play in Audacity. No activity.
  29. Stop jackd and tell qjackctl to start it. Get a pretty incomprehensible error message in its “log.”
  30. Realize that it’s bitching because it’s trying to start it with real-time priority, which it presumably doesn’t have permission to do.
  31. Read http://jackaudio.org/faq. “The simplest, and least-secure way to provide real-time privileges is running jackd as root. This has the disadvantage of also requiring all of JACK clients to run as root.” Yeah, no.
  32. Google around a bit, find out about /etc/security/limits.conf. Find some lines in there referring to @jackuser.
  33. Try to usermod -a -G jackuser myuser. Fails, presumably because my user is in LDAP (but the group is in /etc/group).
  34. vigr, add myself to the jackuser group by hand.
  35. Don’t want to restart my X session to get new groups. Figure I need to log in from scratch to get new limits. Fuck it, ssh localhost.
  36. Run qjackctl. Tell it to start jackd. Works. Rejoice.
  37. Run Audacity. Hit play. It works!
  38. Stop. Hit play again. It still works!
  39. Stop. Make a selection. Play the selection. Holy shit it played the selection!

Really not very much work at all. And Audacity only crashed, like, three or four times while I was using it! (Mostly when hitting the play button to play the section I was working on. I can’t remember if jackd exited too.)

I can’t wait for PulseAudio. I’m sure that will make all of this even easier.

Oh, but in the end, I just ended up using sox and normalize in a script to do my MP3s in a batch…