!7 cmodule AudioClip > DynSCP { File audioFile; transient JAmplitudeGraph graph; transient float[] volumeProfile; double windowSize = 0.01; // seconds start { afterVisualize2(r updateGraph); graph = swingNu JAmplitudeGraph(); } void updateGraph enter { if (!isFile(audioFile)) ret with setComponent(jcenteredbutton("Open audio file...", rThread openFile)); setComponent(jCenteredSection("Volume Profile", graph)); if (volumeProfile == null) volumeProfile = decodeWAVToMonoSamples_floatVolumeProfile(audioFile, windowSize); graph?.setValues(volumeProfile); } void updateProfile enter { volumeProfile = null; updateGraph(); } void openFile enter { loadFile(showFileChooser()); } void loadFile(File f) { setField(audioFile := f); updateProfile(); } }