2 Replies Latest reply on Jan 13, 2012 8:16 PM by jsmith

    Mix audio


      I'm using the java sound w/ some Tritonus and JavaFx too, for a college project, and I've searched high and low for an answer.
      Now maybe its so very simple I've been staring at it, but all I want to know is ...

      How can I intercept the data being sent to the speakers and record it as a file... as I want to mix some javafx media player audio streams (and/or java sound audio streams) into one "Wav" file .... as would be done in a recording studio environment.

        • 1. Re: Mix audio
          I don't know that this is possible with the javafx public APIs.

          You could attach an http://docs.oracle.com/javafx/2.0/api/javafx/scene/media/AudioSpectrumListener.html to both streams and try to blend the resultant data.
          Not sure if the resolution would be good enough for your requirements or not and you would have to handle the re-encoding to another wav file yourself.

          You may have better luck making use of the classes in the javax.sound package http://docs.oracle.com/javase/1.5.0/docs/api/javax/sound/sampled/package-summary.html, perhaps http://docs.oracle.com/javase/1.5.0/docs/api/javax/sound/sampled/Mixer.html is what you seek.
          • 2. Re: Mix audio
            This is an equalizer, not a mixer, but some of the work here such as use of the AudioSpectrumListeners may be applicable => http://fxexperience.com/2012/01/fun-javafx-2-0-audio-player/