Fühlen Sie sich bei der Arbeit gelangweilt? Los Leute, lasst uns Klavier spielen! Ja, du hast richtig gelesen. Wer braucht ein echtes Klavier? Wir können jetzt mit unserer PC-Tastatur von der Befehlszeile aus Klavier spielen oder lernen, wie man es spielt. Lernen Sie Piano-rs kennen - ein einfaches Dienstprogramm, geschrieben in der Programmiersprache Rust, mit dem Sie das Klavier im Terminal über die PC-Tastatur spielen können. Es ist kostenlos, Open Source und unter MIT-Lizenz lizenziert. Sie können es auf allen Betriebssystemen verwenden, die Rust unterstützen.
Piano-rs :Spielen Sie Klavier im Terminal mit unserer PC-Tastatur
Installation
Stellen Sie sicher, dass auf Ihrem System die Programmiersprache Rust installiert ist. Wenn Sie Rust noch nicht installiert haben, führen Sie den folgenden Befehl aus, um es zu installieren.
curl https://sh.rustup.rs -sSf | sh
Das Installationsprogramm fragt Sie, ob Sie die Installation mit Standardwerten fortsetzen oder die Installation anpassen oder die Installation abbrechen möchten. Ich möchte es mit Standardwerten installieren, also habe ich 1 eingegeben (Nummer eins).
info: downloading installer Welcome to Rust! This will download and install the official compiler for the Rust programming language, and its package manager, Cargo. It will add the cargo, rustc, rustup and other commands to Cargo's bin directory, located at: /home/sk/.cargo/bin This path will then be added to your PATH environment variable by modifying the profile files located at: /home/sk/.profile /home/sk/.bash_profile You can uninstall at any time with rustup self uninstall and these changes will be reverted. Current installation options: default host triple: x86_64-unknown-linux-gnu default toolchain: stable modify PATH variable: yes 1) Proceed with installation (default) 2) Customize installation 3) Cancel installation 1 info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' 223.6 KiB / 223.6 KiB (100 %) 215.1 KiB/s ETA: 0 s info: latest update on 2017-10-12, rust version 1.21.0 (3b72af97e 2017-10-09) info: downloading component 'rustc' 38.5 MiB / 38.5 MiB (100 %) 459.3 KiB/s ETA: 0 s info: downloading component 'rust-std' 56.7 MiB / 56.7 MiB (100 %) 220.6 KiB/s ETA: 0 s info: downloading component 'cargo' 3.7 MiB / 3.7 MiB (100 %) 173.5 KiB/s ETA: 0 s info: downloading component 'rust-docs' 4.1 MiB / 4.1 MiB (100 %) 224.0 KiB/s ETA: 0 s info: installing component 'rustc' info: installing component 'rust-std' info: installing component 'cargo' info: installing component 'rust-docs' info: default toolchain set to 'stable' stable installed - rustc 1.21.0 (3b72af97e 2017-10-09) Rust is installed now. Great! To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH environment variable. Next time you log in this will be done automatically. To configure your current shell run source $HOME/.cargo/envaus
Melden Sie sich ab oder starten Sie Ihr System neu, um das bin-Verzeichnis der Fracht in Ihrer PATH-Variablen zu aktualisieren.
Überprüfen Sie, ob Rust richtig installiert wurde oder nicht:
$ rustc --version rustc 1.21.0 (3b72af97e 2017-10-09)
Toll! Rust wurde erfolgreich installiert. Es ist an der Zeit, die piano-rs-Anwendung zu erstellen.
Git klont das Piano-rs-Repository mit dem folgenden Befehl:
git clone https://github.com/ritiek/piano-rs
Der obige Befehl erstellt ein Verzeichnis namens „piano-rs“ im aktuellen Arbeitsverzeichnis und lädt alle darin enthaltenen Inhalte herunter. Wechseln Sie in dieses Verzeichnis:
cd piano-rs
Führen Sie schließlich den folgenden Befehl aus, um Piano-rs zu erstellen:
cargo build --release
Der Kompilierungsprozess wird eine Weile dauern.
Nutzung
Führen Sie nach Abschluss des Kompilierungsprozesses den folgenden Befehl von piano-rs aus Verzeichnis:
./target/release/piano-rs
Hier ist unsere Klaviertastatur im Terminal! Es ist an der Zeit, ein paar Noten zu spielen. Drücken Sie die Tasten, um die Noten zu spielen. Verwenden Sie LINKS/RECHTS Pfeiltasten, um die Notenfrequenz während des Spielens anzupassen. Und verwenden Sie AUF/AB Pfeile, um die Notendauer während des Spielens anzupassen.
Piano-rs verwendet dieselben Noten und Tastenbelegungen wie multiplayerpiano.com . Alternativ können Sie diese Hinweise verwenden um zu lernen, verschiedene populäre Lieder zu spielen.
Um den Hilfebereich anzuzeigen. Typ:
$ ./target/release/piano-rs -h
piano-rs 0.1.0 Ritiek Malhotra <[email protected]> Play piano in the terminal using PC keyboard. USAGE: piano-rs [OPTIONS] FLAGS: -h, --help Prints help information -V, --version Prints version information OPTIONS: -c, --color <COLOR> Color of block to generate when a note is played (Default: "red") -d, --duration <DURATION> Duration to play each note for, where 0 means till the end of note (Default: 0) -s, --sequence <SEQUENCE> Frequency sequence from 0 to 5 to begin with (Default: 2)
Ich muss zugeben, dass es ein super cooles Projekt ist. Für diejenigen, die es sich nicht leisten können, ein Klavier zu kaufen, verwenden Sie diese Anwendung.
Viel Spaß und ein schönes Wochenende!!
Prost!