Previous Article Next Article Java Tutorials: Episode 23 – Java Sound API – SourceDataLine
Posted in Java

Java Tutorials: Episode 23 – Java Sound API – SourceDataLine

Java Tutorials: Episode 23 – Java Sound API – SourceDataLine Posted on May 17, 201814 Comments

Twenty-third episode of my Java Tutorial Series! Now onto the final of the three DataLines in the Java Sound API, we go over how and when to use SourceDataLines. SourceDataLines are another form of sound output, but with added features over Clips. I hope you enjoyed the episode, and leave a like, favorite, or subscribe if you feel so inclined. And as always, leave a comment to tell me how you feel.


  1. hi! Thanks for share! One Question: Can I get sound peaks? for exemple: For create a volume meter.
    I trying create a software that increase volume case detect one external sound major of sound is executing in my machine… and other words, I'm watch a video in youtube and suddently one airplaine fly near my home. My software should be INCREASE volume of Operacional System.
    For increase sound of operation system i already have a soluction (nircmd) but, i don't have a soluction for detect peaks of external sounds.

    Help me, please!!!

  2. do while loops should be used when reading from and writing to the byte arrays. The while loop argument dataLine.isRunning() where "dataLine" is your target or source data line. This way, the threads will close and won't be left hanging.

  3. Im creating oscillators for a synthesizer program for my APCS class, instead of feeding the byte arrays you created, could i just feed them the ones the oscillators returned from a separate class?

  4. I am attempting to make a program that writes to the source line many times. Is this a bad idea? It seems to just write over itself and when I try to call drain on it, it still doesn't wait. Should I just be making a whole bunch of sourcedatalines? Should I just make a queue of them? If so, how do I know when one closes?

Leave a Reply

Your email address will not be published. Required fields are marked *