Sonar Workflow 3 - Exporting Procedures

From Sonar

Home Page * Getting Started * Workflow * Tips, Techniques and Tutorials * Errors and Workarounds * Making Music * Composing, Arranging & Songwriting * Optimizing Your DAW * Recording Gear * Included Components * Third-Party Effects * Third-Party Virtual Instruments * Computer Systems and Components * Free Downloads * External SONAR resources


Contents

Exporting From Sonar

Once you've finished composing, tracking, mixing and exporting your music, you'll end up with one of four file types with SONAR's File | Export | Audio function: RIFF WAV, Broadcast WAV, Windows Media Advanced Streaming or MP3 (if you have paid separately to use the MP3 codec that comes with SONAR).

RIFF WAV and Broadcast WAV files are the file types of choice for mastering, as they are lossless formats.

MP3, on the other hand, is a lossy format, meaning that you not only lose information (read: quality) by encoding a file as MP3, but you also lose additional quality every time you modify the file's content (though not, of course, its metadata). This makes MP3s suitable for casual listening, but not for mastering or even demanding listening.

If you choose not to buy the shareware codec that comes with Sonar, you can still produce MP3s with an external codec. By far the most highly recommended of these is LAME, which is open source. It is also widely considered to be the best MP3 encoder around, making it preferable to the codec bundled with SONAR even without condidering monetary factors.

SMS 14:02, 15 September 2006 (EDT)

Exporting MP3s from SONAR using LAME

Step-By-Step Instructions For Encoding With LAME in SONAR

If you don't want to unlock (buy) the Cakewalk MP3 encoder, you can use the LAME MP3 encoder directly in SONAR. This way you don't need to first export to .wav and then encode to .MP3. The LAME MP3 encoder is high quality, open source and free.

Here are step-by-step instructions for setting up the LAME MP3 encoder (from the Cakewalk Forum Thread by Jesse G):

  1. Download and install the LAME encoder.
  2. Open SONAR 3/4/5 and go to ToolsCakewalk Ext. Encoder Config.
  3. In the Friendly Name field write LAME MP3 Encoder.
  4. In the Extension field write .MP3.
  5. In the Description field write whatever you want.
  6. In the Path field put the path where you installed the LAME encoder. That is where lame.exe and lame_enc.dll are located. I keep my LAME encoder in my "C:\\Program Files\\Cakewalk\\Shared Utilities\\LAME" folder. You can also copy and paste the extracted contents of the LAME .zip file to your Sonar shared utilities folder and then, when you have to perform this step, click the browse button to find the location.
    (Note that you may have to enclose paths containing spaces in quotation marks).
  7. In the Command Line field write (for example): lame -b 192 -m j %I %O (See below for more encoding options).
  8. Uncheck Keep Wave File.
  9. Press Save button.

This will export a constant bitrate 192Kbps joint stereo MP3 file. If you want 128Kbps, replace 192 with 128 in the Command Line field. The next time you click on FileExportAudio in SONAR 3, 4, 5 you'll find "LAME MP3 encoder" as a type of audio.

If you want to be able to export to both 192Kpbs and 128Kbps, click New and then repeat the above steps, but this time use 128 instead of 192 in the Command Line, and also give them different Friendly Names, such as "LAME 192k MP3" for the 192 version and "LAME 128k MP3" for the 128 version. Now you will have both choices the next time you export audio.

Dcastle 12:42, 15 September 2006 (EDT)

Fine-Tuning LAME Encoding

LAME permits a huge number of options in the command line. It's well worth your while to check out the main ones, as they can greatly affect the quality and file size of the MP3s you produce. These options are specified in the Command Line field of SONAR, as mentioned above. The syntax is:

lame <options> <infile> <outfile>

In practice, you will only be interested in changing the options, so the syntax can be simplified to:

lame <options> %I %O

LAME offers three types of encoding: Variable Bitrate (VBR), Average Bitrate (ABR) and Constant Bitrate (CBR). The rule of thumb, following Hydrogen Audio's testing, is as follows: at a given bitrate, VBR is higher quality than ABR, which is higher quality than CBR (VBR > ABR > CBR in terms of quality). The exception to this is when you choose the highest possible CBR bitrate, which is 320 kbps (-b 320 = --alt-preset insane), but this produces very large file sizes for very little audible benefit.

The following are the recommended LAME encoding settings from Hydrogen Audio. They all go in the <options> field of the Command Line entry in SONAR:

Variable Bitrate (VBR)

Use VBR when the goal is to achieve a fixed level of quality using the lowest possible bitrate.

  • VBR is best used to target a specific quality level, instead of a specific bitrate. The final file size of a VBR encode is less predictable than with ABR, but the quality is usually better.
  • Usage: -V(number) where the number is 0-9, 0 being highest quality, 9 being the lowest.

Example: lame -V2 %I %O

Average Bitrate (ABR)

ABR is a compromise between VBR and CBR modes. ABR encoding varies bits around a specified target bitrate.

  • Use ABR when you need to know the final size of the file but still want to allow the encoder some flexibility to decide which passages need more bits.
  • Usage: --preset <bitrate> where <bitrate> (desired averaged bitrate in kbit/s) can be any value between 8 and 320 (e.g. 9, 17, 80, 128, 133, 200, etc).

Example: lame --preset 200 %I %O

Constant Bitrate (CBR)

CBR encoding is not efficient. Whereas VBR and ABR modes can supply more bits to complex music passages and save bits on simpler ones, CBR encodes every frame at the same bitrate.

  • CBR is only recommended for usage in streaming situations where the upper bitrate must be strictly enforced.
  • Usage: -b <bitrate> where <bitrate> (in kbit/s) must be chosen from the following values: 8, 16, 24, 32, 40, 48, 64, 80, 96, 112, 128, 160, 192, 224, 256, or 320.

Example: lame -b 192 %I %O

Fine-Tuning Other LAME Options

When exporting MP3s from SONAR using the LAME encoder, you can have a series of convenient operations performed automatically. These include:

  • -c: Setting the Copyright bit.
  • --clipdetect: Detecting clipping in the encoded MP3 file (you will only see this information if you keep the LAME command-line interface open).

Example: lame -V2 --clipdetect -c %I %O

This will produce a very high quality VBR (-V2) MP3, with the copyright bit set and clip detection activated.

The LAME help files detail many more options.

Getting LAME

The main LAME site, on SourceForge, offers only the uncompiled LAME source code, which is of no use to the average end user. What you need is a compiled binary of the LAME encoder.

You can download the LAME encoder from several sites, including:

Avoid using alpha (a) versions of LAME. More often than not these are exclusively for testing purposes -- use them only if you want to help developers with feedback.

To manually encode MP3 files using LAME, several graphical front-ends are available, including RazorLame. Note that RazorLame and most other front-ends require that you install the actual LAME binary encoder separately.

Exporting Lossless FLAC files from SONAR

Step-By-Step Instructions For Encoding With FLAC in SONAR

To export compressed archival-quality files from SONAR, the FLAC encoder is recommended. Lossless formats such as FLAC retain all the information contained in the source .WAV --the FLAC file can be converted back into a .WAV file with 100% bit-for-bit accuracy-- but are highly compressed, though not nearly as much as MP3 files.

Here are step-by-step instructions for setting up the FLAC encoder. They have been tested in SONAR 5.2 Producer Edition.

  1. Download and install the FLAC encoder.
  2. Open SONAR and go to ToolsCakewalk Ext. Encoder Config.
  3. In the Friendly Name field write FLAC Lossless Encoder.
  4. In the Extension field write .fla.
  5. In the Description field write FLAC Lossless Compression Level 5.
  6. In the Path field put the path where you installed the FLAC encoder. This is where flac.exe and related files are located.
    (A path without spaces is recommended).
  7. In the Command Line field write: flac.exe --compression-level-5 %I -o %O
  8. Uncheck Keep Wave File.
  9. Press Save button.

This will export an optimally-compressed (compression level 5) FLAC file with no frills.

If you want FLAC to automatically add the few tags that SONAR passes to external encoders, use these options in Step 7:

  • flac.exe --compression-level-5 -T "ARTIST=%A" -T "TITLE=%T" -T "COPYRIGHT=%C" -T "COMMENT=%D" %I -o %O

This puts the information found in SONAR's FileInfo dialog box into the appropriate tags of the FLAC file (with "Description" being placed in the Comment field for lack of a better place).

In addition to the above tags, which will be different for each tune you compose (assuming you actually update the SONAR Info box), you can add your own tags with static data:

  • flac.exe --compression-level-5 -T "DATE=2006" -T "ALBUM=My Rockin Sonar Tunes" -T "GENRE=Cliched Heavy Metal Power Ballad" -T "ARTIST=%A" -T "TITLE=%T" -T "COPYRIGHT=%C" -T "COMMENT=%D" %I -o %O

Here, you've set a fixed date with -T "DATE=2006" (which will have to be updated annually, of course), a fixed album name with -T "ALBUM=My Rockin Sonar Tunes" (which you will want to update as you move from one record to another) and a fixed genre with -T "GENRE=Cliched Heavy Metal Power Ballad" (which will require profound personal evolution and deep self-examination in order to change). Plus, all the automatic tags will be there, too.

NOTE: There is a limit to the number of characters that SONAR can pass to a command-line encoder. If you get an error when trying to encode using the tag settings above, you must either remove some of the tags from the command line, or reduce the length of the text they contain (e.g. a 12 paragraph description in the SONAR Info box would cause the encoding process to fail).

Fine-Tuning FLAC Encoding

FLAC permits a huge number of options in the command line, but the truth is you won't really need them. However, in case you decide to experiment, read the FLAC documentation for more details.

Although FLAC offers 9 levels of compression (0-8, with 0 being the lowest compression and 8 being the highest; audio quality is identical in all cases), the optimal level is 5. Higher than that and you gain only a small increase in compression, at a large processing cost. Lower than that and the level of compression quickly becomes less than ideal. But at the same time, since FLAC is an asymmetric encoder, encoding a FLAC file at higher compression rates takes up more CPU time, but decoding one (e.g. listening to it) does not take appreciably more CPU resources.

Getting FLAC

The main FLAC site, on SourceForge, has everything you need to use FLAC -- the encoder binaries, documentation, a FAQ, and so on.

Listening to FLAC

FLAC is admittedly not the world's most common format for listening, but it's quite easy to do so.

  • Foobar2000 is a free audio player that supports FLAC and a ton of other formats you probably haven't heard of, right out of the box.
  • VLC is a GPU video and audio player that supports FLAC out of the box.
  • Winamp can play FLAC files by installing a simple plug-in.
  • Windows Media Player can play FLAC files by installing either the CoreFlac of Illuminable DirectShow filters.
  • J.River Media Center can play FLAC files using the In_FLAC plug-in.

There are also FLAC plug-ins for many other media players. See here or here (at the bottom of the page) for lists of programs and plug-in links.

Transcoding Into Other Formats

You may want to transcode a file exported from SONAR into another format for any number of reasons -- getting better sound per byte than MP3, getting the same quality as MP3s in a smaller size, archiving mixdowns, and so on. To do this, you need an external codec, either lossy or lossless. These may have built-in graphic interfaces for easy transcoding (drag-and-drop, for example), or they may be command line utilities, with or without a graphical front-end.

Lossy Formats

You can convert a (RIFF) WAV file exported from SONAR using any number of lossy converters.

These include OGG/Vorbis, AAC, Dolby AC3 and Musepack.

WMA gives you the choice between lossy or lossless compression; the lossy compression is roughly comparable to that of MP3 files at equivalent bitrates, and the same caveats for the MP3 format apply to WMA lossy compression.

Comparisons of lossy codecs are available here, here and here.

Lossless Formats

Assuming you wish to keep archival (lossless) copies of your mixdowns, but want to use a minimum of space, you have the option of converting RIFF WAV files to a compressed lossless format (as well as exporting directly), which can provide a considerably smaller file than the source WAV, while retaining 100% of the audio information in the recording, unlike MP3 or WAV lossless files. FLAC also provides file integrity information through frame CRCs and MD5 signatures.

One of the most popular lossless encoders is the open source FLAC. FLAC is available for most every operating system around, and in addition to providing substantial lossless compression, it is also directly playable on a growing number of home and car stereos, portable music players, and software music players. Furthermore, it is streamable and seekable. Some find it to be the ideal compromise solution for digitizing their CD collection, providing perfect playback while taking up less space than WAVs (though quite a bit more than MP3s).

FLAC files can be converted back into WAV files that are bit-for-bit identical to the source WAV using the command line encoder (which is also a decoder, tester and analyzer), various front ends, or the built-in file converter functions of some software players, such as Foobar2000.

The FLAC command-line encoder can be downloaded from the FLAC homepage. A large number of graphical front-ends for making FLAC easier to use are available here.

A filter that allows FLAC files to be edited directly in Cool Edit or Adobe Audition can be had here. See above for more details on playing FLAC files (not necessary for archival purposes, but it's pleasing indeed to hear true CD quality sound in a compressed format).

Other lossless codecs are Monkey's Audio, WavPack and WMA Lossless.

Comparisons of FLAC and other lossless codecs can be found here, here, here and here.

SMS 14:02, 15 September 2006 (EDT)




Home Page * Getting Started * Workflow * Tips, Techniques and Tutorials * Errors and Workarounds * Making Music * Composing, Arranging & Songwriting * Optimizing Your DAW * Recording Gear * Included Components * Third-Party Effects * Third-Party Virtual Instruments * Computer Systems and Components * Free Downloads * External SONAR resources
































Personal tools