Record all audio played in a processing program
in
Core Library Questions
•
3 months ago
Hi,
I'm using Minim and one sample code that I found to record all sounds played in the program.
Here is the code:
- import ddf.minim.*;
- import ddf.minim.ugens.*;
- Minim minim;
- AudioOutput out;
- AudioRecorder recorder;
- AudioPlayer audioMar;
- AudioPlayer audioTierra;
- void setup()
- {
- size(512, 200, P3D);
- minim = new Minim(this);
- textFont(createFont("Arial", 12));
- out = minim.getLineOut();
- recorder = minim.createRecorder(out, "myrecording.wav", true);
- audioMar = minim.loadFile("Mar.wav");
- audioMar.play();
- audioTierra = minim.loadFile("Tierra.wav");
- audioTierra.play();
- }
- void draw()
- {
- background(0);
- stroke(255);
- 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.");
- }
- }
- void stop()
- {
- // always close Minim audio classes when you are done with them
- out.close();
- minim.stop();
- super.stop();
- }
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.
1