Convert Text to audio file like .wav or .au in java - java

i want to create audio file using text. in this case i tried AudioOutputStream and AudioSystem.write() methods this way audio file created but problem in running. so if any idea that helps for converting text to audio file please write below.
thank you.
Piyush

If you want to make some kind of "text to speech" you'll need a library, which will handle this. Otherwise you will have a lot of work. Try this project:
http://freetts.sourceforge.net/docs/index.php

You think creating audio from text is as simple as writing text data to an audio stream ? ...
LOL
To convert text to audio, you have to rely upon rather complicated tools, like text-to-speech engines.
Hopefully, java is known for the forrest of many trees. Concerning text-to-speech, you can rely upon this excellent question and its anwsers.

Related

Writing Wav Files of Unknown Length (Java)

I am trying to add a feature to some audio processing software I have written.
My software already captures sound from a microphone input, processes it in real time, and sends the result to a speaker output. (This is already a threaded application.) I've been using javax.sound.sampled.* and working with wav data (transforming it to and from numerical samples to do the processing.
I would like to add a feature to save both the raw input and the transformed output of a session with this software to wav files. But the signature for creating a new wav file (e.g., WavFile.newWavFile(...) seems to want to know in advance how many frames of data it is going to receive. Since these are live sessions of indeterminate time, I have no way of knowing this information before hand.
Am I missing something? Is there some way around this, other than a hack like saving files of data or samples, and then post-processing it?
Most audio file writers need to know the full file size before writing to an output stream. There's an open source project called Tritonus which is an implementation of the Java sound API that has an AudioOutputStream plugin you could try.

concatenate multiple audio files in java

i have a java text-to-speech project and I want to concatenate the multiple audio files('ogg' format) so that i play them in one stream, anyone has any idea about it? can java do this? if you can lead me to any resource or tutorial or anything helpful I will be very pleased,
thanks a lot.
For concatenation I would use some external command-line tool via Runtime.exec() or ProcessBuilder.
Probably, oggcat should work in your case: http://en.flossmanuals.net/ogg-theora/command-line-editing/cat-files/ (it's about video, but ogg container is the same, make sense to try, anyway)
As for playing, there is JOrbis library and probably something else.

Matching audio files with text using java

I have a collection of audio files. Now, I have a piece of text (say a lyric) that i want to match with the audio files? In other words, which audio file contains this lyric. I am curious how we can do this in Java. I would prefer a solution that uses preprocessing of the audio files so that the search is fast. Is there any API that can help?
Recognizing words is hard. Recognizing words in songs is even harder.
It sounds like you are not interested in how to do that, but more to locate things in your song database. If so, the simplest way to do so, may be to locate lyrics for each song based on its title and other meta data, and then just search in that text.
For that you'd need speech recognition. The JSAPI might be a way to go, but last time I checked, only text-to-speech parts (they are plug-ins provided by 3rd parties) were available, not the other way around.

Record Audio As Mp3

I want to record audio and save to my server as mp3 files, i googled and find like this
But it is not free and open source
How can i record audio as mp3 in java and php ?
In terms of Java, you could record with standard Java sound and then use something like lameonj to do the mp3 encoding - all free tools!
This question is the same as yours and the person was able to come up with a solution (which he posted as an answer).
A little additional information. It is possible to record sound in an applet. See this page for information on Java Sound and applets. You'll need to sign your applet, which isn't hard to do. The answer to question 5 doesn't mention this but you can create your own (untrusted) certificate with which to do the signing. This question here on SO has some information on self-signing code.
I solved my problem, I used lame library to encode mp3, If you want to pure code to encode mp3, you can use this
Its using java based lame library

100% Java encoder for AVI animation

I am looking for a 100% Java solution for encoding software generated images into an AVI stream together with an uncompressed audio track.
At the moment I am using JMF, but its size and installation problems make it a bad solution for my purpose.
While it does not support audio, I created an MJPEG AVI Java class some years ago. You basically just tell it the resolution of your output video, along with the frame rate, then you just keep adding images to it. When you are done, you tell it to finish and it'll close out the AVI. It is based off of the Microsoft documentation on AVI, RIFF, and BITMAP file formats.
Other than not supporting audio, the only real problem is it implements the version of the AVI format limited to 2GB per file. While the class will write out a much larger file, I am uncertain that any players or video editors would be able to read it.
The way I've used this code in the past, is to generate an MJPEG AVI for processing in a video editor (adding audio, etc. in the editor). It helped me with automating some tedious slide show generation. Not sure if this code will help you, as is, but it might help if you are trying to roll your own solution. MJPEGGenerator.java is available if you are interested!
You can use JMF, see this nice example.
There is a nice blog entry here:
http://www.randelshofer.ch/blog/2008/08/writing-avi-videos-in-pure-java/
By Werner Randelshofer

Categories