Created
March 22, 2018 21:39
-
-
Save killercup/d45e94236444e4ef23a1c07118674fd3 to your computer and use it in GitHub Desktop.
midimacro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[package]] | |
name = "alsa-sys" | |
version = "0.1.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", | |
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "approx" | |
version = "0.1.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "bitflags" | |
version = "1.0.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "byteorder" | |
version = "1.2.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "cgmath" | |
version = "0.14.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", | |
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "claxon" | |
version = "0.3.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "coreaudio-rs" | |
version = "0.7.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
"coreaudio-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "coreaudio-sys" | |
version = "0.1.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "cpal" | |
version = "0.6.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"alsa-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
"coreaudio-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", | |
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", | |
"ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
"stdweb 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", | |
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "fuchsia-zircon" | |
version = "0.3.3" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
"fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "fuchsia-zircon-sys" | |
version = "0.3.3" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "hound" | |
version = "1.1.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "kernel32-sys" | |
version = "0.2.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", | |
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "lazy_static" | |
version = "0.2.11" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "lazy_static" | |
version = "1.0.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "lewton" | |
version = "0.5.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
"ogg 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "libc" | |
version = "0.2.39" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "midi-macro" | |
version = "0.1.0" | |
dependencies = [ | |
"rodio 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "num-traits" | |
version = "0.1.43" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "num-traits" | |
version = "0.2.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "ogg" | |
version = "0.4.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "ole32-sys" | |
version = "0.2.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", | |
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "pkg-config" | |
version = "0.3.9" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "rand" | |
version = "0.3.22" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | |
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", | |
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "rand" | |
version = "0.4.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | |
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", | |
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "rodio" | |
version = "0.6.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"cgmath 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
"claxon 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
"cpal 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
"hound 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
"lewton 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "stdweb" | |
version = "0.1.3" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "winapi" | |
version = "0.2.8" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "winapi" | |
version = "0.3.4" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "winapi-build" | |
version = "0.1.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "winapi-i686-pc-windows-gnu" | |
version = "0.4.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "winapi-x86_64-pc-windows-gnu" | |
version = "0.4.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[metadata] | |
"checksum alsa-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9013f855a808ab924a4c08b5c1ec9bd6b04fdb2295b4d570fb723e0ed2802a4f" | |
"checksum approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08abcc3b4e9339e33a3d0a5ed15d84a687350c05689d825e0f6655eef9e76a94" | |
"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf" | |
"checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23" | |
"checksum cgmath 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "87f025a17ad3f30d49015c787903976d5f9cd6115ece1eb7f4d6ffe06b8c4080" | |
"checksum claxon 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "84d1237389598ada39533a0015b2d04a9e21cae771c1ab9327fb87520c9e84c7" | |
"checksum coreaudio-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "22ec432725379967f9014b481afcb7c07a4fb154d836d3711730972ea91675ea" | |
"checksum coreaudio-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "31231897622a4cd14cb211af6f26d6fcf0c78078fa60c586ce9db8f0b581cd44" | |
"checksum cpal 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b609483a9b9dbd787bc34d0da25924f161411a70673a20d2241ce3eb81f2f65e" | |
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" | |
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" | |
"checksum hound 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7cb2af8cad251a1869dbc6ae1ae744b849a32458be4aee82cba93481847656a8" | |
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" | |
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" | |
"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d" | |
"checksum lewton 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c1b7b81410f7895d4793bae921cc62317c5500c6ef211c9c24cad778eda77c20" | |
"checksum libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)" = "f54263ad99207254cf58b5f701ecb432c717445ea2ee8af387334bdd1a03fdff" | |
"checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" | |
"checksum num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dee092fcdf725aee04dd7da1d21debff559237d49ef1cb3e69bcb8ece44c7364" | |
"checksum ogg 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "013b78ceb7fb82555a2f8a95d8e40866fe64a5d15b83c51b3e1fdd40cd903ed3" | |
"checksum ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2c49021782e5233cd243168edfa8037574afed4eba4bbaf538b3d8d1789d8c" | |
"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" | |
"checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" | |
"checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5" | |
"checksum rodio 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "82135109701c376f94274aa396a166f59e2bd109978b0ed63b8bf87ef8bba366" | |
"checksum stdweb 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e" | |
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" | |
"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3" | |
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" | |
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" | |
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "midimacro" | |
version = "0.1.0" | |
authors = ["Pascal Hertleif <killercup@gmail.com>"] | |
[[bin]] | |
name = "midimacro" | |
path = "main.rs" | |
[dependencies] | |
rodio = "0.6.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate rodio; | |
use std::time::Duration; | |
fn main() { | |
use rodio::Source; | |
let endpoint = rodio::default_endpoint().unwrap(); | |
let sink = rodio::Sink::new(&endpoint); | |
macro_rules! notes { | |
($($pitch:tt $len:tt),+) => ({ | |
$( | |
sink.append( | |
rodio::source::SineWave::new($pitch).take_duration(Duration::from_millis($len * 75)) | |
); | |
)* | |
}); | |
} | |
notes!( | |
340 4, 200 1, | |
380 4, 200 1, | |
400 2, 200 1, | |
440 2, 200 1, | |
200 1, 133 1, 133 1, | |
300 2, 200 1, | |
340 2, 200 1, | |
550 2, 590 3, 550 3, 500 2 | |
); | |
sink.sleep_until_end(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment