Hi all, I’m using Jorbis/Jogg to play ogg vorbis songs, but I don’t know how to change the volume?
Thanks
See ya
Hi all, I’m using Jorbis/Jogg to play ogg vorbis songs, but I don’t know how to change the volume?
Thanks
See ya
Do a search before you post. Someone asked this exact thing not too long ago.
Check this link.
http://forum.java.sun.com/thread.jspa?threadID=636859&messageID=3716189
Thanks for your help, but I don’t want to use JMF, I’m just using jorbis and I don’t want to change the file I’m reading from.
See ya
Up!
Nobody can answer to this question?
Please, please :’(
For Jack Flowers I’ve copied streamed ogg vorbis soundtracks into a Clip object for playback.
Once you’ve got a Line from the Clip, you can get a MASTER_GAIN control (line.getControl(FloatControler.MASTER_GAIN, if I remember well). and then you just change the gain (for example you set -10 to reduce your signe by 10db). In java 5, the line must be opened before getting the control.
With this method I’ve got some problems when invoking master gain many times for a fade out effect (sometimes the sound stop totally) but it might be because of a poor implementation from my side… I haven’t spent a lot of time on it yet.
You can also have a look at jsresources.org… may be you’ll find another way to acheive this.
But if anybody has a better (working) Fade In / Fade out please help us !!
Lilian
Do you have a reproducible test case?
Yep, I’d be also very interested in this.
I’m working on this… the simple test case seems to work fine (I’ve just adapted the GageSound 1.2 with vorbis SPI, and accessed the master gain control from the clip’s lines).
Here’s an example (you’ll have to install the vorbis java sound SPI to use it, or alternatively provide a long wav file). I haven’t digged into gagesound yet, but it seems to load everything into memory before playing.
Lilian
I tried your sample of code, but it doesn’t seem to work, maybe I’m soing somethig wrong: I get an javax.sound.sampled.UnsupportedAudioFileException when I try to run it using an ogg file, I’ve copied the javazoom vorbisspi into my jre/lib/exct directory and jorbis is installed…
I don’t understand, what am I doing wrong?
you must have a services file in the META-INF dir of one of your jars.
search for java sound services SPI
Lilian
You’re right, there are two files: javax.sound.sampled.spi.AudioFileReader
and javax.sound.sampled.spi.FormatConversionProvider
what shoud I do then?
I guess Audiofilereader contains a line like javazoom.spi…VorbisAudioFileReader
and the other file contains javazoom.spi…VorbisFormatConversionProvider
then with these files added to your jar and the appropriate jars (tritonus_share.jar, vorbis.jar) in your classpath, you should be able to read your ogg files (I can).
for my own tests I’ve not altered the jre directory : everything is in my application’s class path.
Lilian
Sorry for being such a newbie, but I still can’t use it…
I haven’t built any jar of my application software, I’m currently coding it under eclipse, what I want is to be able to test it directly.
I added the jorbis/jogg/vorbisspi/tritonus_share jars to my classpath and copied the files into my sound package, is this what I have to do?
Thanks again
I don’t know, I use netbeans and everything in my sources dir is added to the project jar…
Try and create a jar with just the META-INF/services data into it, and add it to your class path, it might work…
(If you don’t know how to create a jar… create a zip and rename it as .jar)
Lilian
That works, I just had to put tritaunus into my jre/lib/ext to make it work, thanks for your help c_lilian