Crates.io | actually_beep |
lib.rs | actually_beep |
version | 0.1.1 |
source | src |
created_at | 2024-06-03 23:44:47.462996 |
updated_at | 2024-06-05 03:39:36.780266 |
description | A cross platform library to provides easy to use beep functions that actually beep |
homepage | |
repository | https://github.com/evanjpw/actually_beep |
max_upload_size | |
id | 1260565 |
size | 43,903 |
A library to actually beep.
This is a cross-platform library to provides easy to use beep functions that actually beep. It provides very basic audio tones (beeps) for whatever use you may have for that. It’s built on the AMAZING CPAL crate, which provides the low level audio support, & also provides excellent examples from which this crate stole heavily.
Are we really doing this?
# Add this to your [dependencies] section in Cargo.toml
actually_beep = "0.1.0"
use actually_beep::beep_with_hz_and_millis;
fn main() {
let middle_e_hz = 329;
let a_bit_more_than_a_second_and_a_half_ms = 1600;
beep_with_hz_and_millis(middle_e_hz, a_bit_more_than_a_second_and_a_half_ms).unwrap();
}
jack
- Use the "jack" feature of cpal
. Only useful on Linux & the BSDs.I was writing one of my 1970s retro-game re-writes, & I needed to be able to generate a beep (for period verisimilitude). I had needed this before, & I found the beep crate, which I used, but had to stop using because it wasn't cross-platform.
Then I was writing a new 1970s retro game & needed a beep, so I looked further. There are a variety of platform dependent crates that have a similar function, including:
None of these are cross-platform, & they are all different. This crate fixes that by providing a general beeping interface that works on all platforms.
There are also some cool libraries that are AWESOME, but way more than I needed. One of these was CPAL, which was not what I needed, but with which I could build what I needed.
Currently, there is one call that blocks. There is no “beep indefinitely” call as the beep crate provides, & it doesn't provide any way to adjust things like the audio device, host audio system, or anything else.
These things are potentially, possibly, something that may be worked on.
Licensed under:
Thanks to the authors of beep
, beep_evdev
, & win-beep
for inspiration.
Unimaginable, ridiculous thanks to the author(s) of CPAL
.