Created
April 10, 2020 21:01
-
-
Save asubb/b86a027140a1ebaaa849c42de451549f to your computer and use it in GitHub Desktop.
wave-blog/using-jupyter/short.signal.kt
This file contains hidden or 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
val o = (880.sine() + 440.sine() + 220.sine()) | |
.trim(1000, MILLISECONDS) | |
val values = o.asSequence(44100.0f) | |
.drop(500) | |
.take(400) | |
.map { it.asDouble() } | |
.toList() | |
val values2 = o.asSequence(44100.0f) | |
.drop(510) | |
.take(400) | |
.map { it.asDouble() } | |
.toList() | |
val dataFrame = mapOf( | |
"index" to (0 until values.size).toList(), | |
"value" to values | |
) | |
val dataFrame2 = mapOf( | |
"index" to (0 until values2.size).toList(), | |
"value" to values2 | |
) | |
lets_plot() { x = "index"; y = "value" } + | |
geom_line(dataFrame, color = "blue") + | |
geom_line(dataFrame2, color = "red") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment