├── .github └── FUNDING.yml ├── CPU Table Examples ├── i5 14600k ( 6-12P and 8E cores ) ├── i7 13700k ( 8-16P and 8E cores ) ├── i7 14700k ( 8-16P and 12E cores) ├── i9 14900K ( 8-16P and 16E cores ) └── Generate CPU Table.ps1 ├── LICENSE ├── README.md └── install.bat /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | ko_fi: gobidev 2 | -------------------------------------------------------------------------------- /CPU Table Examples/i5 14600k ( 6-12P and 8E cores ): -------------------------------------------------------------------------------- 1 | :: Affinity table for Intel i5-14600k Processor with Hyperthreading 2 | :: Thread # = Value = BitMask 3 | :: P-Core 1 = 1 = 00000001 4 | :: P-Core 2 = 2 = 00000010 5 | :: P-Core 3 = 4 = 00000100 6 | :: P-Core 4 = 8 = 00001000 7 | :: P-Core 5 = 16 = 00010000 8 | :: P-Core 6 = 32 = 00100000 9 | :: P-Core 1T = 64 = 01000000 10 | :: P-Core 2T = 128 = 10000000 11 | :: P-Core 3T = 256 = 1 00000000 12 | :: P-Core 4T = 512 = 10 00000000 13 | :: P-Core 5T = 1024 = 100 00000000 14 | :: P-Core 6T = 2048 = 1000 00000000 15 | :: E-Core 1 = 4096 = 10000 00000000 16 | :: E-Core 2 = 8192 = 100000 00000000 17 | :: E-Core 3 = 16384 = 1000000 00000000 18 | :: E-Core 4 = 32768 = 10000000 00000000 19 | :: E-Core 5 = 65536 = 1000000000 00000000 20 | :: E-Core 6 = 131072 = 10000000000 00000000 21 | :: E-Core 7 = 262144 = 100000000000 00000000 22 | :: E-Core 8 = 524288 = 1000000000000 00000000 23 | 24 | -------------------------------------------------------------------------------- /CPU Table Examples/i7 13700k ( 8-16P and 8E cores ): -------------------------------------------------------------------------------- 1 | :: Affinity table for Intel i7-13700k Processor with Hyperthreading 2 | :: Thread # = Value = BitMask 3 | :: P-Core 0 = 1 = 00000001 4 | :: P-Core 1 = 2 = 00000010 5 | :: P-Core 2 = 4 = 00000100 6 | :: P-Core 3 = 8 = 00001000 7 | :: P-Core 4 = 16 = 00010000 8 | :: P-Core 5 = 32 = 00100000 9 | :: P-Core 6 = 64 = 01000000 10 | :: P-Core 7 = 128 = 10000000 11 | :: P-Core 8T = 256 = 1 00000000 12 | :: P-Core 9T = 512 = 10 00000000 13 | :: P-Core 10T = 1024 = 100 00000000 14 | :: P-Core 11T = 2048 = 1000 00000000 15 | :: P-Core 12T = 4096 = 10000 00000000 16 | :: P-Core 13T = 8192 = 100000 00000000 17 | :: P-Core 14T = 16384 = 1000000 00000000 18 | :: P-Core 15T = 32768 = 10000000 00000000 19 | :: E-Core 16 = 65536 = 100000000 00000000 20 | :: E-Core 17 = 131072 = 1000000000 00000000 21 | :: E-Core 18 = 262144 = 10000000000 00000000 22 | :: E-Core 19 = 524288 = 100000000000 00000000 23 | :: E-Core 20 = 1048576 = 1000000000000 00000000 24 | :: E-Core 21 = 2097152 = 10000000000000 00000000 25 | :: E-Core 22 = 4194304 = 100000000000000 00000000 26 | :: E-Core 23 = 8388608 = 1000000000000000 00000000 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /CPU Table Examples/i7 14700k ( 8-16P and 12E cores): -------------------------------------------------------------------------------- 1 | :: Affinity table for Intel i7-14700k Processor with Hyperthreading 2 | :: Thread # = Value = BitMask 3 | :: P-Core 1 = 1 = 00000001 4 | :: P-Core 2 = 2 = 00000010 5 | :: P-Core 3 = 4 = 00000100 6 | :: P-Core 4 = 8 = 00001000 7 | :: P-Core 5 = 16 = 00010000 8 | :: P-Core 6 = 32 = 00100000 9 | :: P-Core 7 = 64 = 01000000 10 | :: P-Core 8 = 128 = 10000000 11 | :: P-Core 1T = 256 = 1 00000000 12 | :: P-Core 2T = 512 = 10 00000000 13 | :: P-Core 3T = 1024 = 100 00000000 14 | :: P-Core 4T = 2048 = 1000 00000000 15 | :: P-Core 5T = 4096 = 10000 00000000 16 | :: P-Core 6T = 8192 = 100000 00000000 17 | :: P-Core 7T = 16384 = 1000000 00000000 18 | :: P-Core 8T = 32768 = 10000000 00000000 19 | :: E-Core 1 = 65536 = 1000000000 00000000 20 | :: E-Core 2 = 131072 = 10000000000 00000000 21 | :: E-Core 3 = 262144 = 100000000000 00000000 22 | :: E-Core 4 = 524288 = 1000000000000 00000000 23 | :: E-Core 5 = 1048576 = 10000000000000 00000000 24 | :: E-Core 6 = 2097152 = 100000000000000 00000000 25 | :: E-Core 7 = 4194304 = 1000000000000000 00000000 26 | :: E-Core 8 = 8388608 = 10000000000000000 00000000 27 | :: E-Core 9 = 16777216 = 100000000000000000 00000000 28 | :: E-Core 10 = 33554432 = 1000000000000000000 00000000 29 | :: E-Core 11 = 67108864 = 10000000000000000000 00000000 30 | :: E-Core 12 = 134217728 = 100000000000000000000 00000000 31 | -------------------------------------------------------------------------------- /CPU Table Examples/i9 14900K ( 8-16P and 16E cores ) : -------------------------------------------------------------------------------- 1 | :: Affinity table for Intel 14900k Processor with Hyperthreading 2 | :: Thread # = Value = BitMask 3 | :: P-Core 1 = 1 = 00000001 4 | :: P-Core 2 = 2 = 00000010 5 | :: P-Core 3 = 4 = 00000100 6 | :: P-Core 4 = 8 = 00001000 7 | :: P-Core 5 = 16 = 00010000 8 | :: P-Core 6 = 32 = 00100000 9 | :: P-Core 7 = 64 = 01000000 10 | :: P-Core 8 = 128 = 10000000 11 | :: P-Core 1T = 256 = 1 00000000 12 | :: P-Core 2T = 512 = 10 00000000 13 | :: P-Core 3T = 1024 = 100 00000000 14 | :: P-Core 4T = 2048 = 1000 00000000 15 | :: P-Core 5T = 4096 = 10000 00000000 16 | :: P-Core 6T = 8192 = 100000 00000000 17 | :: P-Core 7T = 16384 = 1000000 00000000 18 | :: P-Core 8T = 32768 = 10000000 00000000 19 | :: E-Core 1 = 65536 = 1000000000 00000000 20 | :: E-Core 2 = 131072 = 10000000000 00000000 21 | :: E-Core 3 = 262144 = 100000000000 00000000 22 | :: E-Core 4 = 524288 = 1000000000000 00000000 23 | :: E-Core 5 = 1048576 = 10000000000000 00000000 24 | :: E-Core 6 = 2097152 = 100000000000000 00000000 25 | :: E-Core 7 = 4194304 = 1000000000000000 00000000 26 | :: E-Core 8 = 8388608 = 10000000000000000 00000000 27 | :: E-Core 9 = 16777216 = 100000000000000000 00000000 28 | :: E-Core 10 = 33554432 = 1000000000000000000 00000000 29 | :: E-Core 11 = 67108864 = 10000000000000000000 00000000 30 | :: E-Core 12 = 134217728 = 100000000000000000000 00000000 31 | :: E-Core 13 = 268435456 = 1000000000000000000000 00000000 32 | :: E-Core 14 = 536870912 = 10000000000000000000000 00000000 33 | :: E-Core 15 = 1073741824 = 100000000000000000000000 00000000 34 | :: E-Core 16 = 2147483648 = 1000000000000000000000000 00000000 35 | 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # voicemeeter-auto-affinity 2 | 3 | [![Github Downloads all Releases](https://img.shields.io/github/downloads/Gobidev/voicemeeter-auto-affinity/total)](https://github.com/Gobidev/voicemeeter-auto-affinity/releases) 4 | [![Github Downloads latest Release](https://img.shields.io/github/downloads/Gobidev/voicemeeter-auto-affinity/latest/total)](https://github.com/Gobidev/voicemeeter-auto-affinity/releases/latest) 5 | [![License](https://img.shields.io/github/license/Gobidev/voicemeeter-auto-affinity)](https://github.com/Gobidev/voicemeeter-auto-affinity/blob/main/LICENSE) 6 | [![GitHub issues](https://img.shields.io/github/issues/Gobidev/voicemeeter-auto-affinity)](https://github.com/Gobidev/voicemeeter-auto-affinity/issues) 7 | 8 | Automatically sets the affinity of "audiodg.exe" to only one core on computer 9 | start to fix the crackling noises that can occur in VoiceMeeter. 10 | 11 | ## New in v2 12 | 13 | I learned about 14 | [Windows Task Scheduler](https://learn.microsoft.com/en-us/windows/win32/taskschd/schtasks) 15 | that allows to run the script in a way that does not open an admin prompt on 16 | every login and wrote a new script that makes use of that. 17 | 18 | _Note: If you had v1 of the script installed, it is automatically uninstalled if 19 | you install v2._ 20 | 21 | ## New in v2.5 22 | 23 | The affinity will now be set periodically in addition to only on login. For more 24 | information, see 25 | [#11](https://github.com/Gobidev/voicemeeter-auto-affinity/pull/11). 26 | 27 | ## How to Install 28 | 29 | To install the script, download the `install.bat` file from the 30 | [latest release](https://github.com/Gobidev/voicemeeter-auto-affinity/releases/latest) 31 | and run it. That's it! 32 | 33 | ## How to Uninstall 34 | 35 | To remove the Task Scheduler tasks, run the following commands from an 36 | administrator command prompt: 37 | 38 | ```bat 39 | schtasks /delete /f /tn audiodg-affinity 40 | schtasks /delete /f /tn audiodg-affinity-recurring 41 | ``` 42 | 43 | ## The Problem 44 | 45 | Some users of the program VoiceMeeter have a problem with a sound channel having 46 | crackling noises. This can be fixed by setting the affinity of the windows 47 | process `audiodg.exe` to only one core. This, however can not be done 48 | persistently in Windows itself, so a common solution is to use 49 | [Process Lasso](https://bitsum.com/). My problem with this solution was that the 50 | free version of this program asks to buy the paid version on every boot and 51 | constantly runs in the background although the only feature I use does not 52 | require that. This is why I decided to write a simple script that is run once on 53 | system boot and changes the affinity of audiodg to only one core. 54 | -------------------------------------------------------------------------------- /CPU Table Examples/Generate CPU Table.ps1: -------------------------------------------------------------------------------- 1 | # PowerShell script to generate a CPU Affinity table for Windows environments. 2 | # Can be run directly in a Powershell Shell. So no need to run it as .ps1, just copy and paste it. 3 | # Utilizes Win32_Processor class to fetch CPU details and calculates thread affinity. 4 | 5 | # Retrieve CPU information. 6 | $cpuInfo = Get-WmiObject -Class Win32_Processor 7 | $totalCores = $cpuInfo.NumberOfCores 8 | $totalThreads = $cpuInfo.NumberOfLogicalProcessors 9 | 10 | # Initialize StringBuilder for output formatting. 11 | $outputBuilder = New-Object System.Text.StringBuilder 12 | $outputBuilder.AppendLine(":: Affinity table for $($cpuInfo.Name) with Hyperthreading") 13 | 14 | # Define a function to format affinity values into bitmasks. 15 | Function Format-BitMask ($affinityValue) { 16 | $bitMask = [Convert]::ToString($affinityValue, 2).PadLeft(8, '0') 17 | return $bitMask.Length -gt 8 ? $bitMask.Insert($bitMask.Length - 8, ' ') : $bitMask 18 | } 19 | 20 | # Initialize variables for data collection and formatting. 21 | $maxCoreThreadLength = $maxValueLength = $maxBitMaskLength = 0 22 | $coreThreadInfo = @() 23 | $valueInfo = @() 24 | $bitMaskInfo = @() 25 | 26 | # Determine the starting index for hyperthreaded cores. 27 | $hyperthreadedStartIndex = $totalCores / 2 28 | 29 | # Collect and format data for each thread. 30 | for ($i = 0; $i -lt $totalThreads; $i++) { 31 | $affinityValue = 1 -shl $i 32 | $formattedBitMask = Format-BitMask -affinityValue $affinityValue 33 | $coreType = if ($i -lt $totalCores) { "P-Core" } else { "E-Core" } 34 | $threadID = if ($coreType -eq "P-Core" -and $i -ge $hyperthreadedStartIndex) { "$i`T" } else { "$i" } 35 | 36 | $coreThreadInfo += "$coreType $threadID" 37 | $valueInfo += $affinityValue.ToString() 38 | $bitMaskInfo += $formattedBitMask 39 | } 40 | 41 | # Compute maximum lengths for table formatting. 42 | $maxCoreThreadLength = ($coreThreadInfo | Measure-Object -Property Length -Maximum).Maximum 43 | $maxValueLength = ($valueInfo | Measure-Object -Property Length -Maximum).Maximum 44 | $maxBitMaskLength = ($bitMaskInfo | Measure-Object -Property Length -Maximum).Maximum 45 | 46 | # Construct the header for the affinity table. 47 | $header = "Thread #".PadRight($maxCoreThreadLength) + " = " + "Value".PadRight($maxValueLength) + " = BitMask" 48 | $outputBuilder.AppendLine(":: $header") 49 | 50 | # Build the table with aligned data. 51 | for ($i = 0; $i -lt $totalThreads; $i++) { 52 | $outputBuilder.AppendLine(":: $($coreThreadInfo[$i].PadRight($maxCoreThreadLength)) = $($valueInfo[$i].PadRight($maxValueLength)) = $($bitMaskInfo[$i].PadRight($maxBitMaskLength))") 53 | } 54 | 55 | # Output the formatted table. 56 | $outputBuilder.ToString() 57 | -------------------------------------------------------------------------------- /install.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: If not run as admin, open prompt 4 | >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" 5 | 6 | if '%errorlevel%' NEQ '0' ( 7 | goto UACPrompt 8 | ) else ( goto gotAdmin ) 9 | 10 | :UACPrompt 11 | echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" 12 | set params = %*:"=" 13 | echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" 14 | 15 | "%temp%\getadmin.vbs" 16 | del "%temp%\getadmin.vbs" 17 | exit /B 18 | 19 | :gotAdmin 20 | pushd "%CD%" 21 | CD /D "%~dp0" 22 | 23 | :: install vbs script to %UserProfile% 24 | echo CreateObject("Wscript.Shell").Run "PowerShell.exe ""$Process = Get-Process audiodg; $Process.ProcessorAffinity=1; $Process.PriorityClass=""""""High""""""""", 0, True > "%UserProfile%\set-audiodg-affinity.vbs" 25 | :: Affinity table 26 | :: Core # = Value = BitMask 27 | :: Core 0 = 1 = 00000001 28 | :: Core 1 = 2 = 00000010 29 | :: Core 2 = 4 = 00000100 30 | :: Core 3 = 8 = 00001000 31 | :: Core 4 = 16 = 00010000 32 | :: Core 5 = 32 = 00100000 33 | :: Core 6 = 64 = 01000000 34 | :: Core 7 = 128 = 10000000 35 | :: Core 8 = 256 = 1 00000000 36 | :: Core 9 = 512 = 10 00000000 37 | :: Core 10 = 1024 = 100 00000000 38 | :: Core 11 = 2048 = 1000 00000000 39 | :: Core 12 = 4096 = 10000 00000000 40 | :: Core 13 = 8192 = 100000 00000000 41 | :: Core 14 = 16384 = 1000000 00000000 42 | :: Core 15 = 32768 = 10000000 00000000 43 | :: Core 16 = 65536 = 1000000000 00000000 44 | :: Core 17 = 131072 = 10000000000 00000000 45 | :: Core 18 = 262144 = 100000000000 00000000 46 | :: Core 19 = 524288 = 1000000000000 00000000 47 | :: Core 20 = 1048576 = 10000000000000 00000000 48 | :: Core 21 = 2097152 = 100000000000000 00000000 49 | :: Core 22 = 4194304 = 1000000000000000 00000000 50 | :: Core 23 = 8388608 = 10000000000000000 00000000 51 | :: Core 24 = 16777216 = 100000000000000000 00000000 52 | :: Core 25 = 33554432 = 1000000000000000000 00000000 53 | :: Core 26 = 67108864 = 10000000000000000000 00000000 54 | :: Core 27 = 134217728 = 100000000000000000000 00000000 55 | :: Core 28 = 268435456 = 1000000000000000000000 00000000 56 | :: Core 29 = 536870912 = 10000000000000000000000 00000000 57 | :: Core 30 = 1073741824 = 100000000000000000000000 00000000 58 | :: Core 31 = 2147483648 = 1000000000000000000000000 00000000 59 | 60 | :: remove old version of program if present 61 | cd "C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\" 62 | del set-audiodg-affinity.bat 2>NUL 63 | 64 | :: add task scheduler job 65 | schtasks /create /sc ONLOGON /tn audiodg-affinity /delay 0000:20 /tr "wscript \"%UserProfile%\set-audiodg-affinity.vbs\"" /rl HIGHEST 66 | 67 | :: Creating scheduled task so it is more persistently applying changes as the process is controlled by the Windows Audio service and will stop and restart process as needed 68 | schtasks /create /sc MINUTE /tn audiodg-affinity-recurring /mo 5 /tr "wscript \"%UserProfile%\set-audiodg-affinity.vbs\"" /rl HIGHEST 69 | 70 | :: run vbs script once to set the affinity for current session 71 | wscript "%UserProfile%\set-audiodg-affinity.vbs" 72 | 73 | :: Uninstall with 74 | :: schtasks /delete /f /tn audiodg-affinity 75 | 76 | echo. 77 | echo. 78 | echo INSTALLATION FINISHED 79 | echo. 80 | pause 81 | --------------------------------------------------------------------------------