aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Java Sound Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Java Sound Question" Watch "Java Sound Question" New topic
Author

Java Sound Question

Chris Tuker
Greenhorn

Joined: Dec 05, 2011
Posts: 1
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
Bartender

Joined: Oct 14, 2005
Posts: 18662
    
    8

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Sound Question