TUIO & Minim in Tandem
in
Contributed Library Questions
•
1 years ago
Hi,
for my project we would like to prototype a TU Interface based on simple sheet of paper, where you can add audio content with each sheet of paper.
I printed A4 paper with each has an unique fiducial marker on it, an then I create two tokens (fiducial 7 and 9) for recording and playback of the contents.
we would like that when a paper is visible, and I introduce the REC token, and audio file is recorded, and stored when the token desappear. after that an audio file is recorded on that paper, when I add the PLAY token, the audio file stored within that paper start to playback, and when it's removed the the audio stops.
i.e. when the system see my fiducial traker 0, this means that there is the paper 0 is visible, and if I want to record an audio file on that paper I introduce the token (fiducial 9). Each paper can receive more than one audio file, and it can playback them all if the token (fiducial 7) is visible.
the code I maked can record and play audio files, but the audio file are not coupled with a specific paper (fiducial from 0 to 6).
thanks,
andrea
here it's the code:
//audio
import ddf.minim.*;
Minim minim;
AudioPlayer song;
AudioInput in;
AudioRecorder recorder;
// marker
import TUIO.*;
TuioProcessing tuioClient;
int id;
int countname, recountname; //change the name
int name = 000000; //set the number in key's' function
int rename = 000000;
// change the file name
void newFile()
{
countname =( name + 1);
recorder = minim.createRecorder(in, countname + ".wav", true);
// println(countname + ".wav");
}
void newFilePlay()
{
recountname =( rename + 1);
song = minim.loadFile(recountname + ".wav", 2048);
}
void setup (){
tuioClient = new TuioProcessing(this);
minim = new Minim(this);
in = minim.getLineIn(Minim.STEREO, 512);
newFile();
newFilePlay();
}
void draw () {
Vector tuioObjectList = tuioClient.getTuioObjects();
for (int i=0;i<tuioObjectList.size();i++) {
TuioObject tobj = (TuioObject)tuioObjectList.elementAt(i);
}
}
void addTuioObject(TuioObject tobj) {
//id = tobj.getSymolID();
if (tobj.getSymbolID()==9){
newFile();
recorder.beginRecord();
} else if (tobj.getSymbolID()==7){
newFilePlay();
song.play();
}
}
void removeTuioObject(TuioObject tobj) {
if (tobj.getSymbolID()==9){
recorder.endRecord();
name++;
recorder.save();
} else if (tobj.getSymbolID()==7){
song.close();
rename++;
minim.stop();
super.stop();
}
}
void stop()
{
in.close();
minim.stop();
super.stop();
}
for my project we would like to prototype a TU Interface based on simple sheet of paper, where you can add audio content with each sheet of paper.
I printed A4 paper with each has an unique fiducial marker on it, an then I create two tokens (fiducial 7 and 9) for recording and playback of the contents.
we would like that when a paper is visible, and I introduce the REC token, and audio file is recorded, and stored when the token desappear. after that an audio file is recorded on that paper, when I add the PLAY token, the audio file stored within that paper start to playback, and when it's removed the the audio stops.
i.e. when the system see my fiducial traker 0, this means that there is the paper 0 is visible, and if I want to record an audio file on that paper I introduce the token (fiducial 9). Each paper can receive more than one audio file, and it can playback them all if the token (fiducial 7) is visible.
the code I maked can record and play audio files, but the audio file are not coupled with a specific paper (fiducial from 0 to 6).
thanks,
andrea
here it's the code:
//audio
import ddf.minim.*;
Minim minim;
AudioPlayer song;
AudioInput in;
AudioRecorder recorder;
// marker
import TUIO.*;
TuioProcessing tuioClient;
int id;
int countname, recountname; //change the name
int name = 000000; //set the number in key's' function
int rename = 000000;
// change the file name
void newFile()
{
countname =( name + 1);
recorder = minim.createRecorder(in, countname + ".wav", true);
// println(countname + ".wav");
}
void newFilePlay()
{
recountname =( rename + 1);
song = minim.loadFile(recountname + ".wav", 2048);
}
void setup (){
tuioClient = new TuioProcessing(this);
minim = new Minim(this);
in = minim.getLineIn(Minim.STEREO, 512);
newFile();
newFilePlay();
}
void draw () {
Vector tuioObjectList = tuioClient.getTuioObjects();
for (int i=0;i<tuioObjectList.size();i++) {
TuioObject tobj = (TuioObject)tuioObjectList.elementAt(i);
}
}
void addTuioObject(TuioObject tobj) {
//id = tobj.getSymolID();
if (tobj.getSymbolID()==9){
newFile();
recorder.beginRecord();
} else if (tobj.getSymbolID()==7){
newFilePlay();
song.play();
}
}
void removeTuioObject(TuioObject tobj) {
if (tobj.getSymbolID()==9){
recorder.endRecord();
name++;
recorder.save();
} else if (tobj.getSymbolID()==7){
song.close();
rename++;
minim.stop();
super.stop();
}
}
void stop()
{
in.close();
minim.stop();
super.stop();
}
1