Recording Your Own Audio
So you're an amateur musician with a few songs you want to
record, and you're not sure you want to spend $50 an hour on studio time. But
you do have a guitar, a microphone, and a little mixing board. You're ready to record
onto your computer�but how? Well, assuming you have the output of the mixer
attached to your soundcard, here's how:
$ rec mysong.wav
Send break (control-c) to end recording
It's that simple. rec
is part of the SOX package, which I discuss in the upcoming section, Converting
Between File Formats. The command line explains itself�it records audio data
into the file mysong.wav, in WAV format. lang=EN-GB style='font-size:11.5pt'>rec knows what
format to use by looking at the file extension. If you provide a class=docemphasis1>-t-type option, it will use that type instead. When
you're done playing, press Control-C to finish writing the file.
To play back the file, simply type:
$ play mysong.wav
playlang=EN-GB> is also part of the SOX package, the complement to class=docemphasis1>rec. But when mysong.wav
plays back, it sounds terrible! What went wrong? Let's try a different playback
tool, one that displays some information about the file:
$ wavp mysong.wav
WavTools 1.3 Written by Colin Ligertwood.
lang=EN-GB>This software is provided as is. No warranty is offered, implied, or included.
lang=EN-GB>Playing [FILE: mysong.wav] [LENGTH: 987494]
lang=EN-GB>[RATE: 8000] [BPS: 8000] [DEPTH: 8] [CHANNELS: 1]
lang=EN-GB>[TIME: 00:00:00]
The ubiqituous file
command will also work:
$ file mysong.wav
mysong.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 8 bit, mono 8000 Hz
Aha! The rate is 8000 (samples per second),
the depth is 8 (bits), and the number of channels is 1 (mono). This is
definitely not CD-quality sound! We will need to provide options to class=docemphasis1>rec to specify the appropriate values:
$ rec -r44100 -c2 -sw mysong.wav
lang=EN-GB>Send break (control-c) to end recording
The file sounds much better now. As usual,
consult the SOX man page for more information about the available options.
reclang=EN-GB> can do only the simplest kind of one-track audio recording. If
you want to do professional quality multitrack recording, well, Linux can help
you with that, too! The next chapter, Music Production, has a section about
multitrack hard disk recorders that are available for our favorite operating
system. These applications are quite a bit more sophisticated and allow you to
lay down a number of tracks and then play them back while simultaneously
recording an additional track.
No comments:
Post a Comment