How to implement Voice Activity Detection in Java? - java

I need to implement a voice activity detection algorithm in Java so that I can know when to start and/or stop recording audio. I am looking for an algorithm that can take either a byte[], a target-data-line, or an audio file as input. Also, a solution would preferably not use external dependencies.

Give a look at TarsosDSP as source of inspiration: It is so far the best open source Java library to deal with Audio Detection. It is purely written in Java and briefly provides:
SoundDetection
PitchDetection
PercussionDetection
Audio Time Stretching
Pitch Shifting
IIR-filters
Check also the official paper and manual for a better grasp on the topic.

Related

Getting another Java Program's Sound

I'm writing a video recording program, and it's going quite well. I can record mic as well as video from the screen. However, I would also like to be able to obtain sounds from another Java program and then sync them with the video. Basically, record the audio as it is played by the other program.
Is there a way to accomplish this? I'm pretty new with sound, and have read a bit up on it. I think I need to set up a mixer, but I'm not sure if I can actually obtain sound from another Java program that way.
This is not possible with java sound, not because of any particular problem with java sound, but because not all audio APIs that java builds on support this feature. (Core audio on the mac for example, and ASIO on windows. Not sure about ALSA on linux, but I don't think it supports this either).
If you are on windows and want to write JNI/JNA code you can use PortAudio which supports this on one of the audio APIs (sorry I can't recall which one).

Which API: JavaFX or JMF is better for audio processing in Java?

I am doing a project in which I have to transform the audio data (which would be most probably in mp3, wav or wma format) into a waveform and also get the FFT and pitch for it along with the time in milliseconds at which the pitch change.
I am just confused whether which of these APIs is better? What are the limitations of each of these?
JMF is ancient, clunky, and basically unmaintained.
JavaFX may or may not support what you need, but at least it's on Oracle's radar for future development.
You may want to check out FMJ, which is basically an open source replacement for JMF after Sun dropped the ball with maintaining JMF:
http://fmj-sf.net/
I haven't used it, but it does seem to have quite a few users and recently committed code which is a good sign....

Falsify audio input from a microphone for another program in Java?

I have not looked into the Java Sound API too much before I had this idea,
so I went and looked at the Tutorial by Oracle concerning this topic.
I did not find what I was looking for, though...
Basically, I need to take the audio feed from the microphone input
and mix in another audio file. This would be for Skype, to play background music.
Now the important thing about this is that the modified audio feed
would have to be used BY Skype instead of the original microphone-only audio.
Is there any (easy?) way to achieve this?
Regards,
Tom S.

Only video plays not the sound. Why is that ?

I read this code to play video files using xuggler as a library.When i run this code , the video without sound plays.Why is that ?
If not what should i do to play audio with video.?
Quite simply, it's because that code doesn't play any audio. It was never written to do so!
If you want to play audio and video, check out the example here:
http://xuggle.googlecode.com/svn/trunk/java/xuggle-xuggler/src/com/xuggle/xuggler/demos/DecodeAndPlayAudioAndVideo.java
The question to me suggests that you've just grabbed the source without looking at the tutorials - I'd strongly suggest doing so so you can understand the code behind what's going on rather than just throwing it in there and expecting it to work - especially if you're planning on using Xuggler in any great depth!
As a further note, if all you want to do is play videos I probably wouldn't advise using Xuggler because it's just not really designed for that sort of thing. Sure it will play them, but you have to manage all the sync issues yourself (which the above example doesn't do a great job of), it will only use your CPU and therefore really eat into its consumption especially if you're doing things like HD video, and the sheer amount of background code is just overkill (getting the streams, finding the stream IDs, extracting each packet, determining the type of the packet, dealing with it appropriately, managing errors, etc. etc.) It's a great piece of software, but if you're only using it to play stuff then it'll probably give you far more trouble than its worth.
Instead I'd advocate having a play with VLCJ - it's a bit complicated to get set up to work reliably (out of process players are required for rock solid stability) but when you've got that far it plays near any file type under the sun and manages all the issues above for you much, much better than you'll ever cope with by hand!
My guess is that you have a missing audio codec. I've had this same issue but vice versa; the sound played but the video didn't.

Sequenced video playback (cutlists) in Java.. can it be done?

If I have a bunch of video files, all in precisely the same format, shape, whatever, then can I play them back seamlessly without jumps or gaps? The effect from the end user's point of view would be as though they are watching one video.
I understand that this is possible in DirectX, but I'd rather use Java if possible.
If you want to play media in Java, the Sun standard is JMF (http://java.sun.com/javase/technologies/desktop/media/jmf/) which unfortunately has been dormant for quite a while.
The FMJ project (http://fmj-sf.net/) is API-compatible and under active development.
I cannot answer your question better, but hopefully this can get you further.

Categories