Coder Social home page Coder Social logo

orhun / daktilo Goto Github PK

View Code? Open in Web Editor NEW
964.0 9.0 18.0 4.21 MB

Turn your keyboard into a typewriter! 📇

Home Page: https://daktilo.cli.rs/

License: Apache License 2.0

Rust 100.00%
daktilo keyboard rust sound typewriter typewriter-animation typewriter-effect typewriter-effects typewriter-mode typewriter-sounds

daktilo's Introduction

Turn your keyboard into a typewriter! 📇

GitHub Release Crate Release Coverage
Continuous Integration Continuous Deployment Documentation

daktilo-demo.mp4

daktilo ("typewriter" in Turkish, pronounced "duck-til-oh", derived from the Ancient Greek word δάκτυλος for "finger") is a small command-line program that plays typewriter sounds every time you press a key. It also offers the flexibility to customize keypress sounds to your liking. You can use the built-in sound presets to create an enjoyable typing experience, whether you're crafting emails or up to some prank on your boss.

✨ Inspiration: "Taking notes in class with my typewriter"

Now you can recreate this moment without the actual need for a physical typewriter!

Table of Contents

Getting Started

Simply run daktilo for the classic typewriter effect.

There are also different presets available:

Preset Name Description
default the classic typewriter effect
basic an alternative and more basic typewriter effect
musicbox plays random notes like a music box
ducktilo quack quack 🦆
drumkit dum, tss, cha! 🥁
spark high voltage high current typing experience ⚡

To list the presets:

daktilo --list-presets

To use a preset:

daktilo --preset musicbox

You can also use multiple presets at the same time:

# orchestra
daktilo -p default -p musicbox -p drumkit

To use a different output device:

daktilo --device pipewire

Also, you can use --list-devices to list the available output devices.

To variate the sounds and have a more realistic typewriter experience:

daktilo --variate-tempo 0.9,0.4 --variate-volume 0.1,0.5
Spoiler warning

There are easter eggs. If that is something you do not like you can disable them either via the config file option no_surprises = true or using the command-line flag:

daktilo --no-surprises

Supported Platforms

  • Linux
    • X11
    • Wayland*
  • Windows
  • MacOS

Installation

Packaging status

Cargo

daktilo can be installed from crates.io using cargo if Rust is installed.

cargo install daktilo

The minimum supported Rust version is 1.70.0.

On Linux, the following packages should be installed:

  • Arch Linux: alsa-lib libxtst libxi
  • Alpine Linux: alsa-lib-dev libxi-dev libxtst-dev
  • Debian/Ubuntu: libasound2-dev libxi-dev libxtst-dev

Arch Linux

daktilo can be installed from the official repositories using pacman:

pacman -S daktilo

Alpine Linux

daktilo is available for Alpine Edge. It can be installed via apk after enabling the testing repository.

apk add daktilo

MacPorts

On macOS, daktilo can be installed via MacPorts:

sudo port install daktilo

More info here.

Binary releases

See the available binaries for different targets from the releases page.

Build from source

  1. Clone the repository.
git clone https://github.com/orhun/daktilo && cd daktilo/
  1. Build.
CARGO_TARGET_DIR=target cargo build --release

Binary will be located at target/release/daktilo.

Usage

daktilo [OPTIONS]

Options:

-v, --verbose                                    Enables verbose logging [env: VERBOSE=]
-p, --preset [<PRESET>...]                       Sets the name of the sound preset to use [env: PRESET=]
-l, --list-presets                               Lists the available presets
    --list-devices                               Lists the available output devices
-d, --device <DEVICE>                            Sets the device for playback [env: DAKTILO_DEVICE=]
-c, --config <PATH>                              Sets the configuration file [env: DAKTILO_CONFIG=]
-i, --init                                       Writes the default configuration file
    --variate-volume <PERCENT_UP[,PERCENT_DOWN]> Variate volume +/- in percent [env: DAKTILO_VOLUME=]
    --variate-tempo <PERCENT_UP[,PERCENT_DOWN]>  Variate tempo +/- in percent [env: DAKTILO_TEMPO=]
-h, --help                                       Print help (see more with '--help')
-V, --version                                    Print version

Configuration

daktilo can be configured with a configuration file using the TOML format.

The path of the configuration file can be specified via --config argument or DAKTILO_CONFIG environment variable.

It can also be placed in one of the following global locations:

  • <config_dir> / daktilo.toml
  • <config_dir> / daktilo/daktilo.toml
  • <config_dir> / daktilo/config

<config_dir> depends on the platform as shown in the following table:

Platform Value Example
Linux $XDG_CONFIG_HOME or $HOME/.config /home/orhun/.config
macOS $HOME/Library/Application Support /Users/Orhun/Library/Application Support
Windows {FOLDERID_RoamingAppData} C:\Users\Orhun\AppData\Roaming

See daktilo.toml for the default configuration options.

You can also create the default configuration file in the current directory with --init flag:

daktilo --init

Adding custom presets

The configuration file consists of an array of sound_preset entries.

To define an array in TOML, you can create different sections as follows:

[[sound_preset]]
name = "custom"
key_config = []

[[sound_preset]]
name = "another_custom"
key_config = []
disabled_keys = []
variation = { volume: [0.1, 0.1], tempo: [0.05, 0.05] }

As shown above, sound_preset consists of 2 entries:

  • name: The name of the preset. It will be used in conjunction with --preset flag. e.g. --preset custom
  • key_config: An array of key press/release events for assigning audio files to the specified keys. It can also be used to control the volume etc.
  • disabled_keys: An array of keys that will not be used for playback.
  • variation: Variate the sound on each event for key_configs that do not specify variations*
Click for the list of available keys.

Alt, AltGr, Backspace, CapsLock, ControlLeft, ControlRight, Delete, DownArrow, End, Escape, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, Home, LeftArrow, MetaLeft, MetaRight, PageDown, PageUp, Return, RightArrow, ShiftLeft, ShiftRight, Space, Tab, UpArrow, PrintScreen, ScrollLock, Pause, NumLock, BackQuote, Num1, Num2, Num3, Num4, Num5, Num6, Num7, Num8, Num9, Num0, Minus, Equal, KeyQ, KeyW, KeyE, KeyR, KeyT, KeyY, KeyU, KeyI, KeyO, KeyP, LeftBracket, RightBracket, KeyA, KeyS, KeyD, KeyF, KeyG, KeyH, KeyJ, KeyK, KeyL, SemiColon, Quote, BackSlash, IntlBackslash, KeyZ, KeyX, KeyC, KeyV, KeyB, KeyN, KeyM, Comma, Dot, Slash, Insert, KpReturn, KpMinus, KpPlus, KpMultiply, KpDivide, Kp0, Kp1, Kp2, Kp3, Kp4, Kp5, Kp6, Kp7, Kp8, Kp9, KpDelete, Function, Unknown

As an example, here is how you can configure key_config:

key_config = [
  { event = "press", keys = "Return", files = [{ path = "ding.mp3", volume = 1.0 }] },
]
  • event: "press" or "release"
  • keys: A regular expression (regex) for matching the keys.
  • files: An array of files.
    • path: The absolute path of the file. If the file is embedded in the binary (i.e. if it is inside sounds/ directory) then it is the name of the file without full path.
    • volume: The volume of the sound. The value 1.0 is the "normal" volume (unfiltered input). Any value other than 1.0 will multiply each sample by this value.
  • variation: Variate the sound on each event*

If you have defined multiple files for a key event, you can also specify a strategy for how to play them:

key_config = [
  { event = "press", keys = ".*", files = [{ path = "1.mp3" }, { path = "2.mp3" }], strategy = "random" },
]

Currently supported strategies are:

  • strategy = "random": pick a random file from the list and play it.
  • strategy = "sequential": play the files sequentially.

Here is how you can combine everything together:

[[sound_preset]]
# Custom sound preset named "custom"
name = "custom"

# Key configurations for various events
key_config = [
  # When a key starting with "Key" is pressed, play 1.mp3, 2.mp3, and 3.mp3 sequentially
  { event = "press", keys = "Key*", files = [
    { path = "1.mp3" },
    { path = "2.mp3" },
    { path = "3.mp3" },
  ], strategy = "sequential" },

  # When a key starting with "Key" is released, play 4.mp3
  { event = "release", keys = "Key*", files = [
    { path = "4.mp3" },
  ] },

  # When a key starting with "Num" is pressed, play num.mp3 at a very high volume (10.0)
  { event = "press", keys = "Num*", files = [
    { path = "num.mp3", volume = 10.0 },
  ] },

  # When any key is pressed, play a random sound from cat.mp3, dog.mp3, or bird.mp3
  { event = "press", keys = ".*", files = [
    { path = "cat.mp3" },
    { path = "dog.mp3" },
    { path = "bird.mp3" },
  ], strategy = "random", variation = { volume: [0.1, 0.1], tempo: [0.05, 0.05] } },
]

# Disabled keys that won't trigger any sound events
disabled_keys = ["CapsLock", "NumLock"]

Sound Variation

To make the keyboard sounds more varied it is possible to variate both volume and playback speed (the later also varies the pitch).

Values are in percent, where the first value determines the maximum increase and the second the maximum decrease. The actual value is determined randomly on each keypress.

  • If command line arguments or environment variables are set configurations made in the presets are overridden.
    • Values need to be separated by a ",".
    • If only one value is supplied it is used for both increase and decrease
  • If a key_config is set the preset values are overridden.
  • The configuration on a preset applies to all key_config's that do not have any values set.

Similar Projects

MacOS permissions

On MacOS, you need to give some permissions to the terminal where you run daktilo.

The first time you run daktilo, you will probably see this popup:

macos-permissions

If you see it, click on "Open System Settings", otherwise open "System Settings" manually and go to "Privacy and Security". From here, enable "Input Monitoring" for your terminal application:

macos-input-monitoring

Acknowledgements

Huge thanks to H. Arda Güler for giving me the idea for this project, sharing the inspiration behind it and implementing the first iteration in Python.

Kudos! 👾

Donations

Support me on GitHub Sponsors Support me on Patreon Support me on Patreon

If you find daktilo and/or other projects on my GitHub useful, consider supporting me on GitHub Sponsors or becoming a patron!

Contributing

See our Contribution Guide and please follow the Code of Conduct in all your interactions with the project.

Also, see how you can add new presets here.

License

License: MIT License: Apache 2.0

Licensed under either of Apache License Version 2.0 or The MIT License at your option.

🦀 ノ( º _ º ノ) - respect crables!

Copyright

Copyright © 2023-2024, Orhun Parmaksız

daktilo's People

Contributors

arda-guler avatar dependabot[bot] avatar github-actions[bot] avatar herbygillot avatar madhur avatar marcoieni avatar orhun avatar simos avatar sloganking avatar xenira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

daktilo's Issues

Simulate audio device for running tests on GitHub Actions

Is your feature request related to a problem? Please describe.

Currently we can't run the audio tests on a GitHub runner since it requires a audio device to be present:

ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
test app::tests::test_handle_key_event ... FAILED

failures:

---- app::tests::test_handle_key_event stdout ----
Error: Stream(DefaultStreamConfigError(DeviceNotAvailable))
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default


failures:
    app::tests::test_handle_key_event

test result: FAILED. 4 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.11s

Describe the solution you'd like

Either simulate an audio device (or create it virtually) for running the tests like this:

cargo test --features audio-tests

Describe alternatives you've considered

Update the existing tests for running without an audio device - e.g. create mock objects for sinks etc.

Additional context

Document why MacOS permissions are needed / look into creating a standalone app

Is your feature request related to a problem? Please describe.

Mac is like "android" and iphone when it comes to permissions. You need to enable input monitoring for the app.
However, it's unsecure to allow your terminal to monitor for your input, because you can have key loggers hidden in other binaries you run.

image

Describe the solution you'd like

So one thing we can do is to document why this permission is required. Another thing would be to create a standalone app (similar to the others I have in my screenshot, e.g. discord), so that I can give input monitoring permission only to daktilo.

Describe alternatives you've considered

None.

Additional context

cc @MarcoIeni

Add a preset for loud keyboard sounds

Is your feature request related to a problem? Please describe.

So that we can pretend to have a loud-ass mechanic keyboard even with a quiet keyboard.

Describe the solution you'd like

Use the sounds from Cherry MX Red switches or something similar.

Describe alternatives you've considered

None.

Additional context

Thanks @matthiasbeyer for inspiration.

Failed to install with Cargo on Ubuntu 22.04

Failed to install with Cargo on Ubuntu 22.04

Freshly installed Rust and Cargo via curl https://sh.rustup.rs -sSf | sh.
Then tried to install daktilo with the recommended command cargo install daktilo and failed.

Software information

  • Operating system: Ubuntu 22.04 (6.2.0-34-generic) operating with x11 (Waylad is disabled)
  • Rust version: rustc 1.72.1 (d5c2e9c34 2023-09-13)
  • Project version: daktilo v 0.2.0

Additional context

See full shell log
    Updating crates.io index
  Downloaded daktilo v0.2.0ning bytes: 268.1 KB                                                                                           
  Downloaded 1 crate (2.4 MB) in 1.23silo ...                                                                                             
  Installing daktilo v0.2.0
    Updating crates.io index
  Downloaded libflate_lz77 v1.2.0g bytes: 182.8 KB                                                                                        
  Downloaded dirs-sys v0.4.1aining bytes: 1.9 MB                                                                                          
  Downloaded dasp_sample v0.11.0ng bytes: 1.9 MB                                                                                          
  Downloaded equivalent v1.0.1ning bytes: 1.9 MB                                                                                          
  Downloaded nu-ansi-term v0.46.0g bytes: 1.8 MB                                                                                          
  Downloaded cfg-if v1.0.0emaining bytes: 1.8 MB                                                                                          
  Downloaded block-buffer v0.10.4g bytes: 1.8 MB                                                                                          
  Downloaded tokio-macros v2.1.0ng bytes: 5.9 MB                                                                                          
  Downloaded thiserror-impl v1.0.49bytes: 5.8 MB                                                                                          
  Downloaded roff v0.2.1 remaining bytes: 5.7 MB                                                                                          
  Downloaded num_cpus v1.16.0ining bytes: 5.6 MB                                                                                          
  Downloaded matchers v0.1.0aining bytes: 5.6 MB                                                                                          
  Downloaded cpufeatures v0.2.9ing bytes: 5.6 MB                                                                                          
  Downloaded bytes v1.5.0remaining bytes: 5.6 MB                                                                                          
  Downloaded parking_lot_core v0.9.8ytes: 5.6 MB                                                                                          
  Downloaded once_cell v1.18.0ning bytes: 7.0 MB                                                                                          
  Downloaded same-file v1.0.6ining bytes: 6.9 MB                                                                                          
  Downloaded proc-macro2 v1.0.67ng bytes: 6.9 MB                                                                                          
  Downloaded toml v0.8.2 remaining bytes: 8.1 MB                                                                                          
  Downloaded strsim v0.10.0maining bytes: 7.9 MB                                                                                          
  Downloaded lazy_static v1.4.0ng bytes: 7.9 MB                                                                                           
  Downloaded include-flate-codegen-exports v0.1.4                                                                                         
  Downloaded serde_spanned v0.6.3 bytes: 7.9 MB                                                                                           
  Downloaded option-ext v0.2.0ing bytes: 10.9 MB                                                                                          
  Downloaded toml_edit v0.20.2ing bytes: 10.9 MB                                                                                          
  Downloaded tracing v0.1.37ining bytes: 10.7 MB                                                                                          
  Downloaded thread_local v1.1.7g bytes: 10.6 MB                                                                                          
  Downloaded symphonia v0.5.3ning bytes: 10.6 MB                                                                                          
  Downloaded terminal_size v0.3.0 bytes: 10.6 MB                                                                                          
  Downloaded rust-embed-impl v8.0.0ytes: 10.6 MB                                                                                          
  Downloaded regex-automata v0.1.10ytes: 10.6 MB                                                                                          
  Downloaded anstyle v1.0.4aining bytes: 10.4 MB                                                                                          
  Downloaded clap_mangen v0.2.14g bytes: 10.2 MB                                                                                          
  Downloaded anstyle-query v1.0.0 bytes: 10.1 MB                                                                                          
  Downloaded toml_datetime v0.6.3 bytes: 10.1 MB                                                                                          
  Downloaded nix v0.24.3remaining bytes: 10.1 MB                                                                                          
  Downloaded rust-embed-utils v8.0.0tes: 9.7 MB                                                                                           
  Downloaded include-flate-codegen v0.1.49.6 MB                                                                                           
  Downloaded colorchoice v1.0.0ng bytes: 9.5 MB                                                                                           
  Downloaded is-terminal v0.4.9ng bytes: 9.3 MB                                                                                           
  Downloaded adler32 v1.2.0aining bytes: 9.2 MB                                                                                           
  Downloaded regex v1.9.6emaining bytes: 9.2 MB                                                                                           
  Downloaded heck v0.4.1remaining bytes: 8.9 MB                                                                                           
  Downloaded signal-hook-registry v1.4.1 8.7 MB                                                                                           
  Downloaded scopeguard v1.2.0ing bytes: 8.7 MB                                                                                           
  Downloaded quote v1.0.33maining bytes: 8.7 MB                                                                                           
  Downloaded pkg-config v0.3.27ng bytes: 8.7 MB                                                                                           
  Downloaded log v0.4.20remaining bytes: 8.7 MB                                                                                           
  Downloaded pin-project-lite v0.2.13es: 8.7 MB                                                                                           
  Downloaded rustix v0.38.17ining bytes: 8.6 MB                                                                                           
  Downloaded fastrand v2.0.1ining bytes: 8.5 MB                                                                                           
  Downloaded proc-macro-hack v0.5.20+deprecated                                                                                           
  Downloaded colored v2.0.4aining bytes: 8.4 MB                                                                                           
  Downloaded thiserror v1.0.49ing bytes: 8.3 MB                                                                                           
  Downloaded utf8parse v0.2.1ning bytes: 8.1 MB                                                                                           
  Downloaded serde_regex v1.1.0ng bytes: 8.1 MB                                                                                           
  Downloaded generic-array v0.14.7bytes: 8.1 MB                                                                                           
  Downloaded digest v0.10.7aining bytes: 8.0 MB                                                                                           
  Downloaded dirs v5.0.1remaining bytes: 7.9 MB                                                                                           
  Downloaded walkdir v2.4.0aining bytes: 7.7 MB                                                                                           
  Downloaded autocfg v1.1.0aining bytes: 7.7 MB                                                                                           
  Downloaded clap_lex v0.5.1ining bytes: 7.7 MB                                                                                           
  Downloaded anstream v0.6.4ining bytes: 7.7 MB                                                                                           
  Downloaded bitflags v1.3.2ining bytes: 7.7 MB                                                                                           
  Downloaded tracing-log v0.1.3ng bytes: 7.6 MB                                                                                           
  Downloaded version_check v0.9.4 bytes: 7.6 MB                                                                                           
  Downloaded clap_derive v4.4.2ng bytes: 7.6 MB                                                                                           
  Downloaded arrayvec v0.7.4ining bytes: 7.5 MB                                                                                           
  Downloaded tokio v1.32.0maining bytes: 7.4 MB                                                                                           
  Downloaded smallvec v1.11.1cting tokio ...                                                                                              
  Downloaded sha2 v0.10.8emaining bytes: 7.0 MB                                                                                           
  Downloaded rdev v0.5.3remaining bytes: 7.0 MB                                                                                           
  Downloaded overload v0.1.1ining bytes: 7.0 MB                                                                                           
  Downloaded rodio v0.17.1maining bytes: 7.0 MB                                                                                           
  Downloaded alsa-sys v0.3.1ining bytes: 7.0 MB                                                                                           
  Downloaded symphonia-metadata v0.5.3s: 6.7 MB                                                                                           
  Downloaded lock_api v0.4.10ning bytes: 6.7 MB                                                                                           
  Downloaded aho-corasick v1.1.1g bytes: 6.7 MB                                                                                           
  Downloaded errno v0.3.4emaining bytes: 6.7 MB                                                                                           
  Downloaded bitflags v2.4.0ining bytes: 6.5 MB                                                                                           
  Downloaded crc32fast v1.3.2ning bytes: 6.5 MB                                                                                           
  Downloaded bytemuck v1.14.0ning bytes: 6.3 MB                                                                                           
  Downloaded crypto-common v0.1.6 bytes: 6.2 MB                                                                                           
  Downloaded anstyle-parse v0.2.2 bytes: 6.2 MB                                                                                           
  Downloaded parking_lot v0.12.1g bytes: 6.2 MB                                                                                           
  Downloaded sharded-slab v0.1.6g bytes: 6.2 MB                                                                                           
  Downloaded unicode-ident v1.0.12bytes: 6.2 MB                                                                                           
  Downloaded linux-raw-sys v0.4.8 bytes: 6.0 MB                                                                                           
  Downloaded clap_complete v4.4.3g linux-raw-sys ...                                                                                      
  Downloaded tracing-core v0.1.31 bytes: 5.8 MB                                                                                           
  Downloaded clap v4.4.6remaining bytes: 5.8 MB                                                                                           
  Downloaded tracing-attributes v0.1.26: 5.7 MB                                                                                           
  Downloaded libflate v1.4.0ining bytes: 5.7 MB                                                                                           
  Downloaded indexmap v2.0.2ining bytes: 5.6 MB                                                                                           
  Downloaded typenum v1.17.0ining bytes: 5.6 MB                                                                                           
  Downloaded symphonia-bundle-mp3 v0.5.3 5.6 MB                                                                                           
  Downloaded serde_derive v1.0.188bytes: 5.6 MB                                                                                           
  Downloaded rle-decode-fast v1.0.3ytes: 5.5 MB                                                                                           
  Downloaded serde v1.0.188aining bytes: 5.5 MB                                                                                           
  Downloaded x11 v2.21.0remaining bytes: 5.5 MB                                                                                           
  Downloaded socket2 v0.5.4aining bytes: 5.4 MB                                                                                           
  Downloaded alsa v0.7.1remaining bytes: 5.4 MB                                                                                           
  Downloaded memchr v2.6.4maining bytes: 5.2 MB                                                                                           
  Downloaded mio v0.8.8 remaining bytes: 4.7 MB                                                                                           
  Downloaded cpal v0.15.2emaining bytes: 4.7 MB                                                                                           
  Downloaded symphonia-core v0.5.3bytes: 4.6 MB                                                                                           
  Downloaded hashbrown v0.14.1ing bytes: 4.6 MB                                                                                           
  Downloaded winnow v0.5.15aining bytes: 4.2 MB                                                                                           
  Downloaded clap_builder v4.4.6g bytes: 4.0 MB                                                                                           
  Downloaded tracing-subscriber v0.3.17: 3.8 MB                                                                                           
  Downloaded syn v1.0.109maining bytes: 3.4 MB                                                                                            
  Downloaded syn v2.0.37emaining bytes: 3.1 MB                                                                                            
  Downloaded regex-syntax v0.6.29bytes: 3.1 MB                                                                                            
  Downloaded regex-syntax v0.7.5 bytes: 2.8 MB                                                                                            
  Downloaded regex-automata v0.3.9ytes: 1.8 MB                                                                                            
  Downloaded libc v0.2.148aining bytes: 953.9 KB                                                                                          
  Downloaded rust-embed v8.0.0ng bytes: 648.0 KB                                                                                          
  Downloaded include-flate v0.2.0 rust-embed ...                                                                                          
  Downloaded encoding_rs v0.8.33 include-flate ...                                                                                        
  Downloaded 119 crates (12.6 MB) in 4.19s (largest was `linux-raw-sys` at 1.4 MB)                                                        
   Compiling proc-macro2 v1.0.67
   Compiling unicode-ident v1.0.12
   Compiling cfg-if v1.0.0
   Compiling typenum v1.17.0
   Compiling libc v0.2.148
   Compiling version_check v0.9.4
   Compiling lazy_static v1.4.0
   Compiling crc32fast v1.3.2
   Compiling pkg-config v0.3.27          ] 0/171: crc32fast(build.rs), libc(build.rs), proc-macro2(build.rs), version_check, typenum(bu...
   Compiling rustix v0.38.17             ] 2/171: crc32fast(build.rs), libc(build.rs), proc-macro2(build.rs), version_check, typenum(bu...
   Compiling bitflags v1.3.2             ] 3/171: crc32fast(build.rs), libc(build.rs), proc-macro2(build.rs), version_check, typenum(bu...
   Compiling bitflags v2.4.0             ] 4/171: crc32fast(build.rs), libc(build.rs), proc-macro2(build.rs), version_check, typenum(bu...
   Compiling generic-array v0.14.7       ] 5/171: crc32fast(build.rs), libc(build.rs), proc-macro2(build.rs), version_check, typenum(bu...
   Compiling linux-raw-sys v0.4.8        ] 6/171: crc32fast(build.rs), libc(build.rs), proc-macro2(build.rs), typenum(build.rs), rustix...
   Compiling serde v1.0.188              ] 7/171: crc32fast(build.rs), libc(build.rs), proc-macro2(build.rs), typenum(build.rs), rustix...
   Compiling log v0.4.20                ] 17/171: libc, typenum(build), typenum(build), serde(build.rs), generic-array(build), proc-mac...
   Compiling autocfg v1.1.0             ] 19/171: libc, typenum, typenum(build), serde(build.rs), proc-macro2, pkg-config, linux-raw-sy...
   Compiling rle-decode-fast v1.0.3     ] 23/171: libc, typenum, crc32fast(build), proc-macro2, typenum, autocfg, linux-raw-sys, log      
   Compiling utf8parse v0.2.1           ] 24/171: libc, typenum, rle-decode-fast, proc-macro2, typenum, autocfg, linux-raw-sys, log       
   Compiling proc-macro-hack v0.5.20+deprecated1: libc, typenum, utf8parse, proc-macro2, rustix, typenum, autocfg, linux-raw-sys          
   Compiling quote v1.0.33              ] 27/171: libc, typenum, proc-macro-hack(build.rs), proc-macro2, rustix, typenum, autocfg, linu...
   Compiling lock_api v0.4.10           ] 28/171: libc, typenum, proc-macro-hack(build.rs), proc-macro2, rustix, typenum, autocfg, quote  
   Compiling syn v2.0.37                ] 29/171: libc, typenum, proc-macro-hack(build.rs), proc-macro2, rustix, typenum, lock_api(buil...
   Compiling syn v1.0.109               ] 30/171: libc, typenum, proc-macro2, rustix, syn, typenum, lock_api(build.rs), quote             
   Compiling smallvec v1.11.1           ] 31/171: libc, typenum, proc-macro2, rustix, syn, typenum, quote, syn(build.rs)                  
   Compiling parking_lot_core v0.9.8    ] 32/171: libc, typenum, smallvec, rustix, syn, typenum, quote, syn(build.rs)                     
   Compiling anstyle-parse v0.2.2       ] 37/171: libc, proc-macro-hack(build), generic-array, rustix, syn, generic-array, parking_lot_...
   Compiling libflate_lz77 v1.2.0       ] 39/171: libc, parking_lot_core(build), generic-array, anstyle-parse, rustix, syn, generic-arr...
   Compiling alsa-sys v0.3.1            ] 42/171: libc, generic-array, anstyle-parse, libflate_lz77, crc32fast, rustix, syn, generic-array
   Compiling arrayvec v0.7.4            ] 43/171: libc, generic-array, alsa-sys(build.rs), libflate_lz77, crc32fast, rustix, syn, gener...
   Compiling anstyle-query v1.0.0       ] 44/171: libc, generic-array, alsa-sys(build.rs), libflate_lz77, rustix, syn, generic-array, a...
   Compiling memchr v2.6.4              ] 45/171: libc, anstyle-query, generic-array, alsa-sys(build.rs), rustix, syn, generic-array, a...
   Compiling bytemuck v1.14.0           ] 46/171: libc, generic-array, alsa-sys(build.rs), memchr, rustix, syn, generic-array, arrayvec   
   Compiling block-buffer v0.10.4       ] 47/171: libc, generic-array, memchr, rustix, syn, bytemuck, generic-array, arrayvec             
   Compiling crypto-common v0.1.6       ] 48/171: libc, generic-array, block-buffer, memchr, rustix, syn, bytemuck, generic-array         
   Compiling colorchoice v1.0.0         ] 49/171: libc, generic-array, block-buffer, crypto-common, memchr, syn, bytemuck, generic-array  
   Compiling anstyle v1.0.4             ] 50/171: libc, generic-array, block-buffer, crypto-common, memchr, syn, bytemuck, colorchoice    
   Compiling scopeguard v1.2.0          ] 51/171: libc, anstyle, generic-array, block-buffer, crypto-common, memchr, syn, bytemuck        
   Compiling adler32 v1.2.0             ] 52/171: libc, anstyle, scopeguard, block-buffer, crypto-common, memchr, syn, bytemuck           
   Compiling once_cell v1.18.0          ] 53/171: libc, anstyle, scopeguard, block-buffer, adler32, memchr, syn, bytemuck                 
   Compiling symphonia-core v0.5.3      ] 55/171: libc, anstyle, lock_api, adler32, memchr, syn, bytemuck, once_cell                      
   Compiling libflate v1.4.0            ] 56/171: libc, anstyle, lock_api, adler32, memchr, syn, once_cell, symphonia-core                
   Compiling anstream v0.6.4            ] 57/171: libc, anstyle, lock_api, libflate, memchr, syn, once_cell, symphonia-core               
   Compiling digest v0.10.7             ] 58/171: libc, anstyle, lock_api, libflate, anstream, memchr, syn, symphonia-core                
   Compiling aho-corasick v1.1.1        ] 61/171: libflate, anstream, crypto-common, memchr, digest, syn, block-buffer, symphonia-core    
error: failed to run custom build command for `alsa-sys v0.3.1`d), libflate, anstream, parking_lot_core, memchr, syn, aho-corasick, sym...

Caused by:
  process didn't exit successfully: `/tmp/cargo-install0p32LC/release/build/alsa-sys-d0be25b49ac25f37/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=ALSA_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=ALSA_STATIC
  cargo:rerun-if-env-changed=ALSA_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  thread 'main' panicked at '`PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" PKG_CONFIG_ALLOW_SYSTEM_LIBS="1" "pkg-config" "--libs" "--cflags" "alsa"` did not exit successfully: exit status: 1
  error: could not find system library 'alsa' required by the 'alsa-sys' crate

  --- stderr
  Package alsa was not found in the pkg-config search path.
  Perhaps you should add the directory containing `alsa.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'alsa' found
  ', ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/alsa-sys-0.3.1/build.rs:13:18
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `daktilo v0.2.0`, intermediate artifacts can be found at `/tmp/cargo-install0p32LC`.                             
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Incomplete readme.md

The readme falls down here, leaving the user guessing:

Installation
Cargo
daktilo can be installed from crates.io
cargo install daktilo
The minimum supported Rust version is 1.70.0.


Cargo is never defined and there's no link to the app.
The link to install daktilo, crates.io, targets itself (the current page).
Rust is never defined and there's no link to the app.

Every potential user unfamiliar with these apps has to investigate them.

Vietnamese typing problem

Describe the bug

Vietnamese typing somehow breaks when daktilo is running.

In the video below, the right text should be "thử chữ" instead of "thưử chưữ" (duplicated "ư" character)

(seems that I've seen this before in Linux, but without this daktilo)

To reproduce

  • Open Unikey and set the keyboard to Vietnamese Telex
  • Start typing text

Expected behavior

Screenshots / Logs

Demonstration video: https://drive.google.com/file/d/13r4OCrLPik97IB4D9LOK1G0Nb-UGNDfq/view?usp=sharing

Software information

  • Operating system: Windows 11 build 23555
  • Rust version:
  • Project version: 0.1.0

Additional context

Not working with wayland

Describe the bug

It's not working with kitty 0.29.2 /wayland.

If I enable verbose mode, I can't see any keys pressed in the kitty terminal. When I use e.g. urxvt, it works.

To reproduce

Steps to reproduce the behavior:

  1. Install daktilo with pacman
  2. Start daktilo
  3. Start kitty terminal
  4. Type something into the terminal
  5. Hear nothing

Expected behavior

Hearing some typing sounds.

Software information

  • Operating system: Arch GNU/Linux x86_64 6.5.4-arch2-1
  • Terminal: kitty 0.29.2
  • Display-Server: wayland

Happy New Year

Is your feature request related to a problem? Please describe.

No, strictly speaking. Yes, if you want to bend the definition of "a problem" a little bit.

Describe the solution you'd like

Have a daktilo preset that plays "jingle bells" when it's around the end of the year.

Describe alternatives you've considered

Opening an issue instead of implementing the thing. Here I am.

Additional context

A: daktilo preset that plays jingle bells that activates between noel and new year
B: good idea
B: you can create an issue so that we don't forget

Improve the carriage return

Is your feature request related to a problem? Please describe.

There were a few comments about the sound of the carriage return of the default preset.

I did kind of expect the carriage return to have some sort of ratchet sound that is dependent on the length of the line typed before the Enter key is pressed. :-)

As an old fart who actually used a typewriter, I must point out that the bell does not ring when you press the carriage return. The bell rings when you are nearing the end of the line to warn you that you are bout to run out of paper.

On carriage return, the sound should be a slow swing of the heavy carriage physically returning.

Describe the solution you'd like

n/a. Ideas welcome.

Describe alternatives you've considered

The carriage return sound is a long SFX so ding is maybe fine (?)

Additional context

See the comments on https://news.ycombinator.com/item?id=37751311

Ability to run multiple presets

Is your feature request related to a problem? Please describe.

Running multiple presets at the same time on the same instance is not possible. (Why do you even want that, you ask? Because 'default', 'musicbox' and 'drumkit' presets sound very good together, like an orchestra!)

Describe the solution you'd like

An option to accept multiple preset arguments when running.

Describe alternatives you've considered

What I currently do is run multiple instances, which is suboptimal.

Document dependency on Xtst

cargo install daktilo fails if the pkg-config data for libXtst are not present. For example, on Debian, one needs to run apt install libxtst-dev prior to installation.

For users of distros which package development headers separately from libraries, it may be useful to add a note to the install instructions.

Example output on a system without libxtst-dev:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" PKG_CONFIG_ALLOW_SYSTEM_LIBS="1" "pkg-config" "--libs" "--cflags" "xtst" "xtst >= 1.2"` did not exit successfully: exit status: 1
  error: could not find system library 'xtst' required by the 'x11' crate

Add easter eggs

Is your feature request related to a problem? Please describe.

Adding easter eggs would be fun.

Describe the solution you'd like

Some ideas:

  • Play a special sound with %0.001 chance
  • Add a special key

Describe alternatives you've considered

Feel free to share other ideas!

Additional context

Na

Failed to run multiple presets due to stream error: `The requested device is no longer available`

Describe the bug

I am getting the following error while trying to run multiple presets at the same time:

Stream error: `The requested device is no longer available. For example, it has been unplugged.`

It comes from https://docs.rs/rodio/latest/rodio/enum.StreamError.html

To reproduce

daktilo -p default -p musicbox -p drumkit

Expected behavior

Successful run.

Software information

  • Operating system: Arch Linux
  • Rust version: rustc 1.73.0 (cc66ad468 2023-10-03)
  • Project version: git

Additional context

I'm using pulse-pipewire

Add API to control from the outside

Is your feature request related to a problem? Please describe.

#22 discusses different ways of changing the ding to ding after n characters.
While using different keys to determine the current column this will always have a bit of inaccuracy.

I propose to add a way to control daktilo from the outside to give editors the opportunity to report the current cursor position and/or line length.

Maybe other use cases for controlling the app from the outside might also arise in the future (e.g.: changing preset based on current project/application).

Describe the solution you'd like

I'd like to implement an api allowing external applications to control the running daktilo process.

For this one could use different ways of communication:

  1. (g)RPC
  2. Pipes
  3. Rest API

My prefered solution would probably be gRPC. While named pipes would be a really simple way of handling this the other methods probably scale a lot better.

The api should probably be disabled by default and can be enabled using the config file.

Describe alternatives you've considered

Programs could include a lib version of this project. This would have several drawbacks:

  1. If multiple programs do this each would be playing their own sound causing overlap
  2. Config per program would be required
  3. Programs would need to update daktilo lib and might have different versions (unless dynamic linked, but that would just add further complexity and breaking changes would break the libs till update)

Additional context

I'm investing way to much time into this and prob. over-engineering this. Please feel free to tell me if I am going too far 😜

Considerations for latency

Firstly, thanks!

This tool has increased my programming proficiency by 10% 😉😉😄
Ps. Lower latency would for sure boost this to, like, 15% 😁

Have you considered lower level libs for handling playback? I made some GPT-4 queries about that and here's what I was able to come up with:
https://chat.openai.com/share/d1a243c7-05cf-43a8-b6ef-a1a46bfca668

I haven't worked with low-level audio libraries before, but it seems promising - if that interests you!

Best,
-Rich

Support disabling easter eggs

Is your feature request related to a problem? Please describe.

I personally like them, but maybe add a flag/config option to disable them for those who don't.

Originally posted by @Xenira in #14 (comment)

Describe the solution you'd like

Add --no-surprises Disables easter eggs argument or something similar. It should also be configurable from the configuration file.

I'm open for naming suggestions.

Describe alternatives you've considered

Also support environment variables.

Additional context

You need to find where the easter eggs are to disable them, just a hint, search for "ak47" in the repo.

See #14

Key down sound not play if another key is already pressed.

Describe the bug

Pressing down two keys in a row only creates one key down sound. That is until the first key is released, at which point another key down sound will be played for the second key that was pressed down. But that sound is played out of sync with when that key was pressed.

To reproduce

PressDown KeyA, (hear keypress sound)
PressDown KeyB (Don't hear a keypress sound)

Expected behavior

A Keydown sound should be played each time a key is pressed down. Regardless of whether another key is already pressed down or not.

Software information

  • Operating system:
    image

  • Rust version: cargo 1.75.0 (1d8b05cdd 2023-11-20)

  • Project version: daktilo 0.5.0

[Panic] Can not start if use event release

Describe the bug

To reproduce

[[sound_preset]]
name = "holy_panda"
key_config = [
  { event = "press", keys = "Return", files = [
    { path = "/Users/XXX/go/src/github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/holy-panda/press_enter.mp3", volume = 2.0 },
  ] },
  { event = "press", keys = "Backspace", files = [
    { path = "/Users/XXX(/go/src/github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/holy-panda/press_back.mp3", volume = 2.0 },
  ] },
  { event = "press", keys = "Space", files = [
    { path = "/Users/XXX/go/src/github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/holy-panda/press_space.mp3", volume = 2.0 },
  ] },
  { event = "press", keys = ".*", files = [
    { path = "/Users/XXX/go/src/github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/holy-panda/press_key1.mp3", volume = 2.0 },
    { path = "/Users/XXX/go/src/github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/holy-panda/press_key2.mp3", volume = 2.0 },
    { path = "/Users/XXX/go/src/github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/holy-panda/press_key3.mp3", volume = 2.0 },
    { path = "/Users/XXX/go/src/github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/holy-panda/press_key4.mp3", volume = 2.0 },
    { path = "/Users/XXX/go/src/github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/holy-panda/press_key5.mp3", volume = 2.0 },
  ], strategy = "random" },
  { event = "release", keys = ".*", files = [
    { path = "/Users/XXX/go/src/github.com/nathan-fiscaletti/keyboardsounds/keyboardsounds/profiles/holy-panda/release_key.mp3", volume = 1.0 },
  ] },
]

Expected behavior

It starts nomarlly

Screenshots / Logs

➜  ~ RUST_BACKTRACE=full daktilo --preset holy_panda
2023-10-05T02:44:44.555053Z  INFO daktilo: Starting...
thread '<unnamed>' panicked at 'index out of bounds: the len is 0 but the index is 0', /Users/XXX/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rodio-0.17.1/src/decoder/symphonia.rs:175:22
stack backtrace:
   0:        0x102ff89a8 - __mh_execute_header
   1:        0x102ec811c - __mh_execute_header
   2:        0x102fd92a0 - __mh_execute_header
   3:        0x102ffc144 - __mh_execute_header
   4:        0x102ffbd7c - __mh_execute_header
   5:        0x102ffcc68 - __mh_execute_header
   6:        0x102ffc7e0 - __mh_execute_header
   7:        0x102ffc754 - __mh_execute_header
   8:        0x102ffc748 - __mh_execute_header
   9:        0x103062638 - __mh_execute_header
  10:        0x103062688 - __mh_execute_header
  11:        0x102f07180 - __mh_execute_header
  12:        0x102f05e44 - __mh_execute_header
  13:        0x102f00040 - __mh_execute_header
  14:        0x102effc84 - __mh_execute_header
  15:        0x102eff4d4 - __mh_execute_header
  16:        0x102fcb5d4 - __mh_execute_header
  17:        0x102fcbb40 - __mh_execute_header
  18:        0x10339a7ac - _DefaultOutputAUFactory
  19:        0x1034999dc - _AUNotQuiteSoSimpleTimeFactory
  20:        0x10339eb58 - _AUGenericOutputFactory
  21:        0x183a110b0 - <unknown>
  22:        0x183a0e4e0 - <unknown>
  23:        0x183b97cb8 - <unknown>
  24:        0x1811f7034 - __pthread_joiner_wake
fatal runtime error: Rust panics must be rethrown
[1]    92809 abort      RUST_BACKTRACE=full daktilo --preset holy_panda

Software information

  • Operating system: macOS 14.0
  • Rust version: rustc 1.72.1 (d5c2e9c34 2023-09-13)
  • Project version: 0.2.0

Additional context

Only this mp3 is error, another mp3 plays fine. I don't use Rust but as I read logs, it seems the panic in the lib rodio 0.17.1.

Cargo install fails due to `alsa-sys v0.3.1`

Describe the bug

I tried to install the application via cargo install daktilo, as well as trying to build it from source.
Both failed with the following error:

error: failed to run custom build command for `alsa-sys v0.3.1`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installHCNasU/release/build/alsa-sys-86bfac132807354d/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=ALSA_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=ALSA_STATIC
  cargo:rerun-if-env-changed=ALSA_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  thread 'main' panicked at /home/jonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/alsa-sys-0.3.1/build.rs:13:18:

  pkg-config exited with status code 1
  > PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags alsa

  The system library `alsa` required by crate `alsa-sys` was not found.
  The file `alsa.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
  The PKG_CONFIG_PATH environment variable is not set.

  HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `alsa.pc`.

  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `daktilo v0.5.0`, intermediate artifacts can be found at `/tmp/cargo-installHCNasU`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

To reproduce
I'm using cargo 1.77.0 on Ubuntu 22.04.
Simply run cargo install daktilo.

Expected behavior

The install succeeds.

Screenshots / Logs

see above

Software information

  • Operating system: Ubuntu 22.04
  • Rust version: rustc 1.77.0 (aedd173a2 2024-03-17)
  • Project version: v0.5.0

Additional context

No sound after clean install.

Bug

No sound.

Reproduce

After a clean installation with:

cargo install daktilo

and run it simply as:

daktilo

it's not working, no sound at all.

Expected Behaviour

Normally, last night, I first install it on another device with almost same configuration. And it simply worked.

Log

~ Zacian* ❮ daktilo -c daktilo.toml -p musicbox -v > daktilo.log                                  15:24:59
�[2m2024-04-11T12:25:30.888671Z�[0m �[32m INFO�[0m �[2mdaktilo�[0m�[2m:�[0m Starting...
�[2m2024-04-11T12:25:30.889414Z�[0m �[34mDEBUG�[0m �[2mdaktilo�[0m�[2m:�[0m Config {
    sound_presets: [
        SoundPreset {
            name: "default",
            key_config: [
                KeyConfig {
                    event: KeyPress,
                    keys: Regex(
                        "Return",
                    ),
                    files: [
                        AudioFile {
                            path: "ding.mp3",
                            volume: Some(
                                1.0,
                            ),
                        },
                    ],
                    strategy: None,
                    variation: None,
                },
                KeyConfig {
                    event: KeyPress,
                    keys: Regex(
                        ".*",
                    ),
                    files: [
                        AudioFile {
                            path: "keydown.mp3",
                            volume: Some(
                                1.0,
                            ),
                        },
                    ],
                    strategy: None,
                    variation: Some(
                        SoundVariation {
                            volume: Some(
                                (
                                    0.1,
                                    0.1,
                                ),
                            ),
                            tempo: Some(
                                (
                                    0.05,
                                    0.05,
                                ),
                            ),
                        },
                    ),
                },
                KeyConfig {
                    event: KeyRelease,
                    keys: Regex(
                        ".*",
                    ),
                    files: [
                        AudioFile {
                            path: "keyup.mp3",
                            volume: Some(
                                1.0,
                            ),
                        },
                    ],
                    strategy: None,
                    variation: Some(
                        SoundVariation {
                            volume: Some(
                                (
                                    0.1,
                                    0.1,
                                ),
                            ),
                            tempo: Some(
                                (
                                    0.05,
                                    0.05,
                                ),
                            ),
                        },
                    ),
                },
            ],
            disabled_keys: None,
            variation: None,
        },
        SoundPreset {
            name: "basic",
            key_config: [
                KeyConfig {
                    event: KeyPress,
                    keys: Regex(
                        "Return",
                    ),
                    files: [
                        AudioFile {
                            path: "newline.mp3",
                            volume: None,
                        },
                    ],
                    strategy: None,
                    variation: None,
                },
                KeyConfig {
                    event: KeyPress,
                    keys: Regex(
                        ".*",
                    ),
                    files: [
                        AudioFile {
                            path: "keystroke.mp3",
                            volume: None,
                        },
                    ],
                    strategy: None,
                    variation: None,
                },
            ],
            disabled_keys: Some(
                [
                    UpArrow,
                    DownArrow,
                    LeftArrow,
                    RightArrow,
                    Backspace,
                ],
            ),
            variation: None,
        },
        SoundPreset {
            name: "musicbox",
            key_config: [
                KeyConfig {
                    event: KeyPress,
                    keys: Regex(
                        ".*",
                    ),
                    files: [
                        AudioFile {
                            path: "mbox1.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "mbox2.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "mbox3.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "mbox4.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "mbox5.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "mbox6.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "mbox7.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "mbox8.mp3",
                            volume: None,
                        },
                    ],
                    strategy: Some(
                        Random,
                    ),
                    variation: None,
                },
            ],
            disabled_keys: None,
            variation: None,
        },
        SoundPreset {
            name: "ducktilo",
            key_config: [
                KeyConfig {
                    event: KeyPress,
                    keys: Regex(
                        "Return",
                    ),
                    files: [
                        AudioFile {
                            path: "quack2.mp3",
                            volume: None,
                        },
                    ],
                    strategy: None,
                    variation: None,
                },
                KeyConfig {
                    event: KeyPress,
                    keys: Regex(
                        ".*",
                    ),
                    files: [
                        AudioFile {
                            path: "quack1.mp3",
                            volume: Some(
                                10.0,
                            ),
                        },
                    ],
                    strategy: None,
                    variation: None,
                },
            ],
            disabled_keys: None,
            variation: None,
        },
        SoundPreset {
            name: "drumkit",
            key_config: [
                KeyConfig {
                    event: KeyPress,
                    keys: Regex(
                        ".*",
                    ),
                    files: [
                        AudioFile {
                            path: "kick.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "hat.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "snare.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "kick.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "hat.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "kick.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "snare.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "hat.mp3",
                            volume: None,
                        },
                    ],
                    strategy: Some(
                        Sequential,
                    ),
                    variation: None,
                },
            ],
            disabled_keys: None,
            variation: None,
        },
        SoundPreset {
            name: "sparks",
            key_config: [
                KeyConfig {
                    event: KeyPress,
                    keys: Regex(
                        "Backspace",
                    ),
                    files: [
                        AudioFile {
                            path: "derase.mp3",
                            volume: None,
                        },
                    ],
                    strategy: Some(
                        Random,
                    ),
                    variation: None,
                },
                KeyConfig {
                    event: KeyPress,
                    keys: Regex(
                        ".*",
                    ),
                    files: [
                        AudioFile {
                            path: "dspark1.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "dspark2.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "dspark3.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "dspark4.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "dspark5.mp3",
                            volume: None,
                        },
                        AudioFile {
                            path: "dspark6.mp3",
                            volume: None,
                        },
                    ],
                    strategy: Some(
                        Random,
                    ),
                    variation: None,
                },
            ],
            disabled_keys: None,
            variation: None,
        },
    ],
    disable_easter_eggs: false,
}
�[2m2024-04-11T12:25:30.889623Z�[0m �[34mDEBUG�[0m �[2mdaktilo_lib�[0m�[2m:�[0m [
    SoundPreset {
        name: "musicbox",
        key_config: [
            KeyConfig {
                event: KeyPress,
                keys: Regex(
                    ".*",
                ),
                files: [
                    AudioFile {
                        path: "mbox1.mp3",
                        volume: None,
                    },
                    AudioFile {
                        path: "mbox2.mp3",
                        volume: None,
                    },
                    AudioFile {
                        path: "mbox3.mp3",
                        volume: None,
                    },
                    AudioFile {
                        path: "mbox4.mp3",
                        volume: None,
                    },
                    AudioFile {
                        path: "mbox5.mp3",
                        volume: None,
                    },
                    AudioFile {
                        path: "mbox6.mp3",
                        volume: None,
                    },
                    AudioFile {
                        path: "mbox7.mp3",
                        volume: None,
                    },
                    AudioFile {
                        path: "mbox8.mp3",
                        volume: None,
                    },
                ],
                strategy: Some(
                    Random,
                ),
                variation: None,
            },
        ],
        disabled_keys: None,
        variation: None,
    },
]
�[2m2024-04-11T12:25:30.947837Z�[0m �[34mDEBUG�[0m �[2mdaktilo_lib::app�[0m�[2m:�[0m Using output device: MacBook Pro Speakers
``

## SW information

- Operating system: MacOS Sonoma 14.4.1 (23E224)
- Rust version: rustc 1.78.0-nightly (878c8a2a6 2024-02-29)
- Project version: daktilo 0.6.0

## Additional

I simply began to question my ability to debugging Rust applicaitons. I believe it simply can't catch the key presses. It bizarre since I already gave the permission it needs.

Handle sigterm with distinct sound of broken machine

Is your feature request related to a problem? Please describe.

When I exit daktilo with ctrl-c for example, that would be fun to get a final sound of a broken machine or angry duck, depending on the selected profile 🦆

Describe the solution you'd like

Handling SIGTERM/SIGKILL would help for that

Describe alternatives you've considered

Additional context

Sound output doesn't switch to a newly selected audio device in Windows

Describe the bug

Daktilo does not redirect its sound output to the new default output device on windows if that is changed while the program is running.

(So if I switch to using my headphones for output, playback continues on the external speakers)

To reproduce

  1. Download daktilo-x86_64-pc-windows-msvc.zip for windows and run daktilo.exe
  2. Run Daktilo in Windows.
  3. Change the sound output from speakers to headphones.

Expected behavior

Sounds should start coming from my headphones, not remain coming from my speakers.

Software information

  • Operating system: Windows 11 Build 22H2
  • Rust version: n/a
  • Project version: 0.2.0

Continue playing previous sound instead of cutting it when the next key is pressed

Is your feature request related to a problem? Please describe.

When a new key is pressed while the previous sound is still playing the old sound is stopped

sink.stop();

Describe the solution you'd like

The old sound should continue playing at the same time as the new.

Describe alternatives you've considered

Additional context

I created this as a feature request, as both behaviours are valid. This should be configurable, but default should be to continue playing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.