-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
561 additions
and
85 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,49 @@ | ||
# LowAudioLatency | ||
|
||
[![Downloads][1]][2] [![GitHub stars][3]][4] | ||
|
||
[1]: https://img.shields.io/github/downloads/spddl/LowAudioLatency/total.svg | ||
[2]: https://github.com/spddl/LowAudioLatency/releases "Downloads" | ||
|
||
[3]: https://img.shields.io/github/stars/spddl/LowAudioLatency.svg | ||
[4]: https://github.com/spddl/LowAudioLatency/stargazers "GitHub stars" | ||
|
||
only a rewrite of the original [miniant-git/REAL](https://github.com/miniant-git/REAL) | ||
## About This Project | ||
|
||
LowAudioLatency sets the Windows audio buffer to the smallest possible value, similar to [miniant-git/REAL](https://github.com/miniant-git/REAL). LAL not only checks the output devices (headphones, speakers) but also the input devices (microphones). Additionally, it removes the real-time connection to the first CPU thread, as it is not necessary for this function. If the smallest buffer size is already the default buffer size, the program will terminate. | ||
|
||
> [!IMPORTANT] | ||
> Please note that not every audio driver supports this feature, and not all hardware has a driver with this capability. | ||
## Usage | ||
|
||
Simply run the executable file to minimize the audio latency for the output and input device: | ||
|
||
``` | ||
low_audio_latency.exe | ||
``` | ||
|
||
The program checks and sets the smallest possible buffer size for the default output and input device. | ||
If the smallest buffer size is the default buffer size, the program terminates itself. | ||
You can also specify EDataFlow and ERole yourself with an optional buffer value: | ||
|
||
>**If a driver supports small buffer sizes (<10ms buffers), will all applications in Windows 10 automatically use small buffers to render and capture audio?** | ||
``` | ||
low_audio_latency.exe eRender,eConsole,336 eCapture,eCommunications,336 | ||
``` | ||
|
||
## Supported parameters | ||
|
||
| Name | Description | Required | Allowed values | | ||
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------------------------------------------------------- | | ||
| [EDataFlow](https://learn.microsoft.com/en-us/windows/win32/api/mmdeviceapi/ne-mmdeviceapi-edataflow#constants) | The EDataFlow enumeration defines constants that indicate the direction in which audio data flows between an audio endpoint device and an application. | Yes | Enumeration ID or `eRender`, `eCapture`, or `eAll` | | ||
| [ERole](https://learn.microsoft.com/en-us/windows/win32/api/mmdeviceapi/ne-mmdeviceapi-erole#constants) | The ERole enumeration defines constants that indicate the role that the system has assigned to an audio endpoint device. | Yes | Enumeration ID or `eConsole`, `eMultimedia`, or `eCommunications` | | ||
| [pMinPeriodInFrames](https://learn.microsoft.com/en-us/windows/win32/api/audioclient/nf-audioclient-iaudioclient3-initializesharedaudiostream#parameters) | Periodicity requested by the client. This value must be an integral multiple of the value returned in the <i>pFundamentalPeriodInFrames</i> parameter to <a href="/windows/desktop/api/audioclient/nf-audioclient-iaudioclient3-getsharedmodeengineperiod">IAudioClient3::GetSharedModeEnginePeriod</a>. <i>PeriodInFrames</i> must also be greater than or equal to the value returned in <i>pMinPeriodInFrames</i> and less than or equal to the value returned in <i>pMaxPeriodInFrames</i>. | No | 0 determines the lowest value itself | | ||
|
||
> [!Note] | ||
> | ||
>No. By default, all applications in Windows 10 will use 10ms buffers to render and capture audio. If an application needs to use small buffers, then it needs to use the new AudioGraph settings or the WASAPI IAudioClient3 interface, in order to do so. However, if one application in Windows 10 requests the usage of small buffers, then the Audio Engine will start transferring audio using that particular buffer size. In that case, all applications that use the same endpoint and mode will automatically switch to that small buffer size. When the low latency application exits, the Audio Engine will switch to 10ms buffers again. | ||
> ### If a driver supports small buffer sizes, will all applications in Windows 10 and later automatically use small buffers to render and capture audio? | ||
> | ||
> No, by default all applications in Windows 10 and later will use 10-ms buffers to render and capture audio. If an application needs to use small buffers, then it needs to use the new AudioGraph settings or the WASAPI IAudioClient3 interface, in order to do so. However, if one application requests the usage of small buffers, then the audio engine will start transferring audio using that particular buffer size. In that case, all applications that use the same endpoint and mode will automatically switch to that small buffer size. When the low latency application exits, the audio engine will switch to 10-ms buffers again. | ||
> | ||
> quote: [Low-Latency Audio FAQ](https://learn.microsoft.com/en-us/windows-hardware/drivers/audio/low-latency-audio#faq) | ||
## Requirement | ||
|
||
quote: https://docs.microsoft.com/en-us/windows-hardware/drivers/audio/low-latency-audio | ||
Windows 10 for the core task [IAudioClient3](https://learn.microsoft.com/en-us/windows/win32/api/audioclient/nn-audioclient-iaudioclient3) and Windows 11 for [ProcessPowerThrottling](https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/ne-processthreadsapi-process_information_class) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,29 @@ | ||
ECHO OFF | ||
@REM cargo clean | ||
|
||
:loop | ||
CLS | ||
|
||
IF exist "%~dp0\target\release\low_audio_latency.exe" ( | ||
FOR /F "usebackq" %%A IN ('%~dp0\target\release\low_audio_latency.exe') DO SET /A beforeSize=%%~zA | ||
) ELSE ( | ||
SET /A beforeSize=0 | ||
) | ||
|
||
cargo build --release | ||
|
||
FOR /F "usebackq" %%A IN ('%~dp0\target\release\low_audio_latency.exe') DO SET /A size=%%~zA | ||
SET /A diffSize = %size% - %beforeSize% | ||
SET /A size=(%size%/1024)+1 | ||
IF "%diffSize%" EQU "0" ( | ||
ECHO %size% kb | ||
) ELSE ( | ||
IF "%diffSize%" GTR "0" ( | ||
ECHO %size% kb [+%diffSize% b] | ||
) ELSE ( | ||
ECHO %size% kb [%diffSize% b] | ||
) | ||
) | ||
|
||
PAUSE | ||
GOTO loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
:loop | ||
CLS | ||
|
||
cargo run | ||
|
||
PAUSE | ||
|
Oops, something went wrong.