How to play 2 audio simultaneously in java? - java

Basic idea is to combine images, voice and background music to create a single movie. I am able to do the same with images and voice audio (single audio) but now i want to add 2 audio files for the same.
Please help.

You need to load the two sound clips into memory as a single unit, then play them.
Refer to http://www.java-gaming.org/index.php?topic=1948.0 for a great example of how to do this.

I found this solution which worked for me on Ubuntu 11.10
http://www.jsresources.org/examples/AudioConcat.html
with source code.

Related

Simple video player by displaying frames: library/language change?

I'm trying to write a bare-bones video player in C#. Currently, I'm using Accord.Video.FFMPEG, but I'm having to lug around about 20 extra dll files as part of the ffmpeg wrapper. I really don't need any bells and whistles--this video player is a very small part of a much larger application. I need to be able to grab frames as individual images to put in a windows form picturebox, and that's it. I don't want to have to rely on a separate instance of vlc or windows media player or any of that jazz. The videos I'm playing are mp4s created with opencv. Any idea what library is easiest to pull from for this?
I don't want to use Accord anymore partially because it relies on previous versions of MS Runtimes which I can no longer install--this application is going on other PCs, and I want the install to be as easy as possible.
Would it be easier/are there more media library options for C++ or Java?

LibGDX - Music problems

WHAT I KNOW...
In LibGDX there are 2 classes for playing music/sounds. Music.java and Sound.java.
When you want to play a short sound(less than 1m), it is a good practice to use Sound.java class, because it loads to the memory.
When you want to play long music (more than 1m), it is a good practice to use Music.java class, because it doesn't load in memory, but use streaming to play it.
WHAT I DO...
I use Music.java class in order to play background and loading music in my game.
WHAT PROBLEM I HAVE...
The problem is when I play music using Music.java class and when I read from disk some data (atlasses, for example), the music plays with jitter. So, as I understand, that the problem is in streaming, as I have that problem when I read from disk only. It seems, there is no way to open 2 fully separate threads for streaming. I mean, one for music and another for all other things such us read from a file or write. I tried to play the music in the new thread, but nothing changed.
Any ideas?
Thanks.

VLC (J) audio pitch control

I'm currently developing simple video player with VLCJ.
Can anyone please point me some clue about changing audio pitch with it?
is it possible?
I've searching through but cannot find the right keyword, what i need is
some control (method/function) of vlcj (or any) to increase sound so it sounds like
kids voice, or lower down so make like a very old man sound.
Thanks in advance.
NOTE:
still looking on google but found nothing about vlc. what i want is something about the "timbre" as explained at http://www.screamingbee.com/support/morphdoc/MorphDocPitchTimbre.aspx
If you are only interested in playing audio (you don't care about displaying any video at the same time) then vlcj 2.4.0 and later provide a so-called "direct" audio player component.
With this component, your Java application can get direct access to the native audio sample buffer. You can run whatever algorithm you want on those samples, then play out your modified samples via JavaSound or some other API.
There is a sample included in the vlcj distribution that shows how to use this component to play via JavaSound:
https://github.com/caprica/vlcj/tree/vlcj-2.4.1/src/test/java/uk/co/caprica/vlcj/test/directaudio
The example does not show how to change the pitch of the audio, but it does show how to use the direct audio player.

How do I play non-sine notes on Android? MIDI?

I'm writing an accompaniment application that continuously needs to play specific notes (or even chords). I have a thread running that figures out which note I need to play, but I have no idea where to begin regarding the actual playback. I know I can create an audiotrack and write a sine wave to it, but for this project a simple tone won't cut it. So I'm guessing I either need to use MIDI (can android do that?) or to somehow take a sample and change its pitch on the fly, but I don't know if that's even possible.
All I can say is to check out pitch-shifting (which you seem to have heard of) and soundpool (which would require some recording of your own) and these 2 links:
Audio Playback Rate in Android
Programmatically increase the pitch of an array of audio samples
the second link seems to have more info.

Best way to play a radio stream ( shoutcast ) in Java?

I want to code an audio player in Java. java.JavaFX has a very nice support for mp3 playing but I want in my player also the possibility to listen to radio.
The problem is I have searched for some time and I didn't find something that works like I want:
MP3SPI - this is nice but just wont
play some streams
vlcj - I've tested the latest version
1.2.0 but was with a beta version of VLC so I had times when the stream
just stopped for no reason.
NativeSwing's windows media player
but that is a heavyweight component
and also I don't want to make it
dependable on WMP.
So I'm kind of out of luck. Well guys If you know more about this topic please share it!
Thank you!
MP3 playback in Java is a bitch. In nearly any case it's not worth the work you put in it.
However, this is something that worked for me. It can easily be recoded to play Shoutcast streams.
JavaLayer (library behind MP3SPI) is a mature project and should handle most streams, can you post some streams that it can not read? Check that other players using JavaLayer, like jlGUI, can play these streams. Maybe it's something with your code.

Categories

Resources