!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(northAndCenterWithMargin( jCenteredSection("File", dm_label audioFile()), jCenteredSection("Volume Profile", graph))); if (volumeProfile == null) volumeProfile = decodeWAVToMonoSamples_floatVolumeProfile(audioFile, windowSize); graph?.setValues(volumeProfile); } void updateProfile enter { volumeProfile = null; updateGraph(); } void openFile enter { File f = showFileChooser(); if (f != null) loadFile(f); } void loadFile(File f) { setField(audioFile := f); updateProfile(); } }