Loading ...
Sorry, an error occurred while loading the content.
 

Creating a Noise Filter

Expand Messages
  • Peter J Carr
    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
      using JSyn. Please give me your suggestions.

      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?

      I want to learn more about creating my own type of 'Noise' filter.
      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
      applet about light (http://lite.bu.edu/spex/).

      Thanks for any suggestions,
      Peter Carr
      Boston University Science Math Education Center
      pjc@...
    • Phil Burk
      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
        > applet about light (http://lite.bu.edu/spex/).

        Nice Applet! If you decide to use JSyn for the downloadable application,
        please contact me privately regarding a JSyn Redistribution license.

        Phil Burk
      • Nick Didkovsky
        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
          >using JSyn. Please give me your suggestions.
          >
          >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?
          >
          >I want to learn more about creating my own type of 'Noise' filter.
          >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
          >applet about light (http://lite.bu.edu/spex/).
          >
          >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
          >
          >
          >Yahoo! Groups Links
          >
          >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]
        • Peter J Carr
          ... 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
            AddUnits versus a single SynthMixer?
          • Phil Burk
            ... The SynthMixer uses a daisy chain of MultiplyAddUnits. Thus you have an extra gain stage (multiply) for each node. That may be redundant because you can
            Message 5 of 5 , Jan 2, 2004
              > Is there any different in performance between using a daisy chain of
              > AddUnits versus a single SynthMixer?

              The SynthMixer uses a daisy chain of MultiplyAddUnits. Thus you have an
              extra gain stage (multiply) for each node. That may be redundant because you
              can adjust the mix using the oscillator amplitude. But if you do not have a
              convenient way of setting the gain then the SynthMixer is a better choice.

              Phil Burk
            Your message has been successfully submitted and would be delivered to recipients shortly.