• 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

Audio format conversion problems

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Before getting into details, let me first explain what it is I'm trying to do. The application I'm working on is supposed to be able to record a voice message from a person over the telephone in WAV format (via a VoiceXML client), store it in a database in MP3 format, and later play it back again over the phone in WAV format. Tritonus expects a stream for the encoding conversion, but the database expects a byte array. Everything works EXCEPT when I need to convert the audio data back to WAV format from the MP3 stored in the database. To perform the conversion, I'm using the Java Sound API with Tritonus. Here is the utility class I've developed to perform the conversions:

So say I have a byte[] called wav containing WAV data from the voice browser, and before I save it to the database, I want to convert it to MP3. I would do this:

This works perfectly. But now if I want play that audio clip back, I need to convert the MP3 data provided by the database back to WAV. So, naturally, I would write this:

But executing that code produces the following error:

Maybe I'm just too close to the problem (or too overworked...), but I just can't seem to figure out how to appease the AudioSystem's demand that I provide a stream length. Even after scouring the Javadoc and the Internet in general for two days, I remain unenlightened. So I turn to you, oh great JavaRanchers. Have you any idea why this is happening, and more importantly, what I can do to make it work!

Most humbly yours, with thanks in advance,

Robert J. Walker
[ January 06, 2005: Message edited by: Robert J. Walker ]
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am recording a voice message through mobile and sending to server in by array format through JSON, i want to convert byte array format voice message into appropriate audio format and store it in database. how implement this feature?? need help.....
 
Roses are red, violets are blue. Some poems rhyme and some don't. And some poems are a tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic