• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Sound Question

 
Chris Tuker
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been researching java sound output and haven't found anything that suit's my fancy... My goal is to create a waveform of 44,100 samples per second and output that data directly through the computer in real time. I don't need to save the file or load files, I just need to take raw data and put in into a buffer which will in turn play the sound. Sounds simple enough, but everything I find online seems to require having files first.

One alternative, however dirty it may be, would be to have one process create the sound and dump it into 1s sound files, then have another process load those files and play them back to back so as to make it seamless.

Any other ideas?
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not seeing that at all. I googled for "java sound output" and had a look at a tutorial from Oracle. Here's one excerpt from the chapter about "Reading Sound Files":
The tutorial wrote:The first of these is given by three variants of the getAudioFileFormat method:

static AudioFileFormat getAudioFileFormat (java.io.File file)
static AudioFileFormat getAudioFileFormat(java.io.InputStream stream)
static AudioFileFormat getAudioFileFormat (java.net.URL url)


No files-only requirement there, you can use any InputStream. I'm sure there's more like that. I wouldn't be surprised if you came across one of those cheapo "tutorials" which you don't even have to scroll down to read, and it only mentioned playing a sound clip from a file, but there's certainly more to it than that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic