让我们使用我们的 PC 键盘在终端中弹奏钢琴

觉得工作无聊? 来吧伙计们,让我们弹钢琴吧! 是的,你没看错。 谁需要真正的钢琴? 我们现在可以使用 PC 键盘从命令行弹奏或学习如何弹奏钢琴。 见面 钢琴师 – 一个简单的实用程序,用 Rust 编程语言编写,允许您使用 PC 键盘在终端中弹奏钢琴。 它是免费的、开源的,并在 MIT 许可下获得许可。 你可以在任何支持 Rust 的操作系统上使用它。

内容

  1. Piano-rs:使用我们的 PC 键盘在终端中弹奏钢琴
    1. 安装
    2. 用法
    3. 帮助我们帮助您:

Piano-rs:使用我们的 PC 键盘在终端中弹奏钢琴

安装

确保您的系统安装了 Rust 编程语言。 如果您尚未安装 Rust,请运行以下命令进行安装。

curl https://sh.rustup.rs -sSf | sh

安装程序将询问您是要使用默认值继续安装还是自定义安装或取消安装。 我想用默认值安装它,所以我输入了 1 (第一)。

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/env

注销或重新启动系统以更新 PATH 变量中货物的 bin 目录。

验证 Rust 是否已正确安装:

$ rustc --version rustc 1.21.0 (3b72af97e 2017-10-09)

伟大的! Rust 安装成功。 是时候构建钢琴-rs 应用程序了。

Git 使用以下命令克隆 Piano-rs 存储库:

git clone https://github.com/ritiek/piano-rs

上述命令将在当前工作目录中创建一个名为“piano-rs”的目录并下载其中的所有内容。 切换到该目录:

cd piano-rs

最后,运行以下命令来构建 Piano-rs:

cargo build --release

编译过程需要一段时间。

用法

编译过程完成后,从 钢琴师 目录:

./target/release/piano-rs

这是我们在终端中的钢琴键盘! 是时候演奏一些音符了。 按这些键弹奏音符。 利用 左右 箭头键在播放时调整音符频率。 并且,使用 上/下 箭头在播放时调整音符持续时间。

Piano-rs 使用与 多人钢琴网. 或者,使用 这些笔记 学习演奏各种流行歌曲。

查看帮助部分。 类型:

$ ./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)

我必须承认这是一个超级酷的项目。 对于那些买不起钢琴的人,请使用此应用程序。

祝您周末愉快!

干杯!

资源:

  • Piano-rs GitHub 存储库

感谢您的光临!

帮助我们帮助您:

  • 订阅我们的电子邮件通讯: 立即注册
  • 支持 OSTechNix: 通过贝宝捐款
  • 下载免费的电子书和视频: TradePub 上的 OSTechNix
  • 联系我们: Facebook | 推特 | 谷歌加 | 领英 | RSS订阅

祝你有美好的一天!!

CLILinuxPiano 在 TerminalRust 中播放钢琴