Minim Issue. Cannot use Analysis (eg. BeatDetect) and Ugens (eg. MoogFilter) together in one script?

edited March 2018 in Library Questions

I seem to be having an issue trying to use both at once in a single .pde. From looking at examples, it seems that there are different methods of setting up and playing a soundfile for BeatDetect and MoogFilter. I cannot patch the sample that is set up in the BeatDetect Example file online: code.compartmental.net/minim/beatdetect_method_iskick.html so that it then runs into the MoogFilter.

I get an error if I try to put the file name "song" from that example in the filter. "song.patch( moog1 ).patch( out );"

Below I have set up and example of both methods. I listed and labelled the two separate methods of sample setup as "ugen" or "analysis", and "shared" for any code that they share. Could someone kindly point out how to make both work together? The issue lies in the final line of patching code.

import ddf.minim.*;

import ddf.minim.analysis.*; // analysis
import ddf.minim.ugens.*;    // ugens

Minim minim;  // shared

AudioPlayer song;     // analysis
BeatDetect beat;      // analysis


FilePlayer filePlayer1;          // ugens
AudioOutput out;                 // ugens
String fileName1 = "Gothik.mp3"; // ugens
MoogFilter  moog1;               // ugens

void setup()
{
  size(600, 600);
  minim = new Minim(this);                    // shared

  song = minim.loadFile("Gothik.mp3", 2048);  // analysis
  song.loop();                                // analysis
  beat = new BeatDetect();                    // analysis

  filePlayer1 = new FilePlayer( minim.loadFileStream(fileName1) );  // ugens
  out = minim.getLineOut();                                         // ugens
  moog1    = new MoogFilter( 1200, 0 );                             // ugens
  filePlayer1.patch( moog1 ).patch( out );                          // ugens   **ISSUE IS HERE**
}

I have no idea why there are two methods of setting up a sample to play and I'm getting a bit confused.

Many thanks

Answers

  • I am not familiar with the MoogFilter() but I can say that your sketch you provided doesn't run. You need to add an empty draw() function so for the song to play. What effect do you get after applying this filter? Can you provide documentation or a sample code specific to that filter?

    Kf

  • Sorry kfrajer. I meant that I posted the code purely to show the parameters labelled. It is not meant to run. I should have been more clear.

Sign In or Register to comment.