简体   繁体   中英

Is it possible to write an audio file directly from Ruby?

While I am sure that Ruby is not fast enough to do real time audio, I wonder if there is a way to write audio arrays directly in ruby, and mix these down to a wav/aiff format. I suspect that there is a problem with this method (too slow perhaps?) because I have never seen an implementation.

I have used the raiff gem to do this, although I would have preferred sndfile https://github.com/ronen/sndfile or ruby-audio https://github.com/fugalh/ruby-audio if it wasn't for trouble with dependencies on the Mac. The latter works with narray for handling audio sample data, which is quite speedy, and if you are feeling advanced then you can also play with frequency-domain processing using fftw3

Also, for an implementation of a Ruby drum machine, take a look at "beats": https://github.com/jstrait/beats

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM