[Jprogramming] J audio?

John Randall randall at andromeda.rutgers.edu
Sun Dec 3 22:57:43 HKT 2006


Miller, Raul D wrote:
> Does anyone know how to play audio from J?

You need SoX <http://sox.sourceforge.net/>, and may have it already on
Linux.  This does conversions between various file formats, and in
particular supports a simple text file format.  Then it is easy to play
your example.

require 'files strings'
host=:[: 2!:0 '('"_ , ] , ' || true)'"_
sound=:1 o.440*2p1*(i.%])44100
time=:(i.%])44100
'sine.dat' fwrites~ '; Sample Rate 44100'
'sine.dat' fappends~ '_-' charsub 0j8": time,.sound
host 'play sine.dat'

John






More information about the Programming mailing list