-
Notifications
You must be signed in to change notification settings - Fork 4
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
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# beep | ||
|
||
Beep is a minimal cross-platform sound playback library. All it does is beeping at the given frequency for the given duration of time. | ||
|
||
* Good old C89 code with globals. | ||
* Very small, ~100 lines of code for all platforms. | ||
* Easy to use, API is a single blocking function. | ||
* Uses ALSA on Linux, CoreAudio on macOS and Beep() WINAPI function on Windows. | ||
|
||
The API is the following: | ||
|
||
```c | ||
int beep(int frequency, int duration); | ||
``` | ||
Frequency is in Hz, duration is in milliseconds. To convert note index into a frequency use the following formula: `440 * pow(2, ((note - 49) / 12))`. | ||
There is a also a `beep` utility which shows how the API can be used. | ||
If you found an issue or would like to propose a feature - PRs are welcome as long as they are small and simple! | ||
Code is distributed under MIT license, feel free to use in commercial projects. |