[jsyn] Displaying a trace.

jsyn at music.columbia.edu jsyn at music.columbia.edu
Wed Jun 13 15:02:10 EDT 2007

> As I'm relatively new to java and JSyn I'm searching for examples of
> how to get the image data from a signal to display on a java
> component (e.g. JPanel).

First you need to capture audio data. Queue a SynthSample to a 
SampleWriter_16F1 to record a buffer full of audio. Then read() the data 
as shorts from the sample.

If you are using Swing then make a subclass of JComponent and override 
the paint() method to draw the data. Convert the audio data to x and y 
values and then call:

   g.drawLine( previousX, previousY, x, y );

Thank you,
Phil Burk
SoftSynth, Audio Research and Development
75 Pleasant Lane, San Rafael, CA, 94901 USA
Phone/FAX: 1-415-453-4320

More information about the JSyn mailing list