Sonar MP3 Encoding with LAME

LAMEIf you want to export MP3s with Sonar, and don’t want to pay $19 for the Cakewalk encoder (or it doesn’t work on your system), there is a free encoder called LAME that can be integrated into Sonar. This tutorial will show you how to configure Sonar to encode MP3s with LAME.

First you need to Download LAME. I chose the latest stable version. I would not recommend using an alpha or beta version, since they may not be as stable.

Open the ZIP file and copy lame_enc.dll and lame.exe into a folder on your hard drive. It can be anywhere. I chose C:\Program Files (x86)\LAME – if you’re not running a 64-bit version of Windows, you might choose C:\Program Files\LAME.

Next you have to configure Sonar to use LAME. For Sonar versions 3 through 5, look in the Tools > Cakewalk Ext. Encoder Config menu. For Sonar 6 (and probably 7), you’ll have to find the program on your hard drive. Mine was in C:\Program Files\Cakewalk\Shared Utilities.

Encoder Config

Run this program and fill out the screen to configure the LAME encoder. For Friendly Name you can choose anything you want. I chose to call mine “LAME 192 Kbps.” In Description I wrote “LAME MP3 Encoder 192 Kbps.” Change Extension to “.mp3″ and uncheck the Keep Wave File option.

In the Path field, find or type in the name of the folder where you installed LAME.

In the Command Line field, you need to put the LAME options. To make a 192 Kbps Joint Stereo MP3, I used the following options. (There’s more about options at the bottom of this article).

lame -b 192 -m j %I %O

Choose Save and then Close.

LAME Configuration

Now Sonar should be ready to encode MP3s with LAME. To test it out, open Sonar and find a project. Go to the File > Export > Audio menu like you would for an ordinary mixdown. Make sure you mix down to a 16 bit file – this is very important, since LAME can only handle 16-bit WAV files.

In the Files of Type selection, choose the Friendly Name that you made above. Now you can click Export and Sonar will first mix down your project, and then send it to LAME for encoding. You’ll see a little window pop up where you can watch LAME’s progress.

LAME Export
Click to enlarge

LAME Options

By changing the Command Line field in the External Encoder Configuration, you can change the type of file that LAME produces. The “%I %O” options set up the input and output files so LAME can work with Sonar. You should leave these alone, and make sure they’re always at the end of the command line.

You can read more about the options here. If you just want some useful settings, try these:

lame -b 128 -m j %I %O – Produces a 128 Kbps joint-stereo MP3. (Change the 128 to whatever bitrate you want).

lame --preset 200 %I %O – Produces an MP3 with an average bitrate of around 200 Kbps.

lame -V2 %I %O – Produces a variable bitrate (VBR) MP3 with a “quality” of 2. Quality can be between 0 (highest) and 9 (lowest).

74 comments

74 Comments so far

  1. Witch Wyzwurd November 26th, 2007 1:12 pm

    I am using Sonar 6. I was upset when discovering that I spent a few hundred dollars, but had to pay extra for a simple mp3 encoder. So I am glad I found your lesson and suggestion about LAME. I downloaded the .exe and .dll files for “LAME 7 final” from the site connected to the link you provided… thanks. I filled out the Sonar box exactly as you described, but when I click the “Save” button, all that happens is my “friendly name” erases. If I click close and check the export menu in Sonar under the types menu, my name doesn’t appear (probably because it erases everytime). I even went as far as to check if the “Delete” and “Save” buttons were tangled up somehow, but that’s not it either. Is this some trick that Sonar uses to make a user buy their encoder? Why is this happening?

  2. Dave December 12th, 2007 12:50 am

    I don’t know what is happening on your system. I do know that it works on mine, so I don’t think it’s an evil Cakewalk conspiracy. Have you tried clicking the “New” button and starting over?

  3. Todd February 26th, 2008 5:29 pm

    Yeah I am having the same problem. I input all of the info, but get nothing when I try to pull it up in Sonar6. :(

  4. Raymund March 23rd, 2008 2:18 pm

    I tried this and I everything went well. I’ve been trying to find a way to encode directly to mp3 as I find it unreasonable to charge the customers who pay hundreds for the app an extra $20.00 for a small utility. Thank you so much for this tutorial…

  5. Smiler April 21st, 2008 12:53 pm

    Thanks for this – i have been looking for an mp3 decoder for Sonar for a while. I know have reasonably sized files to stick on the internet.

  6. Jeroni June 4th, 2008 8:01 am

    Thanks for this encoder. I’m using Sonar 4, and found your solution just when I was quite near buying the cakewalk encoder…
    I installed it following your instructions and it worked!!!!
    Thanks again!

  7. jack c. June 7th, 2008 1:37 pm

    hey mate:i’m using sonar 6 and want to export using lame mp3.did the following:
    1. In Sonar, choose Tools -> Cakewalk Ext. Encoder Config.
    2. In the Friendly Name Field type Lame MP3 Encoder.
    3. In the Extension field type .mp3
    4. You can put whatever you want in the Description field to comment on this configuration of Lame.
    5. Leave the Path field set to C:\Program Files\Cakewalk\Shared Utilities
    6. In the Command Line field type lame -b 192 -m j %I %O
    7. Press the Save button at the top of the box.
    8. Click Close.

    When exporting, choose Lame MP3 Encoder.

    now the following comes up
    unable to launch lamp mp3 encoder “Warning: The external encoder returned an error code. the file may not have encoded properly
    how to fix this?
    thanks,
    jack

  8. Dave June 10th, 2008 9:34 am

    My guess is that you need to change the “Path” setting to the folder where you installed LAME.

  9. Keith June 20th, 2008 6:52 am

    Hi I’m using Sonar 7, went through everything like you said but it still says I need to download the mp3 encoder from Cakewalk?

  10. Keith June 20th, 2008 6:55 am

    Sorry my mistake, I never realised you put a screenshot so I hadn’t selected the LAME format. Works perfectly, thanks a lot!

  11. andy June 21st, 2008 2:00 am

    For those of you having problems with the name disappearing after clicking “Save”, if you’re using Windows Vista, make sure that you run EncoderConfig as administrator. You can do this by right-clicking on encoderconfig.exe, then select Run as administrator.

  12. VM July 10th, 2008 2:20 am

    Hi. I have Sonar 5 that can import mp3 files (on XP Professional) but my newer Sonar 7 (on XP Profession x64 Edition) will not import mp3 files (using the cakewalk encoder).
    Will the lame encoder allow me to import mp3 files in Sonar 7 on the XP x64 computer??

    Thanks

  13. VM July 10th, 2008 2:21 am

    ps Sonar 7 (with cakewalk encoder) will import mp3 files om my Vista laptop

  14. Dave July 10th, 2008 10:27 am

    The LAME encoder just encodes on export. I haven’t found a way to import MP3 files on x64 – I have never really needed to do that, so I haven’t spent a lot of time on it.

  15. Inguar October 7th, 2008 7:59 pm

    Yeah man, works fine in 7!
    Thanks a lot.
    I adore Sonar 7, moved from Cubase but this ‘license’ thing is just ridiculous. Aren’t we in 21 century already???

    Good luck!

  16. Marcus November 2nd, 2008 8:38 pm

    Hello,

    everything seems fine, your instructions are very easy, so thanks. I’m having a problem though. When I actually go to export it says: “Mix Down Aborted: Unspecified error”. Any ideas? I know there’s not much to go on. Any body else had this obscure problem?

    Thanks again,

    Marcus

  17. Dave November 3rd, 2008 8:26 am

    Sorry, Marcus. I’ve never seen that. If the error is from within Sonar, you might try Cakewalk support.

  18. mike November 11th, 2008 8:00 pm

    worked for me on sonar 6. i’m grateful. (after being frustrated by cakewalk).

  19. Tony Jones November 17th, 2008 3:55 pm

    Works PERFECTLY for me using Tools/Cakewalk Encoding in Sonar 7.
    I strap Waves LL-16 over my Master Channel to give me a Mastered output & now I can push that straight to mp3.
    Hoorah!

  20. david December 7th, 2008 9:11 pm

    does not format to mp2 for me.
    just saves as a wav file

  21. david December 7th, 2008 9:12 pm

    try that again

    does not format as mp3 file
    just as a wav file

    (sheesh)(my email was wrong too)

  22. david December 7th, 2008 9:28 pm

    k nvm – forgot to choose file type as Lame 192
    my bad.
    Now I get a “external encoder returned an error code”
    any advice on this issue?

  23. chris December 23rd, 2008 10:10 am

    thank you SO MUCH for this tutorial. =)

  24. Kaker January 29th, 2009 8:50 pm

    I asked about the mp3 encoder in SONAR & found out that its because of a licensing agreement with the maker of the mp3 encoder. Cakewalk doesn’t make it, freunhoffer does and they require a license everytime a version is sold. Therefore they can NOT just put it into the app nor can they give it away. Most peeps that use SONAR don’t even use mp3 but some do… For these few it’s available for purchase, but is required to be that way by the maker (Fraunhoffer) and NOT Cakewalk. I’ve checked into it and found out that this is indeed true.

  25. Gaulty February 4th, 2009 9:17 am

    This screenshot tutorial worked a treat for Sonar 6 Studio. Just followed the instructions. Many thanks.

  26. Franko February 13th, 2009 5:08 pm

    Worked great in sonar 7 – Must remember to select lame mp3 as the encoder when you choose export audio, if you have just mp3 selected you will get the cakewalk popup telling you to buy an encoder. Thanks for posting this fix by the way!!!

  27. Griffin April 15th, 2009 2:33 pm

    Works great with sonar 7 on vista…. Thank you

  28. Isai May 14th, 2009 3:48 pm

    Okay well i think i understand the instructions but cant find the encoder configuration. I checked in tools and the directories. Is there anyway i can download the configuration tool???
    Any help would be greatly appreciated.

  29. Dave May 14th, 2009 7:14 pm

    Isai, what version of Sonar do you have?

  30. Isai May 14th, 2009 7:22 pm

    I have sonar 3 Producer Edition.

  31. Dave May 14th, 2009 7:42 pm

    I don’t have Sonar 3 to try it out, but everything I’ve read indicates it is in the Tools menu inside Sonar. If that doesn’t work, you might try opening your install CD in windows explorer, opening the Utilities folder, and then looking in the External Encoder Profiles folder.

  32. Isai May 14th, 2009 8:03 pm

    ok well since this isnt my computer ill have to check that cd. Well it sounds like this might be my answer so thank-you. Ill report back if i find the answer.

  33. FL 8 xxl + Sonar 8 producer June 1st, 2009 12:58 pm

    im new to sonar,i was/am using fl to make beats,but i decided to get some better stuff and to bad it didn`t came with a mp3 encoder.
    thanks for helping people like me out afters spending allot of money on sonar 8.why does sonar/cakewalk dont have the mp3 encoder ?
    i meen fl does and u can buy the fl producer version for the half as u pay for sonar but nvm thanks to u and the free lame encoder!

    peace

  34. BJay June 18th, 2009 8:52 am

    I upgraded to Sonar 8, and exporting mp3s seems to work fine with lame and built in encoder, but problem I’m having is that imported mp3′s keeping being imported in mono.
    .Wav files are fine. Am I missing a setting somewhere? I don’t get any options after I’ve done import/audio and selected file etc – but whatever I do I keep getting a sinlgle mono file on one track – can anyone help?
    Thanks.

  35. Jefzilla July 4th, 2009 10:41 am

    Hi…I’m using Sonar 7, installed & configured as you stated, it encodes, but when I play the MP3 file back in Winamp, it plays really slow; like playing a cassette tape on a boom box with dying batteries. Any ideas?

  36. Dave July 8th, 2009 11:54 am

    I’ve not experienced that.. are you sure you set it to mix down to a 16-bit WAV file?

  37. gaby July 29th, 2009 12:23 am

    can someone help me! i’m using sonar 3 and i’m not finding a solution for the mp3 encoder, it is asking for a key generator!!
    gabyloutfi@hotmail.com

  38. Fred September 1st, 2009 11:25 am

    Worked great here with SONAR 8 Studio Edition.

    Thank you!

  39. cdig September 23rd, 2009 7:41 am

    Hello
    I’m using Sonar 8 on windows xp and vista on different computers
    I can export mp3 files fine, but when trying to import them, the line at the bottom goes by really fast, and no file is imported…I’ve checked all settings and nothing seems to work
    Any suggestions?
    Thanx

  40. Aaron Bewza October 2nd, 2009 1:17 pm

    Hey everyone, I’ve built the solution to the LAMEmp3 encoder problem… it’s called “Aaron’s Sonar MP3 Encoder Patch v2″ and if you Google that, you’ll find it in .torrent form, totally free.
    “Problem?” you may ask. Yes! By using the external encoder config utility inside Sonar (to hook up the LAME Mp3 encoder), we are limiting ourselves to ONE bitrate option to export our MP3s in. To use another bitrate (128kbps, or 320kbps, or whatever you want to change it to) we then need to open the config tool and reset the bitrate. It’s a real pain.
    The solution? use my encoder patch. You can use the 64-bit or the 32-bit version, depending on your system… and it puts options for different bitrates onto Sonar’s “Export Audio” menu! for instant exporting at the bitrates you select.
    If you have any questions about how it works and what it does, or if you’d like this patch sent to you directly, please email me at blackwidowfarms@hotmail.com
    …or contact me through one of my websites:
    http://www.AaronBewzaMusic.com or
    http://www.BlackWidowFarms.net

    Thanks for your time and I’m glad I can be of assistance.

    Aaron Bewza

  41. Aaron Bewza October 2nd, 2009 1:20 pm

    Did I mention that I’ve built BOTH the 32-bit AND 64-bit versions of LAME into this patch? Sonar x64 users: you can verify LAME operates in true 64-bit with your task manager, watach your process list right after exporting your audio (when Lame takes over and converts to your desired bitrate).
    Remember to spread the word, and feedback is ALWAYS welcome, otherwise I won’t be able to improve this patch for version 3. I wouldn’t dare charge a penny for this patch, so if you find it elsewhere and they want money for it, they are liars and not honest at all.
    Aaron

  42. Jorgen October 6th, 2009 3:14 am

    Doesnt work. Same problem as many ppl here. Cant save my changes at “LAME”. Just appears

  43. BlackAngel October 21st, 2009 8:40 am

    1- Put LAME into C:\LAME (last stable from http://www.free-codecs.com/Lame_Encoder_download.htm)

    2- create a txt file and write this in:

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\CakewalkExtAudioEncoders\{495EA31D-8614-42FE-9625-F25E394ED6E7}]
    “Name”=”LAME MP3 Encoder”
    “Description”=”LAME MP3 Medium Quality Joint Stereo”
    “Path”=”C:\\LAME”
    “Extension”=”.mp3″
    “CommandLine”=”lame -b 128 -m j %I %O”
    “InProcess”=dword:00000000
    “KeepWaveFile”=dword:00000000

    3- Save the file and change extention to .reg

    (if you can’t see the file extention goto (in any folder): tools->Folder Options->View
    And un-check the box “Hide extention for known file types” … you can now view and change file extentions)

    Now just duble-click the .reg file and add the info to regedit… Start up your sonar and just export your files ;)

  44. erik October 23rd, 2009 7:35 am

    Black Angel: I tried to setup your methode..
    but now when I go to Audio Export, sonar LE is shutting down and also my Cakewalk External Encoder Config isn’t working anymore.

    Please help.

    How to undo this installation?

  45. erik October 23rd, 2009 8:29 am

    Black angel: I delete the whole folder in regedit.
    problem solved

  46. Dante Leveritte November 7th, 2009 12:28 pm

    WOOO!!! it Worked at first i thought this was just a scam or lost cause. but actually reading everybody elses problems contributed to the fixing of my own. AND it worked! lol and i had just purchased that unessasarly expensive Cakewalk encoder yesterday. im pretty sure you kno what im about to do now….CANCLE THAT ORDER AND GET SOME MONEY BACK! it doesnt work anyway! haha
    Thanx so much

  47. Aaron Bewza November 8th, 2009 1:03 pm

    @ Jorgen: it DOES work, did you uninstall your existing LAME before trying the patch? you would be the only person so far that the Sonar patch does not work with. you know those things you are trying with these other methods? its the same thing but made super easy. Jorgen before you simply discredit the patch, ask for some help because it works like a charm. email me for version 2.1 of the patch and I can help you make sure its working. I’m at blackwidowfarms (at) hotmail.com ok talk to you later :)
    Aaron

  48. Mike December 9th, 2009 11:32 pm

    Seriously dude, you saved my company about $200 for all my voice talent who I got the software for. I did not find it acceptable that they were charging and was actually looking for a free mp3 encoder to use AFTER the recording, but you just eliminated an extra step.

    Want a job in radio production? LOL

  49. Widya January 31st, 2010 7:33 am

    Thank you for sharing…its nice…and its work in Sonar 4.0.2

  50. eeep February 23rd, 2010 8:16 pm

    I did the suggestion by Blackangel…which I probably shouldn’t have. I get an error message and when I try to export. I’ve uninstalled and reinstalled and nothing!

    I’m a bit scared I’ve gone and messed it up for good. So no one else do what he did please, and if you did, can you please tell me how to fix it?!

  51. Gary Bradley April 8th, 2010 3:07 pm

    Excellent tutorial. I know of lame from linux audio work but was a bit stumped with Sonar. Thank you.

    Gary

  52. Ron K April 19th, 2010 2:10 pm

    Thanks for the tutorial!
    I tried to do all the above steps, but when I play back the MP3 file, it’s static! Any idea what settings I’m missing? THANKS!

  53. Dave April 19th, 2010 2:45 pm

    Make sure you export at 16-bit!

  54. Ron K April 19th, 2010 2:48 pm

    Wow. I’m an idiot. Thanks! That cleared it up! Works great now!

  55. Patrik May 12th, 2010 8:55 am

    I found the solution to the error message “Warning: The external encoder returned an error code. the file may not have encoded properly.”

    I simply missed to make a blank space between %I and %O in the command line.

    Right way:
    lame -b 192 -m j %I %O

    Wrong way:
    lame -b 192 -m j %I%O

  56. Ivan Ferrer May 21st, 2010 8:32 pm

    Thanks a lot for the trick.

  57. Addicus July 18th, 2010 2:47 pm

    Aaron Bewza October 2nd, 2009 1:17 pm

    This guy’s method is freaking awesome. The other way works also, but like he says in his post it doesn’t give us the ability to use different bit rates while he does. Also if you plan on using the method described in the original posts and have not been able to have it take, make sure to run the EncoderConfig as administrator as stated by:

    andy June 21st, 2008 2:00 am.

    Thanks for all your assistance guys.

  58. Walter de Jong July 24th, 2010 5:28 pm

    Just want to add my thanks. Well done. Appreciate your efforts.

  59. veljo July 30th, 2010 5:19 am

    I managed to solve “Warning: The external encoder returned an error code. the file may not have encoded properly” problem by NOT using the –tt and –ta (title and artist) tags.

  60. Jerry August 9th, 2010 5:47 pm

    Thanx Dave. It works like a clock in my Sonar 7. Very Good understandable instructions!

  61. Junx October 13th, 2010 12:10 am

    thank you so very much the snap shots made this a breeze again THNAK MAAAAAAANnnnnn…..

  62. Prabhu Dwaram November 15th, 2010 8:24 pm

    Hey,
    I use Sonar LE and IT WORKED. While exporting, Sonar automatically puts an extension *.mp3 in the place where you type in file name. Just delete the *.mp3 while exporting.

  63. Saif November 27th, 2010 11:09 am

    For those who are getting the error message,
    “Warning: The external encoder returned an error code. the file may not have encoded properly”

    One of the reason could be %I and %O typed in small letters. The command line switches %I and %O should be in CAPITAL LETTERS.
    lame -b 192 -m j %I %O
    (lame -b 192 -m j %i %o will give the above warning and does not produce Mp3 file)
    Hope this helps to someone.

  64. Drew January 24th, 2011 10:22 pm

    Thank You! Works great. I actually paid for the other one and then lost it when I reloaded Sonar 6.

  65. PAF January 26th, 2011 5:14 pm

    Contrary to what Aaron says above, you can give yourself multiple easily selectable bitrate options by clicking the ‘new’ button (shown in the screenshot right at the top) and creating a new friendly name and matching set of lame command line switches for each option you need.

    Each time you hit ‘new’, a new registry key matching the format shown by Blackangel above is created. This is how both the setup utility and Sonar ‘remember’ the settings.

    Given the existence of the encoder setup utility and that messing with the registry isnt generally recommended, you shouldnt need to use .reg files unless you want to quickly transfer settings to a new machine.

    If you must (!!) click start=>run=> and type regedit. Browse to and select [HKEY_CLASSES_ROOT]\CakewalkExtAudioEncoders\ then click file=>export. This creates a .reg file which is actually just text. *.reg files are blocked by security programs, so they are best communicated as text (rename to *.txt). Renaming the file back to *.reg and double-clicking it on a target machine will add matching data to its registry and hence all your MP3 export options to Sonar.

  66. Jaylay January 30th, 2011 5:33 pm

    hi i am using sonar 7 home edition and i cant find the shared utilites or external encoder anywhere

  67. JP Baker February 1st, 2011 4:34 am

    Thank you all for the information on getting this up and running, It is information like this that inspires us all. Im using Vista 32/Sonar 7, and like others had a few problems getting this to work, but I did. Here’s my insight (from my install):

    1) Do not copy and paste the information from the tutorial , type it into EncoderConfig.exe manually. This is because of unicode characters in the web page. Windows hates unicode . This was my first issue, and I solved it by typing the info in.

    2)Make sure that the audio that you are exporting is set to 16 bit depth. 24, 32, and 64 bit depth do not export on my setup but 16 bit exports in all of the settings. I suspect that this is a limitation of mp3 itself as other exporter/convertors want 16 bit as well.

    Hope this info helps any who are still stuck.

  68. Dude February 17th, 2011 7:36 pm

    Run the encoder config as administrator if you are in Windows 7, otherwise it will not save the lame setup.

  69. Aaron Bewza April 15th, 2011 2:15 am

    Aaron’s Sonar Patch v5.2

    It’s got a cool easy-to-use interface and it works perfectly with Sonar X1 and all previous versions of Sonar. It adds ALL available mp3 options (44 separate options) directly into Sonar’s “Export Audio” menu, and uses Lame v3.98.4 as the encoder engines. Both 32 and 64-bit encoders are included, the correct one is automatically used.
    It is 100% free, no strings ever. I could not afford my website this year, but you can email me for a copy:

    blackwidowfarms (at) hotmail.com

    I’m glad to be able to provide this patch for the audio community… cheers!
    Aaron Bewza

  70. Aaron Bewza April 15th, 2011 2:17 am

    ….or look me up on the Cakewalk Forums, look for more information about the patch in the developer’s section.

  71. Kyle June 18th, 2011 10:06 pm

    This tutorial was impossibly helpful. Thank you very much. This will save everyone 20 dollars that they don’t need to spend.

    *NOTE* FOR VISTA AND WINDOWS 7 USERS YOU MUST RUN THE ENCODER CONFIG AS ADMINISTRATOR FOR THE CHANGES TO TAKE EFFECT!

  72. Gomek August 9th, 2011 2:34 pm

    Worked for me, instructions were very straight forward, thanks.

  73. David September 9th, 2011 1:29 am

    Just installed as per instructions with Sonar 8. Works seamlessly. Cheers.

  74. GregOdrums January 20th, 2012 4:29 am

    Thanks a heap – worked straight up in Sonar X1. Have your next beer on me! Cheers!

Leave a reply