• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Read wave file in as a float value

 
Jody Monahan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to read a .wav file into an applet as a float array value from a HTML page? I have a .wav file saved on a server and I would like to be able to manipulate the values of the file from an applet.

Anyone got any ideas?

Thanks
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would that float array contain - the pitch over time?

The javax.sound.sampled package has classes for dealing with WAV files; see http://www.exampledepot.com/egs/javax.sound.sampled/Load.html for an example. Some of the involved classes may let you get closer to the audio data.
 
Jody Monahan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes my float array would contain the amplitude over time ie an array with values between -1 and 1.

My question however is if it is possible to read a .wav file into the applet from a remote server. For example, if I have a HTML page that passes the .wav file as a parameter:



It is possible to get the value of the parameter "number" using the getParameter("number") method. Is it possible to read the contents of the .wav file into a float array from the HTML page?

Thanks.

 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, it's more complicated than that. The "From URL" part of the code sample shows how to load a file from the server.
 
Jody Monahan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Again, thanks for the reply Ulf. Is there any way, to your knowledge that you can get the AudioInputStream as a float array value?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From an AudioInputStream you can obtain an AudioFormat object, about which its javadocs state "By examing the information stored in the audio format, you can discover how to interpret the bits in the binary sound data." There's also more information on how to go about this.
 
Jody Monahan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again Ulf, I'll look into it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic