• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Read wave file in as a float value

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks again Ulf, I'll look into it.
 
Can you really tell me that we aren't dealing with suspicious baked goods? And then there is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic