Dynamic Signal Acquisition

cancel
Showing results for 
Search instead for 
Did you mean: 

recorded audio from microphone and then saving it as a wav file except the wav file increases in size but there is no audio in the file at all?

Hi

 

I have a program here that is supposed to record audio from a microphone and then save it as a wav file on the pc except the program doesn't stop at all..it keeps on running and when i manually stop it and check the file it created, I find that the file size increased but the file doesn't contain any audio in it at all. I don't know why. Could someone please troubleshoot it with me.

 

 

Thanks a lot

0 Kudos
Message 1 of 11
(10,474 Views)

Hello Oli Oli O...,

 

Thanks for your post. I took a look at your program and it looks like the way its set up is to only stop the program if the user selects the stop button or if there is an error. So basically it will never stop unless you tell it to via the stop button or an error. I ran the program with no problem and was able to collect sound from my audio card. So I would make sure that your device ID is correct. I have always seen "0" work for that parameter because most computers have only 1 audio card in the system and it defaults to 0. You might try 1 or 2 and see if that makes a difference. Also what kind of microphone are you using? Are you using just a standard PC microphone or some kind of other recording system? Other than that you program works great. If you want the program to stop collecting by its self, you could use some kind of timing logic from the "timing palleted" and wire your logic to the "loop stop condition" which is the small stop sign in the while loop.

 

Let me know if this helps and I wish you the best on your application!

 

Cheers!

 

Corby_B

http://www.ni.com/support 

0 Kudos
Message 3 of 11
(10,458 Views)

Hey Corby

 

I'm using a standard headphone set with a mic at the moment. But I have a audio box that is going to be plugged in the microphone jack to get audio recording from. How would you know what device ID is it because I tried using 1 and 2 but I get an error and the only one that works is device ID 0. It still doesn't work. When I try to open the file with soundforge or realplayer, the file says that there is like 20sec of audio when you play it but there is nothing to play. so its just like the file got bigger but no audio. Thanks a lot for replying

0 Kudos
Message 4 of 11
(10,445 Views)

Hi Oli,

 

This is just a really quick thought. Is this in Windows? Have you tried using the Microsoft sound recorder to verify that your mic and your sound card are operational? If the hardware hasn't been verified that would be a quick thing to get out of the way before pushing deeper.

 

Daniel O.

Conditioned Measurements Hardware

0 Kudos
Message 5 of 11
(10,410 Views)

http://aakash-bapna.blogspot.com/2008/03/sigmatel-sound-card-marvell-lan-card.html

 

Shows how he found his sound card Device ID. I don't have a mic to test this at the moment, but on my PC I found the same information he found. I attached a picture with the related windows showing how to get there.

Message 7 of 11
(10,389 Views)
I could only put 0 for device ID otherwise i get an error 4800. don't know why
0 Kudos
Message 8 of 11
(10,378 Views)

Mr free oxen,

 

It looks like I was barking up the wrong tree in the post about device ID. I'm sure that the windows device manager gives us important Dev_Id info for some reason, but it doesn't look like it's for this. I also had success using device ID 0 like Corby suggested. And I got an error when trying to use the Dev_Id I found in the device manager.

 

For some time I was having trouble getting the write file vi to work appropriately. I kept on trying different kinds of writes with different inputs. Then I would check to see if the *.wav file that I wrote was any different and whether or not my media player would be able to play it. I was just having lots of problems getting the write vi to work... or so I thought. 

 

Actually, I'd been writing to a different file than I was opening with my media player. So the first time I generated a *.wav, I opened that in iTunes and from that point on, I would write new files and overwrite these same files, but when I wanted to check them in iTunes, I was opening the original over and over again. Oops.

 

Once I got it working in my code, I went back and reverted to your original code.  I removed the while loop... ran it... and got a legitimate *.wav as Corby had described. 

 

So... I don't know if you would have made the same mistake as me, but I figure it's at least a possibility.

 

-Daniel

0 Kudos
Message 9 of 11
(10,346 Views)

Hello Oli and Dousley,

 

Thanks for the posts.  Oli, I know you said you were using a head phone standard mic but was this giong to your main sound card. I believe in another post you mention that you have another audio device in your computer. Maybe you are pulling audio but from adifferent device. What we can do is pull the information from your sound card/s to see if we are reading from the right one. It will return in a list so you just index to what device you want to use. Take a look at this link for some more information on the VI's I am talking about. The VI I used is called WaveIOGetInfo.vi. I only have one audio device that is Sigma Tel Audio. 

 

Let us know if this helps.

 

Cheers!

 

Corby_B

http://www.ni.com/support 

 

 

0 Kudos
Message 10 of 11
(10,341 Views)