I will soon be giving an informal talk where I need to play some
custom synthesized sounds. I ended up using pyalsaaudio (http://
sourceforge.net/projects/pyalsaaudio/files/) to play sounds, which
obviously only has a desirable effect if you're running your notebook
locally. The standard "ossaudiodev" might also be an option, but I did
not experiment with that. I've also had some success opening a pipe to
SoX play.

Writing the samples is just a matter of writing some cython code. You
can hand them back as a "string" (really just a byte buffer). Further
manipulations of samples can be done by python's standard "audioop"
module.

None of this is worth integrating in sage by default, but I found it
pretty convenient I could do it. I guess sound "objects" showing up in
the notebook (similar to plots) would probably have been acceptable
too, but with much higher overhead. I imagine letting the sage server
"push" sound can also work with a little javascript support.

I did find that the slow output update in the notebook was
problematic: when playing sounds it would have been nice to print the
frequency being played *right then*, which the notebook doesn't
normally do (let alone producing a plot of the waveform anywhere close
to real time).

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to