日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

Linux用键盘演奏音乐,分享|让我们使用 PC 键盘在终端演奏钢琴

發布時間:2023/12/29 linux 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux用键盘演奏音乐,分享|让我们使用 PC 键盘在终端演奏钢琴 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

厭倦了工作?那么來吧,讓我們彈彈鋼琴!是的,你沒有看錯,根本不需要真的鋼琴。我們可以用 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 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

上面命令會在當前工作目錄創建一個名為 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

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)

我必須承認這是個超級酷的項目。對于那些買不起鋼琴的人,很推薦使用這款應用。

祝你周末愉快!!

此致敬禮!

本文由 LCTT 原創編譯,Linux中國 榮譽推出

總結

以上是生活随笔為你收集整理的Linux用键盘演奏音乐,分享|让我们使用 PC 键盘在终端演奏钢琴的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。