Skip to content

Instantly share code, notes, and snippets.

@asubb
Created April 10, 2020 21:01
Show Gist options
  • Save asubb/b86a027140a1ebaaa849c42de451549f to your computer and use it in GitHub Desktop.
Save asubb/b86a027140a1ebaaa849c42de451549f to your computer and use it in GitHub Desktop.
wave-blog/using-jupyter/short.signal.kt
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