JavaFx Music Spectrum

My first 2018 post, and hi to you all.


Building a circular progress indicator specifically for showing the music progress was the initial idea which  was fairly simple to do with the Animation class ,with the code snippet below

 Animation = new Transition() {
         {
             setCycleDuration(Duration.seconds(5));
             setInterpolator(Interpolator.LINEAR);
         }

         @Override
    protected void interpolate(double frac) {

                double interpolation_angle  = slerpFunc(frac);

                double  sinValue = Math.sin(Math.toRadians(interpolation_angle  + startAngle));
                double  cosValue = Math.cos(Math.toRadians(interpolation_angle  + startAngle));

                double angleX = center2d.getX() + (radius * 0.4) * sinValue;
                double angleY = center2d.getY() + (radius * 0.4) * cosValue;
                
                gc.fillOval(angleX,angleY,1,1);
          }

       };

My Slerp function looks like so, found on stackoverflow.

private double slerpFunc(double frac){
    
          return (((((360 - 0) % 360) + 540 ) % 360) + 180) * frac;
}

Half  way the project i decided to change to the project to visualize spectrum magnitude of each band in a song.I used the default number of bands 128 and a threshold of -300 for better visibility.

The bands are drawn from the center creating 128 nodes each with an opacity that corresponds to the spectral threshold.Since the opacity value is between 0 to 1,i had to normalize the threshold values.

Andre -Fascination Javafx
 Music Spectrum 
sleep away Spectrum





 



Comments

  1. Great walkthrough on the audio spectrum visualization. The FFT approach you demonstrated here pairs well with real-time signal processing pipelines. Worth noting that HVAC load forecasting uses similar spectral analysis techniques for pattern recognition in time-series data — happy to share more on that crossover if it would help.

    ReplyDelete
  2. People checking whether winbuzz legal in india or looking for a direct account entry page often use winbuzz login to find the latest platform information. winbuzz is known for sharing practical details about deposits, withdrawals, and access support in a clear way. Users interested in sports betting and casino games also visit for Cricket ID guidance, which helps them get started smoothly while staying updated on login steps, app access, and user assistance.

    ReplyDelete

Post a Comment

Popular Posts