Minim: Is it a stupid question ?

Hello everyone, I am planning to create a sonar like code with minim and processing where speakers would generate some high/low frequency sound from computer and listening back only those sound from computer microphone, if they get reflected from any surface.

Is is possible to do it ? Am I being too ambitious?

Here is something that I was trying but it seems it was not working. Can anyone help me?

import ddf.minim.*;
import ddf.minim.ugens.*;

Minim minim;
AudioInput in;
AudioOutput out;
Oscil       wave;
void setup() {
  size(512, 300);
  minim = new Minim(this);
  in = minim.getLineIn(Minim.STEREO, 512);
  out = minim.getLineOut();
  wave  = new Oscil( 18, 10f, Waves.SINE );
  wave.patch( out );
}


void draw()
{
  background(0);
  // float level = in.mix.level()*1000;
  // println(level);

  stroke(-1);
  for (int i = 0; i < in.bufferSize() - 1; i++)
  {
    line( i, 50 + in.left.get(i)*50, i+1, 50 + in.left.get(i+1)*50 );
    line( i, 150 + in.right.get(i)*50, i+1, 150 + in.right.get(i+1)*50 );
  }
}



void stop()
{
  in.close();
  minim.stop();
  super.stop();
}

Answers

  • edited April 2014 Answer ✓

    A Sonar

    I don't think a sonar is possible with a non-industrial level Operating Systems (OS) like Windows.

    Because the timing must be very good and you don't have that with multi-tasking OS.

    There are all kinds of latencys / delays. E.g. you're using a buffer in line 25 following...

    As for the code

    As for the code I suggest to test the in- and the out-part separately before merging them.

    Other idea

    For sonar: I think there are sensors out there (ultra sound) - maybe you can attach them to your PC.

  • edited April 2014 Answer ✓

    @Chrisir I think it is possible but it would need some intense signal processing but @xenomorph it would be more convinient to use external sensor for this purpose.

  • edited April 2014

    @Chrisir: Thank for replying.

    Actually I don't want to use any external sensor. I thought it would be possible to create an application which uses doppler effect. And I know it is not that simple as am puttig in the code. :D :D

    But I wanted you to know that it is possible and here is the video of it. Using only internal microphone and speaker.

  • OK, you'll do it!

Sign In or Register to comment.