We are about to switch to a new forum software. Until then we have removed the registration on this forum.
So, i´ve been tryng to make the minim recorder to record the audio from the Audioplayer object when is played without any succes.
Something like the combination of this 2 examples :
http://code.compartmental.net/minim/audioplayer_method_play.html http://code.compartmental.net/minim/minim_method_createrecorder.html
I´ve found similar threats but with no anwer to it :
https://forum.processing.org/one/topic/minim-how-to-record-minim-s-output.html
The audio plays just well but the recorder comes out empty. If I try the "createrecorder" example it works on recording the sounds created by minim, but I need it to record the sound getting them from the audio player. This is my greates attemp :
import ddf.minim.*;
import ddf.minim.ugens.*;
Minim minim;
AudioOutput out;
AudioRecorder recorder;
AudioPlayer sonido;
void setup()
{
size(512, 200, P3D);
minim = new Minim(this);
out = minim.getLineOut();
sonido = minim.loadFile("fijo2.wav");
sonido.loop();
recorder = minim.createRecorder(out, "myrecording.wav");
textFont(createFont("Arial", 12));
}
void draw()
{
background(0);
stroke(255);
}
void keyReleased()
{
if ( key == 'r' )
{
if ( recorder.isRecording() )
{
recorder.endRecord();
}
else
{
recorder.beginRecord();
}
}
if ( key == 's' )
{
recorder.save();
println("Done saving.");
}
}
Answers
Tested with both wav and mp3. Data should be placed in data folder.
Kf
Hi ! Thanks for taking your time for anwering me !.
The code that you posted records the input from the mic NOT from sounds that are being played in processing
that's only because of line 33.
this example purports to record the output, see lines 23 and 27:
https://github.com/ddf/Minim/blob/master/examples/Basics/RecordAudioOutput/RecordAudioOutput.pde
Ok, so implementing @koogs changes are not enough, as you get back to the business of empty recorded files. However, that gave me an idea (Thxs @koogs) which I tested and sort of works. I mean, it only works for mp3 files but not for wav files. However, I tried a second idea, and it might work for you although it doesn't seem to have much control over audio when it is being played. That is what I labeled second solution using sampler objects. It works for both mp3 and wav files (tested).
INSTRUCTIONS: In the code, define your file to play. When you run the sketch, press r to begin recording, r again to stop recording. Don't forget to press s to save the file to an audio file which will be located in the data folder.
Kf
FIRST solution: Only mp3
SECOND solution: Works for both wav and mp3
Keyword: kf_keyword minim sound recording from wav mp3 files
@kafrager thanks for anwering me !
Both of your solutions work. The first one even works with .wav files that I was using.
Now im having another problem that technically is out of the scope of this thread, but is related.
The objetive of my program is to record the panning and movement of sounds that I placed.
Here is an image showing the problem:
Here i´ve uploaded the code of the program : https://github.com/Aurelian24/espacializacion
The problem is that if I use the "Sampler" class or " FilePlayer " class i can´t accoplish panning or turning up and down the gain .
Not much experience here:
With panning, you mean advancing/jumping in your sound track?
Kf
panning generally means where in the stereo image the sound is. -1 for far left, +1 for far right.