I don't want Indaba Music. Can you find other companies for multitrack stems, that are made from the original multitrack master recordings, (with individual parts including individual drum elements, bass, guitar, etc.) in.WAV files?
Use Windows Sound Recorder (in Start - Programs - Accessories - Entertainment). It has a feature (Effects (menu) - Reverse) to reverse a.WAV file. You could save the reversed file with a different name, and then open the appropriate one in your program. Get Glitch Sounds from Soundsnap, the Leading Sound Library for Unlimited SFX Downloads. Click here to download 5,700 background textures and images, 6,800 true-type fonts and 1,980 sound effects. For commercial use of the sound effects, select the download with commercial license.
- Details
- Written by Nam Ha Minh
- Last Updated on 01 July 2019 | Print Email
1. Playing back audio using a Clip
Use a Clip (javax.sound.sampled.Clip) when you want to play non-real-time sound data such as a short sound file. The whole file is pre-loaded into memory before playing back, therefore we have total control over the playback.Advantages:- It’s possible to start playing from any position in the sound (using either of the Clip’s methods setMicrosecondPosition(long)or setFramePosition(int)).
- It’s possible to repeatedly play (loop) all or a part of the sound (using the setLoopPoints(int, int) and loop(int) methods).
- It’s possible to know duration of the sound before playing (using the getFrameLength() or getMicrosecondLength() methods).
- It’s possible to stop playing back at the current position and resume playing later (using the stop() and start() methods).
- It’s not suitable and inefficient to play back lengthy sound data such as a big audio file because it consumes too much memory.
- The Clip’s start() method does playing the sound but it does not block the current thread (it returns immediately), so it requires to implement the LineListener interface to know when the playing completes. We’ll see how to do that in the examples.
- Create an AudioInputStream from a given sound file:
- Acquire audio format and create a DataLine.Infoobject:
- Obtain the Clip:
- Open the AudioInputStream and start playing:
- Close and release resources acquired:
- To know length (duration) of the sound:You need to divide the duration in microseconds by one million to get the value in seconds.
- To specify the position to start playing back:
- To loop playing all the sound for 2 times:
- To loop a portion of the sound for 1 time:
- To stop playing back at the current position:
To resume playing, call start() method again.
And all the above statements (except the stop()) should be called after audioClip.open() and before audioClip.start(), for example:2. Playing back using a SourceDataLine
Use a SourceDataLine (javax.sound.sampled.SourceDataLine) when you want to play a long sound file which cannot be pre-loaded into memory or to stream real-time sound data such as playing sound back as it’s being captured. Advantages:- It’s suitable and efficient to play back long sound file or to stream sound in real-time.
- It’s possible to control what sound data to be written to the audio line’s playback buffer.
- Unlike the Clip, we don’t have to implement the LineListener interface to know when the playback completes.
- Cannot start playing from an arbitration position in the sound.
- Cannot repeatedly play (loop) all or a part of the sound.
- Cannot stop and resume playing in the middle.
- Cannot know duration of the sound before playing.
- Obtain a SourceDataLine is similar to obtain a Clip:
- Open and start the audio line:
- Repeatedly read a chunk of bytes from the AudioInputStream and send it to the SourceDataLine’splayback buffer, until reaching end of the input stream:
- Close and release resources acquired:
Free Music Wav Files
Java Playback Audio Example using DataSourceLine:Here’s an example program that plays back a given audio file using the SourceDataLine:As we can see, this program is simpler than the Clip-based version, without having to implement theWav File Tones
LineListener interface.Back In Black Wav File
Related Java Sound Tutorials:
Other Java Tutorials:
Back In Black Midi File
About the Author:
Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He started programming with Java in the time of Java 1.4 and has been falling in love with Java since then. Make friend with him on Facebook and watch his Java videos you YouTube.[Play back using Clip] | 2 kB |
[Play back using SourceDataLine] | 2 kB |