Bug 1350 : Bug in Minim's reverse FFT
Last modified: 2010-06-05 03:27




Status:
ASSIGNED
Resolution:
-
Priority:
P2
Severity:
normal

 

Reporter:
Greger
Assigned To:
ddf

Attachment Type Created Size Actions

Description:   Opened: 2009-10-19 03:41
When trying to run the attached code, sound is only output for a second,
and then disappears. If I restart the sketch, the sound is back, but again,
only for a second.

I have tried this code on different machines, on different OS, and all with
the same result.
I've also tried it with bot earlier versions of processing, and minim, and
today again with the latest version.


[quote]
[color=#CC6600]import[/color] ddf.minim.*;
[color=#CC6600]import[/color] ddf.minim.signals.*;
[color=#CC6600]import[/color] ddf.minim.analysis.*;
[color=#CC6600]import[/color] ddf.minim.effects.*;

[color=#CC6600]class[/color] DrawWave [color=#CC6600]implements[/color]
AudioSignal
{
  FFT fft;
  
  DrawWave()
  {
   [color=#CC6600]this[/color].fft = [color=#CC6600]new[/color] FFT(bsize,
44100);
   [color=#CC6600]this[/color].fft.setBand(20, 150);
  }
  
  [color=#CC6600]public[/color] [color=#CC6600]void[/color]
generate([color=#CC6600]float[/color][] signal)
  {
    [color=#CC6600]this[/color].fft.inverse(signal);
  }
  [color=#CC6600]public[/color] [color=#CC6600]void[/color]
generate([color=#CC6600]float[/color][] left,
[color=#CC6600]float[/color][] right)
  {
    [color=#CC6600]this[/color].generate(left);
    [color=#CC6600]this[/color].generate(right);
  }
}

Minim minim;
AudioOutput out;
DrawWave test;
[color=#CC6600]int[/color] bsize = 2048;

[color=#CC6600]void[/color] [color=#CC6600][b]setup[/b][/color]()
{
  [color=#CC6600]size[/color](512, 512);
  minim = [color=#CC6600]new[/color] Minim([color=#CC6600]this[/color]);
  out = minim.getLineOut(Minim.MONO, bsize);
  [color=#CC6600]background[/color](0);
  test = [color=#CC6600]new[/color] DrawWave();
  out.addSignal(test);
}


[color=#CC6600]void[/color] [color=#CC6600][b]draw[/b][/color]()
{
  [color=#CC6600]background[/color](0);
}


[/quote]
Additional Comment #1 From Greger 2009-10-19 04:36
// The code without the extra formatting

import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;

class DrawWave implements AudioSignal
{
FFT fft;

DrawWave()
{
this.fft = new FFT(bsize, 44100);
this.fft.setBand(20, 150);
}

public void generate(float[] signal)
{
this.fft.inverse(signal);
}
public void generate(float[] left, float[] right)
{
this.generate(left);
this.generate(right);
}
}

Minim minim;
AudioOutput out;
DrawWave test;
int bsize = 2048;

void setup()
{
size(512, 512);
minim = new Minim(this);
out = minim.getLineOut(Minim.MONO, bsize);
background(0);
test = new DrawWave();
out.addSignal(test);
}


void draw()
{
background(0);
}

This bug is now being tracked here.