编译自:https://www。奥斯特尼克斯。com/let-us-play-piano-terminal-use-PC-keyboard/作者:Sk
译者:lujun9972
厌倦了工作?那来吧,我们来弹钢琴!是的,你没有看错。你根本不需要一架真正的钢琴。我们可以用PC键盘在命令行上弹钢琴。我给你介绍一下piano-rs ——,是用Rust语言写的。
一个简单的工具,可以让你用电脑键盘在终端上弹奏钢琴。它是基于MIT协议的免费开源软件。你可以在任何支持Rust的操作系统中使用它。
Piano-rs:在终端使用PC键盘弹钢琴,确保系统中已经安装了Rust编程语言。如果尚未安装,请运行以下命令进行安装。
Curlhttps://sh。拉斯特普。RS-SSF | sh (LCTT译:直接通过Curl执行远程shell脚本是非常危险和不成熟的。)
安装程序将询问您是默认安装还是自定义安装,或者取消安装。我想默认安装,所以我输入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
注销并重启系统,将cargo的bin目录包含在PATH变量中。
验证Rust安装是否正确:
$ rustc --version rustc 1.21.0 (3b72af97e 2017-10-09)
干得好!Rust安装成功。是时候构建piano-rs应用程序了。
使用以下命令克隆Piano-rs仓库:
上面的git clone https://github.com/ritiek/piano-rs's命令将在当前工作目录下创建一个名为piano-rs的目录,并将所有内容下载到其中。输入此目录:
Cd piano-rs最后,运行以下命令来构建piano-rs:
货物构建-发布编译过程需要一段时间。
用法编译后,在piano-rs目录下运行以下命令:/target/release/piano-rs这是我们在终端上的钢琴键盘!你可以开始用手指弹奏一些音符。按键播放相应的音符。播放时使用左/右箭头键调整音频。而且,
播放时使用向上/向下箭头键调整持续时间。
Piano-rs使用与multiplayerpiano.com[1]相同的音符和键。此外,你可以用这些音符[2]来学习演奏各种流行歌曲。
查看帮助。输入:
$ ./target/release/piano-rs -h piano-rs 0.1.0
Ritiek Malhotra
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 of block to generate when a note is played (Default: 'red')
-d, --duration Duration to play each note for, where 0 means till the end of note (Default: 0)
-s, --sequence Frequency sequence from 0 to 5 to begin with (Default: 2)
我必须承认这是一个超级酷的项目。对于买不起钢琴的人,强烈推荐这款app。
周末愉快!
此致敬礼!
via: https://www.ostechnix.com/let-us-play-piano-terminal-using-pc-keyboard/
作者:SK[3] 译者:lujun9972 校对:wxy
本文由LCTT 原创编译,Linux。。荣誉推出
点击“了解更多”可访问文内链接
标题:让我们使用 PC 键盘在终端演奏钢琴
链接:https://www.52hkw.com/news/rj/73658.html
版权:文章转载自网络,如有侵权,请联系删除!