How to read and play realtime sound stream in java? - java

I'm using Java to read and play some real time audio streams such as the voice from radio station.
I have the real time web address like this one and it can be played in a web browser.
How can I play it using Java language?
Thanks.

MP3SPI is a Java Service Provider Interface that adds MP3 (MPEG 1/2/2.5 Layer 1/2/3) audio format support for Java Platform. It supports streaming, ID3v2 frames, Equalizer etc. It is based on JLayer and Tritonus Java libraries.
You can use this library MP3 SPI for Java Sound , and its documentation here.
Library reference

Related

Vlcj audio only player

I am creating a chat application where the user can send audio and video files.
For my video files I have successfully created an embedded video player in my app which will play any video.
But for my audio files I don't want to use an embedded video player with options vout=dummy instead I want to be optimized and use an DirectAudioPlayer for my purposes. I took a look at the MediaFactory create but i don't understand how am I suppose to retrieve these parameters for an specific file.
What I want is just one direct audio player in my application which I can reuse for multiple audio files or is this not possible?
You can use a HeadlessMediaPlayer.
This is basically the same as the EmbeddedMediaPlayer that you're already using, but with no API to do with displaying the video.
A word of caution though if you play a video through the HeadlessMediaPlayer, rather than just an audio file, LibVLC will open a native window and play the video - you can suppress this by passing "--no-video" via the MediaPlayerFactory.
The DirectAudioPlayer is used when you want to access the audio buffer in your application - i.e. "direct" access to the native audio buffer. You would then have to use JavaSound or something to actually play the audio. So I don't think this is what you want.

Audio file duration without AudioSystem class in Java (GAE)?

There is already a more general answer (Java) at https://stackoverflow.com/questions/3009908/how-do-i-get-a-sound-files-total-time-in-java but unfortunately
java.lang.NoClassDefFoundError: javax.sound.sampled.AudioSystem is a restricted class. Please see the Google App Engine developer's guide for more details.
AudioSystem is not on the Google App Engine JRE Class White List and therefore can't be used. Any other approach?
I have (already uploaded) audio files sitting on Google Cloud Storage (GCS) and I can load them into ByteArrayInputStream but somehow I need to convert them into AudioInputStream to get the audio file duration (and save the duration in the database).
A support ticket for Audio Manipulation API along the lines of the Images service is currently in WontFix status: https://code.google.com/p/googleappengine/issues/detail?id=1947, so it is unlikely that there will be support for this in near future. Issue was reopened again: https://code.google.com/p/googleappengine/issues/detail?id=6442
The solution at this point would be to work with external Audio APIs that are available as a Service. Maybe a list from ProgrammableWeb on Audio APIs could help.

Difference Java Media Framework API and FMJ

I want capture the data from scanner, camera, USB camera for all operating systems.
What is difference between Java Media Framework API and FMJ? Which API is better?
Update
Is there any possible to capture the data from scanner using JMF?
FMJ is an open source replacement for JMF.
It is able to capture live video from a USB camera using the LTI-CIVIL library.
There is no scanner integration AFAIK.
There are some libraries out there for java and scanners, open and closed source.
Have a look at jtwain, jsane, etc:
http://today.java.net/pub/a/today/2004/11/18/twain.html
http://asprise.com/product/jsane/index.php

Play mp3 file using pjsip

I am working on a project where I need to play audio files over VOIP channel. I am using OpenSource phone (SFLphone). I would like to know how to play an MP3 audio file over VOIP channel.
Application areas: Play audio lecture through VOIP channel.
Maybe you can try to use the Jack Audio Server for this purpose. Though, notice: This site is about programming. maybe this question is a little offtopic. Maybe you should try to make it on some other Stack Exchange site. If it doesn't apply to any other, then let it here.

Playing Live streamed audio through Java

Are there any java libraries out there that can handle live streamed audio such as an internet radio stream that can then be played back using Java?
I've looked into stuff like Xuggler/FFMpeg but I'm not sure if they can handle the fact that I'm just trying to play a live stream.
It would have to be able to handle most/all of the formats that internet radio stations usually stream in.
Thanks a lot.
You can have a look at JMF - Java Media Framework
http://en.wikipedia.org/wiki/Java_Media_Framework
http://www.oracle.com/technetwork/java/javase/tech/index-jsp-140239.html
On the Wikipedia site is also a list of alternatives:
Freedom for Media in Java (FMJ) An API-compatible with JMF alternative !
JavaSound
QuickTime for Java
IBM Toolkit for MPEG-4
Jffmpeg
jvlc
vlcj
gstreamer-java
Cortado, a complete player for Ogg Vorbis and Theora in a Java applet
Directshow <> Java Wrapper
Fobs4JMF
JLayer MP3 library
Xuggler
Video4Linux4Java

Categories