## Creating a Noise Filter

Expand Messages
• It seems to me there must be an easy way to play an arbitrary spectrum using JSyn. Please give me your suggestions. Here is what I am doing: I define a
Message 1 of 5 , Jan 2, 2004
It seems to me there must be an easy way to play an arbitrary spectrum

Here is what I am doing:
I define a spectrum as a set number of frequency-intensity pairs. For
each pair a create a new SineOscillator, create a new LineOut, connect
them and play.

double[][] spectrum = new double[NUM_POINTS][2];
// ...
// load the spectrum from a file or ui control
// ...
SineOscillator[] osc = new SineOscillator[NUM_POINTS];
LineOut[] out = new LineOut[NUM_POINTS];

for(int i=0; i<NUM_POINTS; ++i) {
osc[i] = new SineOscillator();
out[i] = new LineOut();
osc[i].frequency.set( spectrum[i][0] );
osc[i].amplitude.set( spectrum[i][1] );
osc[i].phase.set( 0d );
osc[i].output.connect( 0, out[i].input, 0 );
osc[i].start();
out[i].start();
}

Is there a better (more efficient) way to do this?

The java source code for WhiteNoise doesn't seem too informative as I
think it makes a low level C call.

I am developing a sonification of electromagnetic spectra using a very
simple mapping from e-m frequency to sound frequency and e-m intensity
to sound amplitude. This is an attempt to add audio to an educational

Thanks for any suggestions,
Peter Carr
Boston University Science Math Education Center
pjc@...
• Hello Peter, The technique you are using will give a spectrum with a series of peaks at each sine frequency. You may want to instead pass a single WhiteNoise
Message 2 of 5 , Jan 2, 2004
Hello Peter,

The technique you are using will give a spectrum with a series of peaks at
each sine frequency. You may want to instead pass a single WhiteNoise unit
through a bank of bandpass filters. Then you can fill in the entire
spectrum. Try using the PeakingEQ filter. A bank of them is essentially a
graphical EQ.

http://www.softsynth.com/jsyn/docs/autodocs/com/softsynth/jsyn/Filter_PeakingEQ.html

> LineOut[] out = new LineOut[NUM_POINTS];

Instead of using a LineOut for each oscillator or filter. Use a daisy chain
of AddUnits. Then you will have a circuit with a single output. You can then
pass that mixed signal to other processing units, or to a single LineOut.

In general an application should only have one LineOut for the final audio
mix.

> This is an attempt to add audio to an educational

Nice Applet! If you decide to use JSyn for the downloadable application,

Phil Burk
• Hello Peter You can use a single waveshaper loaded with a Chebyshev polynomial; this would be very efficient. The resulting spectrum will be harmonic though
Message 3 of 5 , Jan 2, 2004
Hello Peter

You can use a single waveshaper loaded with a Chebyshev polynomial; this
would be very efficient. The resulting spectrum will be harmonic though
so it may not be useful for you.

See the online docs for com.softsynth.math.ChebyshevPolynomial

Nick

Peter J Carr wrote:

>It seems to me there must be an easy way to play an arbitrary spectrum
>
>Here is what I am doing:
> I define a spectrum as a set number of frequency-intensity pairs. For
>each pair a create a new SineOscillator, create a new LineOut, connect
>them and play.
>
> double[][] spectrum = new double[NUM_POINTS][2];
> // ...
> // load the spectrum from a file or ui control
> // ...
> SineOscillator[] osc = new SineOscillator[NUM_POINTS];
> LineOut[] out = new LineOut[NUM_POINTS];
>
> for(int i=0; i<NUM_POINTS; ++i) {
> osc[i] = new SineOscillator();
> out[i] = new LineOut();
> osc[i].frequency.set( spectrum[i][0] );
> osc[i].amplitude.set( spectrum[i][1] );
> osc[i].phase.set( 0d );
> osc[i].output.connect( 0, out[i].input, 0 );
> osc[i].start();
> out[i].start();
> }
>
>
>Is there a better (more efficient) way to do this?
>
>The java source code for WhiteNoise doesn't seem too informative as I
>think it makes a low level C call.
>
>I am developing a sonification of electromagnetic spectra using a very
>simple mapping from e-m frequency to sound frequency and e-m intensity
>to sound amplitude. This is an attempt to add audio to an educational
>
>Thanks for any suggestions,
>Peter Carr
>Boston University Science Math Education Center
>pjc@...
>
>
>
>
>
>
>
>JSyn home at: http://www.softsynth.com/jsyn/
>List home at: http://groups.yahoo.com/group/jsyn/
>To unsubscribe, send an email to: jsyn-unsubscribe@yahoogroups.com
>
>
>
>To visit your group on the web, go to:
> http://groups.yahoo.com/group/jsyn/
>
>To unsubscribe from this group, send an email to:
> jsyn-unsubscribe@yahoogroups.com
>
>Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
>
>

[Non-text portions of this message have been removed]
• ... I am now using a single SynthMixer with NUM_POINTS inputs and a single output channel. Is there any different in performance between using a daisy chain of
Message 4 of 5 , Jan 2, 2004
Phil Burk wrote:

>>LineOut[] out = new LineOut[NUM_POINTS];
>
>
> Instead of using a LineOut for each oscillator or filter. Use a daisy chain
> of AddUnits. Then you will have a circuit with a single output. You can then
> pass that mixed signal to other processing units, or to a single LineOut.
>
> In general an application should only have one LineOut for the final audio
> mix.
>

I am now using a single SynthMixer with NUM_POINTS inputs and a single
output channel.

Is there any different in performance between using a daisy chain of