Skip to content

Instantly share code, notes, and snippets.

@micsthepick
Forked from SteveALee/README.md
Created August 5, 2021 00:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save micsthepick/2dc93a52c6e1d612b013b068af182d44 to your computer and use it in GitHub Desktop.
Save micsthepick/2dc93a52c6e1d612b013b068af182d44 to your computer and use it in GitHub Desktop.
Build audacity with ASIO support on Windows

Build your own Audacity with ASIO driver support

UPDATE 2021-07-5: If you are concerned about Audacity's use of your personal information after the confusing messaging about telementry then you probably do not need to be. Note especially, “The current version (3.0.2) does not support data collection [of] any data of any kind and has no networking features enabled”. In addition, the script provided here only uses the public Audacity source code, with no changes.

UPDATE: This builds Audacity 3.0.2. Audacity 3.0.0 introduced a new project file format so you will hit compatability problems if you use Audacity 2.x.x to open projects saved with this version.

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 are using digital audio or music equipment that only comes with ASIO drivers, such as Behringer mixers (which actually use the ASIO4ALL ASIO <> WDM bridging driver). Another common reason is to take advantage of the low latency or multiple channels supported by ASIO.

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

To reduce this requirement, the instructions provided here make it easy to build your own version of Audacity with ASIO support on a Windows PC. The instructions for the few manual steps should be straight forward to follow, and use a command script that does all the work for you.

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.

Unfortunately, it turns out the Audacity ASIO build has limited multi channel support. For example, the peak meters always show channels 1 & 2 and to record channels 3 & 4 requires recording 1, 2, 3 & 4. So While Audacity still works really well for simple recording tasks, you might want to eventually switch to a full DAW with AISO support. I'll probably use Reaper.

Here's a brief blog post explaining why I needed ASIO and it includes a screen shot.

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

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

This (slightly out of date) video by @Renamesk walks you through the process.

  • ensure you have a PC with modern Windows installed. 10 is known to work but 7 and 8 should too.
  • 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
  • install the following (the script prompts if you have not done so when it runs):
    • "Git For Windows" - click the "download" button.
    • "Cmake" - download dialog will appear
    • "Visual Studio Community 2017" - download dialog will appear after a delay. Be sure to select the desktop development with C++ option or else you will later see errors nmake is not found. image Close VS GUI if it opens (no need to sign in)
    • Python - download dialog will appear
    • "Steinberg ASIO SDK" - select the SDK link. Right click zipfile, "expand all" to C:\projects and then rename the asiosdk_2.3.3_2019-06-14 folder to asiosdk
  • close all cmd or terminal windows including git for windows. Otherwise you may later see errors
  • open a new Windows cmd terminal (Windows + R keys and then type cmd)
  • type cd \projects and enter key
  • run build script by typing build-audacity.cmd and enter.
  • come back later - it will take at least 10 minutes (all the yellow warnings can be ignored)
  • 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.

@echo off
rem See https://wiki.audacityteam.org/wiki/Building_On_Windows
rem Build audacity with ASIO support on Windows
rem
rem --clean - remove fetched and built files
rem --noget - don't fetch again from git
rem
rem MIT licence
rem steve@opendirective.com
set AUDACITY_REL=3.0.2
set PROJROOT=C:\projects
set WXWIN=%PROJROOT%\wxWidgets
set AUDACITY=%PROJROOT%\audacity
set ASIOSDK_DIR=%PROJROOT%\asiosdk
set AUDACITY_BUILD=%AUDACITY%\win
if (%AUDACITY_REL%) == (2.4.1) set EXEDIR=%AUDACITY_BUILD%\Release
if not (%AUDACITY_REL%) == (2.4.1) set EXEDIR=%AUDACITY_BUILD%\bin\Release
set CMAKE="C:\Program Files\cmake\bin\cmake.exe"
if /I not (%~dp0) == (%PROJROOT%\) (
echo Error: This script must be run in %PROJROOT%
if not exist %PROJROOT% (
echo Create %PROJROOT
goto exit
) ELSE (
echo cd to %PROJROOT%
goto exit
)
)
Rem Clean if requested
if /I (%1) == (--clean) echo Cleaning && rmdir /s/q %WXWIN% %AUDACITY% 2> :null
rem Check tools are installed
if not exist "C:\Program Files\git\cmd\git.exe" echo Error: Install Git for Windows. Choose the option "Git from the command line" && goto exit /b
if not exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" echo Error: Install Visual Studio 2017 && goto exit /b
if not (%AUDACITY_REL%) == (2.4.1) if not exist %CMAKE% echo Cmake does not appear to be installed && goto exit /b
if not exist %ASIOSDK_DIR%\readme.txt echo Error: Get ASIO SDK from http://www.steinberg.net/en/company/developers.html and unzip it to %ASIOSDK_DIR% && echo NB: Rename folder to remove version && goto exit
if not (%VisualStudioVersion%)==(15.0) call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
echo.
echo Building Audacity %AUDACITY_REL% with ASIO support
echo.
rem Get source code
if /I NOT (%1) == (--noget) (
git clone --depth 1 --recurse-submodules https://github.com/audacity/wxWidgets/
if ERRORLEVEL 1 echo Error: cannot checkout. Perhaps delete %WXWIN% && goto exit
if not exist %WXWIN%\wx-config.in echo Something is wrong with %WXWIN% files && goto exit
git clone -b Audacity-%AUDACITY_REL% --depth 1 https://github.com/audacity/audacity/
if ERRORLEVEL 1 echo Error: cannot checkout. Perhaps delete %AUDACITY% && goto exit
if not exist %AUDACITY%\CMakeLists.txt echo Something is wrong with %AUDACITY% files && goto exit
)
Rem Build
cd %WXWIN%\build\msw
rem The following is mentioned in the docs but seems irrelevent for MSVC
copy %WXWIN%\include\wx\msw\setup0.h %WXWIN%\include\wx\msw\setup.h
nmake /f makefile.vc BUILD=release SHARED=1
if ERRORLEVEL 1 echo Error: cannot build wxWidgets && goto exit
cd %AUDACITY%
if not (%AUDACITY_REL%) == (2.4.1) %CMAKE% -S . -B %AUDACITY_BUILD% && if ERRORLEVEL 1 echo Error: Cannot create Audacity buildfiles && goto exit
cd %AUDACITY_BUILD%
msbuild audacity.sln -t:Audacity -p:configuration=Release
if ERRORLEVEL 1 echo Error: cannot build Audacity && goto exit
rem install wx dlls
if (%AUDACITY_REL%) == (2.4.1) copy /Y %WXWIN%\lib\vc_dll\wx*_custom.dll %EXEDIR%
if (%AUDACITY_REL%) == (2.4.1) if ERRORLEVEL 1 echo Error: cannot copy dlls && goto exit
cd %PROJROOT%
rem All done
echo.
echo Build successfull
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.
start %EXEDIR%\audacity.exe
:exit
cd %PROJROOT%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment