Update: SoniaHelper should be renamed FFTHelper and integrated into unlekkerLib, but that hasn’t happened yet. The best way to use it right now is to download the code examples from the VJ workshop I did at Cimatics 2007. That has the code you need as well as some examples of practical usage.

I’ve put together a hack for normalizing the FFT analysis values produced by Sonia’s LiveInput.getSpectrum(). It looks at the maximum values produced, and scales them according to the most recent maximum values. That way, quiet sections will produce relative differences according to the current maximum value, so that both quiet and loud sections give dynamic results.

It also allows you to dampen the values so that the rate of change in values can be controlled. This can be used to make the values change appropriately according to the quality of the music, making it easier to use them for visuals that match the music.

Source code

You initialize SoniaHelper like this:

  // SoniaHelper(int _n, int _nbands,boolean doAvg)
  // Start up Sonia
  LiveInput.start(spectrumLength);

  // ...or start up Ess
  Ess.start(this);
   myChannel=new Channel("hello.aiff");
  myChannel.setupFFT(512);

  // init SoniaHelper
  ffthelper=new SoniaHelper(spectrumLength,32,false);
  ffthelper.setMaxLimits(200,2000);
  damperval=0.1f;
  ffthelper.setDamper(damperval); 

Update SoniaHelper inside draw() by passing spectral values from Sonia or Ess:

void draw() {
  ...
  LiveInput.getSpectrum();
  ffthelper.update(LiveInput.spectrum); 

// Ess equivalent
  myChannel.loadSpectrum();
  ffthelper.update(myChannel.spectrum);

  for(int i=0; i< spectrumLength; i++)
	ellipse(i,height/2,
		100*ffthelper.spectrum[i], 100*ffthelper.spectrum[i]);
  ...
}

See the sample code in the ZIP file for more code examples.

Downloads

There are 11 comments to "Library: SoniaHelper". You may leave your own comment.
1. oli, October 11th, 2006 at 22:27

Very helpful. Thanks Marius.

2. Claudio Midolo, October 30th, 2006 at 20:18

Hi Marius, is there a reference to understand better the methods of SoniaHelper?
Thanks and gr8 work! ;)

3. marius watz, October 31st, 2006 at 14:19

Hi Claudio, unfortunately I haven’t really had time to document it very well. The examples show how the library is intended to be used. Basically you use the spectrum[] array from the SoniaHelper instead of the one provided by Sonia. The relevant parameter for SoniaHelper is the damper value set by setDamper(). When set close to 0 this slows down the rate of change in the data, closer to 1 it changes the values immediately.

4. everybody.is-a-cyb.org » Archive » Problem 2 - Solved, January 15th, 2007 at 23:42

[...] One is ESS and the other one is Sonia. I tried Sonia first but I found out that it reads the signal but has no maximum value, so you can’t really measure the percentage of the volume or of the peaks of a certain frequency band because you don’t have any fixed point to compare your values against. There is an addition to this library which is called Sonia Helper. [...]

5. r-echos » Blog Archive » Visuals at Lovebytes07, June 6th, 2007 at 10:03

[...] The visuals were built with Processing, using Sonia and my own SoniaHelper for sound input and analysis. My laptop lost its ability to output to an external monitor before the show, which added an extra bit of tension but allowed me to experiment with running Windows on a Mac. Someone lent me a MacBook running Bootcamp and Windows XP, and it turned out that simply exporting my files using Fat Jar and copying them over to the MacBook was all it took to migrate. [...]

6. Emre, June 23rd, 2007 at 01:44

Hi,

I’ve been playing around with the SoniaHelperVisualTest sketch, its really nice. I want to use a .wav file instead of a line in or mic input, but I couldn’t manage to do that. I somehow couldn’t convert the sketch to use ESS rather than Sonia, and I couldn’t make the connectLiveInput() function of the Sonia library work for this purpose.

Would you care giving some simple advice and pointing a direction for a beginner in processing? :)

Thanks a lot.

7. marius watz, June 23rd, 2007 at 16:01

Hi Emre, SoniaHelper doesn’t actually deal with how the spectrum is generated, i.e. whether it’s coming from a live input or a WAV. All you need to do is use the appropriate array of FFT values generated by Sonia or ESS.

I’ve never used ESS myself, but the FFT example should get you going with how to get a FFT from a sound file. Then you just pass FFT.spectrum array to SoniaHelper.update(), and you should get the same effect as you would by passing in Sonia’s LiveInput.spectrum.

8. Emre, June 28th, 2007 at 19:07

Hi,

I think I’m going to use Minim, the new sound library for processing. It is quite simple and I managed to do a couple of things really easily, compared to ESS and Sonia. I don’t think there will be a big problem incorporating soniahelper’s functions into sketches using minim library. I’ll let you know how far I can get.

Thanks,

Emre.

9. peersmall_4, April 29th, 2008 at 17:11

hi anyone know how to install SoniaHelper?
thanks

10. marius watz, May 7th, 2008 at 05:26

Hi Peer, you can download the sample files from the workshop I did at Cimatics 2007. It has example code for SoniaHelper (renamed to “FFTHelper”…)

11. peersmall_4, May 7th, 2008 at 18:26

thanks marius

Comment on this entry

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>