Regarding using AudioInput in Minim

I am trying to create Reverb and echo to the audio that is coming in through the computer mike but thr is nothing in the Minim library to let me do that.Can somebody help me in this regard
Or shuld I use LiveInput instead of AudioInput but while using LiveInput the sound that I am hearing is nothing but some racked noises.Do any body has a clue like how I can create realttime echo through AudioInput or LiveInput.
I am using the put down in the minim documentation
Please help
Regards

have a look at the : processing.sound.*; library

Reverb

https://processing.org/reference/libraries/sound/Reverb.html

Here the delay:
https://processing.org/reference/libraries/sound/Delay.html

Here the audio in
https://processing.org/reference/libraries/sound/AudioIn.html

best
R_colors

but can I not use the Minim library to create reverb and echo?
I have used delay in the AudioPlayer and works perfectly well but cannot patch it with AudioInput.
Though I did patch it with LiveInput but the live input gives some smuttering sounds

looks like there is a trick connect input to output
http://code.compartmental.net/minim/liveinput_class_liveinput.html

like i play here ( but not tested with micro )

/**
  * This sketch demonstrates how to an <code>AudioRecorder</code> to record audio to disk. 
  * To use this sketch you need to have something plugged into the line-in on your computer, 
  * or else be working on a laptop with an active built-in microphone. 
  * <p>
  * Press 'r' to toggle recording on and off and the press 's' to save to disk. 
  * The recorded file will be placed in the sketch folder of the sketch.
  * <p>
  * For more information about Minim and additional features, 
  * visit http://code.compartmental.net/minim/
  */

String outfile = "data/myrecording.wav";  // minim need you to create the /data/ dir manually
import ddf.minim.*;
import ddf.minim.ugens.*;
import ddf.minim.spi.*; // for AudioStream

Minim minim;
//AudioInput in;
LiveInput in;
AudioOutput out;
AudioRecorder recorder;
//Delay myDelay;

void setup() {
  size(512, 200, P3D);
  minim = new Minim(this);
//  myDelay = new Delay( 0.4, 0.5, true, true );
  textFont(createFont("Arial", 12));
  println("use key: [r] [r] [s]");
  out = minim.getLineOut();
  AudioStream inputStream = minim.getInputStream( out.getFormat().getChannels(), 
                                                  out.bufferSize(), 
                                                  out.sampleRate(), 
                                                  out.getFormat().getSampleSizeInBits());
  in = new LiveInput( inputStream );
//  in.patch( myDelay).patch(out);
  in.patch(out);
  out.setGain(0.8);
  recorder = minim.createRecorder(out, outfile);
}

void draw() {
  background(0); 
  stroke(255);
  for(int i = 0; i < out.bufferSize() - 1; i++)  {
    line(i, 50 + out.left.get(i)*50, i+1, 50 + out.left.get(i+1)*50);
    line(i, 150 + out.right.get(i)*50, i+1, 150 + out.right.get(i+1)*50);
  }
  
  if ( recorder.isRecording() )    text("Currently recording...", 5, 15);
  else                             text("Not recording.", 5, 15);
}

void keyReleased()
{
  if ( key == 'r' )   {
    if ( recorder.isRecording() ) recorder.endRecord();
    else                          recorder.beginRecord();
  }
  if ( key == 's' )  {
    recorder.save();
    println("Done saving: "+outfile);
  }
}

but can I not use the Minim library to create reverb and echo?

to make a reverb it sounds lika a challenge.

What kind of algorithm do you have in mind ?

for instance,a simple Schroeder’s algorithm, without allpass filters and combfilters it’s not possible to be implemented, and in Minim I can’t find any allpass and probably will not be so simple to make a combfilter using delays as well …

Schroeder_Reverberators

an example of an implementation, and it’s MONO, to make it stero you need more filters …

if you really want to make your own reverb, you should use SuperCollider,
at least there, you don’t have to deal with some strange way to design filters …

Reverberation
The next example is by James McCartney. It comes from the 01 Why SuperCollider document that was part of the SuperCollider2 distribution.

The example is more or less a Schroeder reverb - a signal passed through a parallel bank of comb filters which then pass through a series of allpass filters.
(
{
var s, z, y;
    // 10 voices of a random sine percussion sound :
s = Mix.ar(Array.fill(10, { Resonz.ar(Dust.ar(0.2, 50), 200 + 3000.0.rand, 0.003)}) );
    // reverb predelay time :
z = DelayN.ar(s, 0.048);
    // 7 length modulated comb delays in parallel :
y = Mix.ar(Array.fill(7,{ CombL.ar(z, 0.1, LFNoise1.kr(0.1.rand, 0.04, 0.05), 15) }));
    // two parallel chains of 4 allpass delays (8 total) :
4.do({ y = AllpassN.ar(y, 0.050, [0.050.rand, 0.050.rand], 1) });
    // add original sound to reverb and play it :
s+(0.2*y)
}.scope
)

best

Minim has had a reverb ugen listed as a potential future feature since at least 2011. I don’t think it has ever happened, so you need to either use Processing Sound or roll your own. Searching the minim source for reverb finds a single reference in a low level javasound component.

1 Like