Quantcast

Sound finishes with a click.

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Sound finishes with a click.

TheLittleP
Hi,

I have a number of sound files.
When I play them using AudioSound3D they all seem to end with a rather nasty click.
However, when I play them with a media player there is no click.

Is there something that I need to do to the data or a technique in ending the sound file whilst using AudioSound3D?

Thanks
P
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sound finishes with a click.

TheLittleP
I have fixed this.

The javax.sound.sampled.AudioInputStream converter seems to put some artefacts on the end. Once I deleted these the sounds play in AudioSystem3D without any clicks.

Regards
P
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sound finishes with a click.

gouessej
Administrator
I don't understand, there should be no reference to JavaSound in this file :s
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sound finishes with a click.

TheLittleP
I am using JavaSound to convert the format of the Audio Buffer before transferring the buffer to AudioSound3D.

There was an error in the way I was doing it which strangely caused a click at the end. I have since resolved this.

Thanks
P
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sound finishes with a click.

gouessej
Administrator
I'm sure you can do that without JavaSound. I used JavaSound for years, it's so buggy. You can use one of our loaders or the ones of a third party library, for example Paul Lamb Sound Library.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sound finishes with a click.

TheLittleP
Yes I agree. I have resolved my issues with this.

Currently I am working on an mp3 player. I just get noise...

I downloaded mp3spi, jlayer and tritonus-shared.

here is my test code...

AudioInputStream ais=new MpegAudioFileReader().getAudioInputStream(chooser.getSelectedFile());

DB.print("mp3 format="+ais.getFormat());
DB.print("mp3 size="+ais.available());

int size=ais.available();
    byte[] bytes=new byte[size];
    ais.read(bytes);

Buffer[] b=new Buffer[1];
b[0]=Audio.fetchBuffer();
b[0].configure(ByteBuffer.wrap(bytes),Buffer.FORMAT_STEREO8,44100);
Source s=Audio.fetchSource();
s.queueBuffers(b);
s.play();
DB.print("mp3 OK");


mp3 format=MPEG1L3 44100.0 Hz, unknown bits per sample, stereo, unknown frame size, 38.28125 frames/second,

I have tried Buffer.FORMAT_STEREO8 and Buffer.FORMAT_STEREO16

There is something more to it and I don't know what.

I am wondering if you could help thanks :)


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sound finishes with a click.

gouessej
Administrator
If you don't want to implement MP3 support in Paul Lamb Sound Library, you can use JavaZoom, especially the class javazoom.jl.player.Player like in this example:
http://fr.openclassrooms.com/forum/sujet/mp3-jouer-des-mp3-en-java-67417#message-4778783

I'm sorry, I never use MP3 because it's patented, I don't want to pay. I prefer using Ogg (JOGG + JORBIS + JOAL).
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sound finishes with a click.

TheLittleP
I have the mp3 player working in AudioSystem3D.

It is a fair point you make about mp3 being patented.

I can easily convert mp3 to wav but the file sizes in comparison are horrendous.

I will investigate the ogg and jorbis file formats.

If you already have links to a free converter and an example of AudioSystem3D playing ogg and jorbis it will be very much appreciated.

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sound finishes with a click.

TheLittleP
In reply to this post by gouessej
I have a converter to ogg and the result file size in comparison to mp3 is very good.

Just need an ogg decoder...
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sound finishes with a click.

TheLittleP
In reply to this post by gouessej
Just downloaded vorbis spi

I am sure its now just a matter of time.

Thanks :)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sound finishes with a click.

gouessej
Administrator
You can use JOGG and JORBIS both with JavaSound and with JOAL. I use them with Paul Lamb Sound Library here:
http://svn.code.sf.net/p/tuer/code/pre_beta/engine/sound/SoundManager.java

You can look at the source code of the JOAL plugin for Paul Lamb Sound Library to understand how to do the same with com.jogamp.openal.sound3d.AudioSystem3D.

Edit.: AudioSystem3D supports a very few formats, at least Wav but it's not compressed :(
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sound finishes with a click.

TheLittleP
vorbis spi seemed to have a lot of overhead.

I have downloaded jorbis.

I ripped out the stream player from the jorbisplayer and modified it to work with AudioSound3D and it works a treat :)

Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sound finishes with a click.

Matt Harris
Sorry to raise this thread from the dead but I also have experience of this issue.

Where it's been seen is with WAV files that have metadata appended to the end of the sample data - this seems to be incorporated as part of the sound sample data in the wav file loader.

I have submitted a proposed fix for this - see bug 1280 on bugzilla and the associated pull request on GitHub.

I've already used this fix in my own build of joal and it seems to do the trick (at least on the sample files that were showing the issue)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sound finishes with a click.

gouessej
Administrator
Hi

I see that you read the size of the data to read here:
https://github.com/mattharris/joal/commit/52ae4377ddc9676fda5eb8f9ac5d93b0521e8aba#diff-1af05ee2575be901c653f88563949606R154

It's ok for me. Thank you for your patch. Please contact sgothel on IRC or by email so that he reviews your patch.
Loading...