This content has been marked as final. Show 3 replies
845732 wrote:Clips are exclusively for playing audio files. There is no way to use them to record a new file.
Hi. I need to open an audio file, then select part which will be looped. I did it with Clip, but I don't know how to save this looped part into new file. I also don't know how to edit frames - I want to add fade-in and fade-out effect at begining and end of the clip. May you explain me how to do that?
You need to read the manual and find out about DataLines and how they work.
Read through some example code to see the concepts in action...
Ultimately, you should know that JavaSound isn't going to give you very much to work with... you'll have to implement the fade effects on your own. There's nothing built-in to do it for you. I'm guessing by the briefness of your question, you're probably going to want to find a 3rd party library on Google to handle most of the work for you.
It's quite old, but still actual:). So... now I'm loading file into AudioInputStream. I have a panel drawing its waveform, now and I'm going to write a selection. But still, I can't find any example showing how to create a clip from part of an AudioInputStream (byte array?).
845732 wrote:There's no reason to create a clip of it... you can play an AudioInputStream by writing its contents to a SourceDataLine...
But still, I can't find any example showing how to create a clip from part of an AudioInputStream (byte array?).
And you can record its contents using the AudioSystem.write function (which will record the entire contents of the AudioInputStream, so make sure you discard the data out of it you don't want recorded...)