We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSound,  Music Libraries › Microphone Recording with ESS
Page Index Toggle Pages: 1
Microphone Recording with ESS (Read 1703 times)
Microphone Recording with ESS
May 9th, 2007, 4:25pm
 
Hi there, I'm a relatively new Processing user, sort of been lurking for a long time on the forums and dabbling here and there.  I decided to code my latest uni assignment in processing, and I'm just wondering if you people out there can help me.

Currently I'm using ESS to record audio data from my microphone, and save it as a .wav file on my hdd.  To do this Im using an AudioInput to access the mic, sending that to an AudioStream, and then saving the AudioStream into an AudioFile. ( I think that's the best way to describe it ).  

This works fine, I can record microphone input with no worries, the only problem with this implementation is that the microphone input is "echo-ed" back through the speakers as It's being recorded.

Is there any way to record from a microphone or other line-in device, without it being broadcast through the speakers as well ?
Re: Microphone Recording with ESS
Reply #1 - May 9th, 2007, 5:29pm
 
If you're on windows, you just need to open the sound panel (the spaker icon in the system tray) and mute the mic input.
Re: Microphone Recording with ESS
Reply #2 - May 10th, 2007, 12:21pm
 
Thanks for the reply.

I'm in windows vista so the sound panel works a little bit differently.  However, muting the mic input still has no effect. ( I've tested this on XP too, same thing ).

I'm not sure if I made it clear in my original post, the microphone isn't ALWAYS doing that 'echo' thing.  Only when I start running the processing sketch.
Re: Microphone Recording with ESS
Reply #3 - May 10th, 2007, 4:09pm
 
If the AudioStream is feeding its input back to the system, that's where your echo is coming from. I assume you have the mic set to monitor, so when you aren't running anything you can talk in the mic and it comes out the speakers. You should be able to write from the AudioInput directly to the AudioFile, which would solve the echo problem, I think.

From the AudioFile example (just changed the var name):

Code:

if (recording)
{
myFile.write(myInput);
bytesWritten+=myStream.size*2;
}
Re: Microphone Recording with ESS
Reply #4 - May 12th, 2007, 12:19am
 
changing that line gives me the following error :

Code:

Semantic Error: No applicable overload for a method with signature "write(krister.Ess.AudioInput)" was found in type "krister.Ess.AudioFile". Perhaps you wanted the overloaded version "void write(krister.Ess.AudioOutput $1);" instead?
Re: Microphone Recording with ESS
Reply #5 - May 12th, 2007, 12:23am
 
Huh, that's a bugger. I don't have a good answer for you. According to the doc page for AudioFile.write() it should be able to take an AudioInput: http://www.tree-axis.com/Ess/AudioFile/AudioFile_write.html

You could try muting the AudioStream, but I suspect then you'd wind up with silence in your file.
Re: Microphone Recording with ESS
Reply #6 - May 12th, 2007, 12:25am
 
haha yeah, I've tried muting the stream too...No sound at all.

hmmm, ok.  Thanks for the help - I'll keep at it! and see what I can come up with.  Will post in here if I manage to come out with a solution.
Re: Microphone Recording with ESS
Reply #7 - May 24th, 2007, 3:37pm
 
Just an update for those who were following this thread, I found a solution today.  And it's actually basically what ddf suggested earlier ( and which I actually tried ), maybe ddf suggested a different solution, and I tried something else.  But oh well , this is what I did :

basically changed the following code, as ddf suggested :

Code:
 if (recording)  
{
myFile.write(myStream);
bytesWritten+=myStream.size*2;
}
so that it was :

Code:
  if (isRecording) {
myFile.write(myInput.buffer);
bytesWritten+=myInput.size*2;
}


I completed deleted "void audioStreamWrite", and put that code inside "void audioInputData".

I *think* that's all I did.  It's late, so I'm not thinking 100% straight, all I know is that now it works! And it doesn't give me a live microphone output/monitor during recording.

So thankyou for your help everyone, if you need further explaination, feel free to reply here, I'm watching the topic for replies.
Re: Microphone Recording with ESS
Reply #8 - Jun 10th, 2007, 6:54pm
 
I'm a totally new to processing. I have to make an application that records and plays back the sound.

I would like to ask for the source code that you used for recording and saving files, mentioned above.

Is it possible?

tnx
Page Index Toggle Pages: 1