Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Build audacity with ASIO support on Windows

Build your own Audacity for Windows with ASIO driver support

Due to licensing restrictions the Audacity team cannot provide a prebuilt version with Windows ASIO driver support. But with this guide and script you can easily build your own Audacity 3.2.3.

Drivers are the glue between an audio program like Audacity and external hardware like a mixer or sound interface. The drivers usually used on Windows have limitations which can be overcome if you have ASIO drivers for your hardware. Specifically, low latency (delay) and multi channel support are available with ASIO drivers.

The Audacity program is the "go to" solution for many audio recording and editing tasks. However, unlike many more advanced DAWs, it doesn't support Windows ASIO drivers "out of the box". Fortunately, Audiacity's standard MME support is fine for most uses. That said, common reasons for needing ASIO include using digital audio or music equipment that only comes with ASIO drivers, such as Behringer mixers (which actually use the less efficient ASIO4ALL ASIO <> WDM bridging driver). Another common reason is to take advantage of the low latency or multiple channels supported by ASIO. Note that Audacity really is not a good multichannel solution, so if that is required a DAW might be a better bet.

While it is possible to build your own Audacity with ASIO support by following the instructions this usually requires considerable technical skills.

But have no fear, the instructions and script provided here make it easy to build your own version of Audacity with ASIO support. You just need a suitable Windows PC. The script checks all required tools are installed and builds a 64 bit release version of Audacity for you using the official build instructions.

NB. If you do use this to build Audacity with ASIO support you must not redistribute it due to the ASIO SDK licensing terms - see below.

Here's a brief blog post explaining why I needed ASIO and it includes a screen shot. But note, since writing that, I discovered my McMillen K-Mix digital interface mixer facilities alow routing of inputs 3 & 4 to the main outputs on 1 and 2 so can use the default MME Audacity build after all. For playback from PC, I found the HiFi Driver and ASIO Bridge from VB Audio lets me re-route PC audio out to channels 3 & 4 on the K-Mix, Leaving Channels 1 & 2 free for instruments and Mics.

Licensing

The reason for Audacity's lack of ASIO support is licensing, not technical. Steinberg do not alow the ASIO SDK to be redistributed (as required by open source projects). In addition, Audacity is GPL licensed and so is incompatible with the ASIO SDK licence redistribution rules.

Detailed instructions

If you'd rather not impact your PC by installing everything described here you can install VirtualBox and use a Microsoft supplied Virtual Machine image as explained here.

Note for developers: These instructions assume a clean PC with no dev tools. If you have existing tools you may hit errors due to differing versions. Perhaps use a VM (difficult with Windows licencing) or a Windows container.

This video by @Renamesk walks you through the process, but the tool installation method has changed.

  • ensure you have a PC with modern Windows installed. 11 and 10 are known to work but 7 and 8 should too.
  • install "Git For Windows" - click the "download" button.
  • make a new folder C:\projects
  • click on the 'raw' button at the top of the script (below) in this Gist.
  • use the browser Save As feature to save the script as \projects\build-audacity.cmd (be careful there's no ".txt")
  • open a new Windows cmd terminal (Windows + R keys and then type cmd)
  • type cd \projects and enter key
  • install required tools by typing build-audacity.cmd --install and enter.
    • NB for Visual Studio, make sure you check the "desktop development with C++" workload
    • if you have a non English Windows or Visual Studio then you must also install the VS English language pack.
  • when the install completes open a new cmd terminal and start the build by typing build-audacity.cmd and enter.
  • come back later - it will take at least 10 minutes
  • Audactiy will be launched to test it was built correctly
    • to it run again see the program location printed out at the end of the build
    • or copy the specified folder to where you want to run Audacity from, optionally renaming it

If you have any ASIO drivers installed you should find ASIO is now available in the the Audacity driver selection combo box.

When things go wrong

As with any complex software build there are many moving parts (including Windows itself) and things can sometimes go wrong. Here are some tips if you hit build errors.

  • make sure you have latest script
  • run the script with --cleanall and try again
  • uninstall all the tools (Python, cmake, Visual Studio and its installer) and then reboot before trying again
    • note having other versions of any of the tools installed may well cause problems - remove them
  • read the error output - clues are often buried in reams of impenetrable text
  • disable any Anti Virus - the built-in Microsoft one is usually not a problem

Thanks

  • @diogodh for finding and fixing the bug with conan installations
  • The Audacity team for an fantastic audio tool.
@echo off
rem Build audacity with ASIO support on Windows
rem See the following gist for details
rem https://gist.github.com/SteveALee/da24c2be633340b8791066dd98eb5d0b
rem
rem Options (only one may be specified)
rem
rem --install - install tools
rem --clean - remove built files
rem --cleanall - remove fetched and built files
rem --getonly - only get the files
rem --noget - don't fetch again from git
rem --gui - run cmake-gui
rem
rem MIT licence
rem steve@opendirective.com
SETLOCAL
set AUDACITY_REL=3.2.3
set VISUALSTUDIOVER=2022\Community
set VISUALSTUDIOCMAKE=Visual Studio 17 2022
set VSDIR=%ProgramFiles%\Microsoft Visual Studio\%VISUALSTUDIOVER%
set PROJROOT=C:\projects
set AUDACITY=%PROJROOT%\audacity
set AUDACITY_BUILD=%PROJROOT%\audacity-asio
set EXEDIR=%AUDACITY_BUILD%\bin\Release
rem check projroot exists
if /I not [%~dp0] == [%PROJROOT%\] (
echo.
echo Error: This script must be run in %PROJROOT% - see %%PROJROOT%% in file
echo.
if not exist %PROJROOT% (
echo Create %PROJROOT
goto exit
) else (
echo cd to %PROJROOT%
goto exit
)
)
if not [%1] == [--install] goto clean
rem Get tools
rem ANSI escape sequences do not work in if () block so we use goto
set cmake-url=https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1-windows-x86_64.msi
set vs2022-url=https://aka.ms/vs/17/release/vs_community.exe
set python-url=https://www.python.org/ftp/python/3.11.1/python-3.11.1-amd64.exe
echo 
echo.
echo Fetching tools..
echo 
mkdir bin 2> :null
curl -L %cmake-url% -o bin\cmake.msi
curl -L %vs2022-url% -o bin\vs.exe
curl -L %python-url% -o bin\python.exe
echo 
echo.
echo Installing tools...
echo.
echo IMPORTANT!! Follow the instructions below for each installer
echo Close each installer when it is done
echo.
echo CMake: make sure you select "add cmake to system PATH"
pause
bin\cmake.msi
echo.
echo Visual Studio: make sure you select the Workload "desktop development with C++"
pause
bin\vs.exe
echo.
echo Python: make sure you select "add python.exe to PATH"
pause
bin\python.exe
echo.
echo This window will now close!
echo Open another "cmd" window (Wnd + R, cmd) and run "%0" again in "\projects" to build Audactity
echo 
echo.
Pause
exit
:clean
if not [%1] == [--getonly] (
if /I [%1] == [--clean] echo Cleaning built files... & rmdir /s/q %AUDACITY_BUILD% 2> :null
if /I [%1] == [--cleanall] echo Cleaning source and built files... & rmdir /s/q %AUDACITY% %AUDACITY_BUILD% 2> :null
if /I [%1] == [--cleanall] where /q conan & if ERRORLEVEL 0 echo Cleaning conan modules... & conan remove -f * 2> :null
)
rem Launch cmake-gui
if [%1]==[--gui] cmake-gui -Daudacity_has_asio_support=On -DAUDACITY_BUILD_LEVEL=2 -S %AUDACITY% -B %AUDACITY_BUILD% & goto build
rem ensure tools are installed
if not [%1] == [--getonly] (
rem NB this sets 64bit arch for cmake
if not exist "%VSDIR%\VC\Auxiliary\Build\vcvars64.bat" echo Error: Install Visual Studio %VISUALSTUDIOVER% & goto exit /b
if not defined VisualStudioVersion call "%VSDIR%\VC\Auxiliary\Build\vcvars64.bat"
where /q cmake & if ERRORLEVEL 1 echo Cmake does not appear to be installed & goto exit /b
where /q conan & if ERRORLEVEL 1 pip install conan & if ERRORLEVEL 1 echo Python does not appear to be installed & goto exit /b
)
rem Get source code
set getsrc=0
if /I [%1] == [] set getsrc=1
if /I [%1] == [--getonly] set getsrc=1
if /I [%1] == [--cleanall] set getsrc=1
if /I not [%1] == [--noget] (
where /q git & if ERRORLEVEL 1 echo Error Install Git for Windows. Choose the option "Git from the command line" && goto exit /b
if [%getsrc%] == [1] (
echo.
echo Fetching code for Audacity %AUDACITY_REL%...
echo.
git clone -b Audacity-%AUDACITY_REL% --depth 1 https://github.com/audacity/audacity/ %AUDACITY%
if ERRORLEVEL 1 echo Error: cannot fetch the Audacity code. Try the --cleanall or --noget options & goto exit
if not exist %AUDACITY%\CMakeLists.txt echo Something is wrong with %AUDACITY% files & goto exit
)
)
if /I [%1] == [--getonly] goto exit
echo.
echo Building Audacity %AUDACITY_REL% 64 bit release with ASIO support...
echo.
cd %AUDACITY%
cmake -G "%VISUALSTUDIOCMAKE%" -DCMAKE_CONFIGURATION_TYPES=Release -Daudacity_has_asio_support=On -DAUDACITY_BUILD_LEVEL=2 -S %AUDACITY% -B %AUDACITY_BUILD% & if ERRORLEVEL 1 echo Error: Cannot create Audacity buildfiles & goto exit
:build
cd %AUDACITY_BUILD%
set msbuild="%VSDIR%\MSBuild\Current\Bin\MsBuild.exe"
%msbuild% audacity.sln -t:Audacity -p:configuration=Release
if ERRORLEVEL 1 echo Error: cannot build Audacity & goto exit
cd %PROJROOT%
rem All done
echo 
echo.
echo Congratulations!
echo Your new Audacity with ASIO support will now launch.
echo In future just run the audacity.exe. No need to install.
echo.
echo %EXEDIR%\audacity.exe
echo.
echo Or copy the folder
echo.
echo %EXEDIR%\
echo.
echo and run the included audacity.exe
echo.
echo 
start %EXEDIR%\audacity.exe
:exit
cd %PROJROOT%
ENDLOCAL
@Chris-C-Bristol
Copy link

Chris-C-Bristol commented Jan 13, 2022 via email

@SteveALee
Copy link
Author

SteveALee commented Jan 13, 2022

Sorry it did work. I really can't think what's going on.

As far as I know ASM is NOT actually used in the successful build

@piretro
Copy link

piretro commented Jan 13, 2022 via email

@Chris-C-Bristol
Copy link

Chris-C-Bristol commented Jan 13, 2022 via email

@SteveALee
Copy link
Author

SteveALee commented Jan 14, 2022

@piretro @Chris-C-Bristol

Disabling VS is an excellent call, as is a reboot after uninstall. Tips won in the long dev fight with Windows no doubt! :)
I stopped using 3rd party AVs after Avast had a memory leak that keep breaking my Firefox builds. I do leave the default Windows one on though. I should probably disable it in folders with code in!

@chris do try the script's --cleanall option as well as that cleans up the conan cache

I'll add a "Problems" section to the notes with all these great tips.

@Chris-C-Bristol
Copy link

Chris-C-Bristol commented Jan 16, 2022 via email

@SteveALee
Copy link
Author

@Chris-C-Bristol

Oh dear. With 10 copies of Python it seems you PCs config is a bit of a mess. The disclaimer for developer PCs applies I'm afraid.

Also your Windows account should be an admin account and run all cmd terminals without administrator privileges.

You could try the official manual Audactity build instructions using the cmake gui. That would eliminate problems due to the script. I doubt that would work either though.

@Chris-C-Bristol
Copy link

Chris-C-Bristol commented Jan 18, 2022 via email

@SteveALee
Copy link
Author

Huzzah! The --install option should have been enough without you needing all those extra hoops. But at least you are going now!

@Chris-C-Bristol
Copy link

Chris-C-Bristol commented Jan 19, 2022 via email

@SteveALee
Copy link
Author

@Chris-C-Bristol Ha ha, don't even breath on it! :-P

@scerazy
Copy link

scerazy commented Jan 29, 2022

Had to install Conan by hand from https://conan.io/downloads.html
Otherwise it errored out that executable is not installed (should be added to the --install section)

@SteveALee
Copy link
Author

@scerazy Thanks for the feedback. That's strange as it does install conan as a python PIP after the primary install
where /q conan & if ERRORLEVEL 1 pip install conan
It worked fine in all my tests after cleaning completely.

I did just spot it's not installed for the GUI option but do not know if that matters or not

I will run some more tests. Thanks again.

@scerazy
Copy link

scerazy commented Feb 2, 2022

And pip version by manual install did not work either, I had to install .exe (hence it would be easier to add that to install section)

@SteveALee
Copy link
Author

Hmm, PIP appeared to be the official way to install. It made a bit of a mess of the script too. Thanks for the suggestion.

@Chris-C-Bristol
Copy link

Chris-C-Bristol commented Feb 2, 2022 via email

@Lubitorus
Copy link

Help! I have followed everything according to the instructions. But it asks me all the time to install Visual Studio 2019\Community, although I have already done this. what could be the problem? The language pack is also in English.

@SteveALee
Copy link
Author

@Lubiorus all I can think of is make sure you open a new command window so it picks up visual studio after it is installed. Also make sure you checked the C++ desktop option in VS as shown in the instructions.

@Lubitorus
Copy link

It finally worked, sorry I'm blind. Thank you <3

@SteveALee
Copy link
Author

What screen reader/ browser do you use? I can try with NVDA.

@Chris-C-Bristol
Copy link

Chris-C-Bristol commented Oct 11, 2022 via email

@SteveALee
Copy link
Author

@Chris-C-Bristol Thanks for that.

Yes it soon gets horribly complicated. That's the reason or my disclaimer about using only a clean machine without previous dev env set up.

@Giermann
Copy link

Thank you very much, @SteveALee !
I used to get Audacity compiled without any fears, but that was years ago... (Audacity 2.0.3).
Now I tried to get the latest 3.2.1 built, because of the new feature "Real-Time effects" - but failed...

I already had VS2017 installed and thought it would be okay - but it wasn't.
After trying several manual ways and tried to modify your script to use VS2017, I finally found that CMake seems to fail to create x64 configs for VS2017.
My last resort was to download and install a more recent Visual Studio and can now report:
Your script still works for Audacity 3.2.1, CMake 3.25.0, Python 3.11.0 and Visual Studio 2022!

If anyone is interested, here is my modified version for easy selecting the versions of all 4 tools on updates in the future:
https://gist.github.com/Giermann/c3f88ee2a147f9a688a2ca76e1334a54

@SteveALee
Copy link
Author

@Giermann hey, congrats and thanks for the heads up that VS 2022 is usable!! That's great to know. This build stuff can be so fragile, which of course is why I created the script in the first place. :D

@haberl333
Copy link

Thanks @SteveALee, your code encouraged me finally to try to build Audacity with Asio support. I always feared to install so much software only to create a program only once on my limited computer. Finally I used a Win11 virtuell machine offered by Microsoft (https://developer.microsoft.com/de-de/windows/downloads/virtual-machines/) using Virtualbox that needs a lot of Gigabytes but includes Visual Studio 2022. In this virtuell machine I only needed to install Git, CMake und Python to run build-audacity.cmd. That worked well for me.

@SteveALee
Copy link
Author

@haberl333 fantastic! That was a great thing to find out and I hope you enjoy it. I did not realise Windows VMs were available, thinking licencing would be a blocker. Those dev VMss are really useful. Using VMs or more recently, containers, are vital if you arexworking on lots of projects and I like how you suggest also keep all those tools from cluttering up you PC. I'll add a note. Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment