Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Record all audio played in a processing program

$
0
0
Hi,

I'm using Minim and one sample code that I found to record all sounds played in the program.

Here is the code:

  1. import ddf.minim.*;
  2. import ddf.minim.ugens.*;

  3. Minim minim;
  4. AudioOutput out;
  5. AudioRecorder recorder;
  6. AudioPlayer audioMar;
  7. AudioPlayer audioTierra;
  8. void setup()
  9. {
  10.   size(512, 200, P3D);
  11.   
  12.   minim = new Minim(this);


  13.   
  14.   textFont(createFont("Arial", 12));

  15.   out = minim.getLineOut();
  16.   recorder = minim.createRecorder(out, "myrecording.wav", true);
  17.   
  18.  
  19.   audioMar = minim.loadFile("Mar.wav");
  20.   audioMar.play();

  21.   audioTierra = minim.loadFile("Tierra.wav");
  22.   audioTierra.play();


  23.   
  24. }

  25. void draw()
  26. {
  27.   background(0); 
  28.   stroke(255);
  29.   
  30.   if ( recorder.isRecording() )
  31.   {
  32.     text("Currently recording...", 5, 15);
  33.   }
  34.   else
  35.   {
  36.     text("Not recording.", 5, 15);
  37.   }
  38. }

  39. void keyReleased()
  40. {
  41.   if ( key == 'r' ) 
  42.   {
  43.     if ( recorder.isRecording() ) 
  44.     {
  45.       recorder.endRecord();
  46.     }
  47.     else 
  48.     {
  49.       recorder.beginRecord();
  50.     }
  51.   }
  52.   if ( key == 's' )
  53.   {

  54.     recorder.save();
  55.     println("Done saving.");
  56.   }
  57. }

  58. void stop()
  59. {
  60.   // always close Minim audio classes when you are done with them
  61.   out.close();
  62.   minim.stop();
  63.   
  64.   super.stop();
  65. }

The problem is that in the result audio file there is not sound after recording.

I know that I missing something, because I found this sample which works well:

The problem is that I don't know how to "patch" all sounds being played.

Any idea how to do this?

Salutations to all.



Viewing all articles
Browse latest Browse all 1768

Trending Articles