首页 培训网 最新资讯 热门问答

Linux认证

15110074071 免费试听 在线客服

您的位置: 北京培训网 > Linux认证培训资讯 > Linux知识培训哪家好 千锋教你在键盘上弹钢琴

Linux知识培训哪家好 千锋教你在键盘上弹钢琴

来源:教育联展网 | 发布时间: | 编辑:佚名

厌倦了工作?那么来吧,让我们弹弹钢琴!是的,你没有看错,根本不需要真的钢琴。千锋老师可以教你用 PC 键盘在命令行下就能弹钢琴。向你们介绍一下 piano-rs —— 这是一款用 Rust 语言编写的,可以让你用 PC 键盘在终端弹钢琴的简单工具。它自由开源,基于 MIT 协 议。你可以在任何支持 Rust 的操作系统中使用它。

 

   

Linux知识培训哪家好 千锋教你在键盘上弹钢琴


厌倦了工作?那么来吧,让我们弹弹钢琴!是的,你没有看错,根本不需要真的钢琴。千锋老师可以教你用 PC 键盘在命令行下就能弹钢琴。向你们介绍一下 piano-rs —— 这是一款用 Rust 语言编写的,可以让你用 PC 键盘在终端弹钢琴的简单工具。它自由开源,基于 MIT 协 议。你可以在任何支持 Rust 的操作系统中使用它。

piano-rs:使用 PC 键盘在终端弹钢琴

安装

确保系统已经安装了 Rust 编程语言。若还未安装,运行下面命令来安装它。

curl https://sh.rustup.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 2018-10-12, rust version 1.21.0 (3b72af97e 2018-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 2018-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 2018-10-09)

太棒了!Rust 成功安装了。是时候构建 piano-rs 应用了。

使用下面命令克隆 Piano-rs 仓库:

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

上面命令会在当前工作目录创建一个名为piano-rs的目录并下载所有内容到其中。进入该目录:

cd piano-rs

末了,运行下面命令来构建 Piano-rs:

cargo build --release

编译过程要花上一阵子。


用法

编译完成后,在piano-rs目录中运行下面命令:

./target/release/piano-rs

这就是我们在终端上的钢琴键盘了!可以开始弹指一些音符了。按下按键可以弹奏相应音符。使用左/右方向键可以在弹奏时调整音频。而,使用上/下方向键以在弹奏时调整音长。

Piano-rs 使用与 multiplayerpiano.com一样的音符和按键。另外,你可以使用这些音符来学习弹指各种流行歌曲。

要查看帮助。输入:

$ ./target/release/piano-rs -h

piano-rs 0.1.0

Ritiek Malhotra <ritiekmalhotra123@gmail.com>

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)

我必须承认这是个超级酷的项目。那些手头比较紧却想玩钢琴的同学,很适合使用这款应用。

咨询报名电话:010-64707530  金老师 

 

热门机构推荐
Linux认证

免费体验课开班倒计时

11: 41: 09

稍后会有专业老师给您回电,请保持电话畅通

咨询电话:15110074071

本周热门资讯

全国分站 热门机构

北京Linux认证培训 上海Linux认证培训 广州Linux认证培训 深圳Linux认证培训 杭州Linux认证培训 苏州Linux认证培训 南京Linux认证培训 天津Linux认证培训 佛山Linux认证培训 南宁Linux认证培训 长沙Linux认证培训 重庆Linux认证培训 太原Linux认证培训 青岛Linux认证培训 宁波Linux认证培训 郑州Linux认证培训 西安Linux认证培训 厦门Linux认证培训 武汉Linux认证培训 成都Linux认证培训 无锡Linux认证培训 济南Linux认证培训 昆明Linux认证培训 贵阳Linux认证培训 扬州Linux认证培训 徐州Linux认证培训 珠海Linux认证培训 合肥Linux认证培训 长春Linux认证培训

广州东方瑞通教育天津优就业IT培训佛山达内IT教育珠海达内教育

申请试听名额

已有10254人申请免费试听

01电话咨询 | 15110074071

QQ:2645567689
加盟合作:0755-83654572

今日已有25人申请,本月限额500