Skip to content

Instantly share code, notes, and snippets.

@gre
Created August 2, 2012 16:01
Show Gist options
  • Select an option

  • Save gre/3238163 to your computer and use it in GitHub Desktop.

Select an option

Save gre/3238163 to your computer and use it in GitHub Desktop.
Pure Enumeratee-based sound generation POC for Zound PlayFramework experiment
object Application extends Controller {
val buffSize = 10000
var f = 200.
val rawStream = {
var i = 0;
val ticker = Enumerator.generateM[Int]({
i += 1;
Promise.timeout(Some(i), (1000.*buffSize.toDouble/44100.).toInt)
}) // These lines are very crap, but it works, we need a REAL ticker
val sine = Enumeratee.map[Int]({ i =>
(0 until buffSize).map { j =>
math.sin((i.toDouble+j.toDouble/buffSize)*f)
}.toArray
})
ticker &> sine
}
// ... (see http://github.com/gre/zound)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment