Discussion:
I want to acquire sound and perform analysis on it at the same time.
(too old to reply)
bnsaflsujt
2008-07-29 04:40:04 UTC
Permalink
Quick Rundown:
I am in charge of designing a program that will acquire several pieces of data, and write it to a log file.  Currently, I am only having problem with the signal side of the VI.
 
I have a two fold question.  First, I need to acquire sound and determine the amplitude of it real-time (2500 samples/second).  I haven't found any way of doing this, and I even tried setting the duration of an Acquire Sound VI to .0004 which is equal to 1/2500 of a second.  It just locks up the VI.  I desperately need this to work, or something like it.  If you look at my VI, you will see that I am attempting to acquire sound, perform an analysis on it, and output at the same time.  The only problem is, I only get a couple of data points a second, because I cant go lower on the duration or the VI locks up.
 
The second question is somewhat related to the first.  In the VI, I have a sawtooth generator, that I need to also be playing simultaneously, while collecting the data from the mic.  When ever I execute the VI, the speakers just pop at me, but the pop never changes.  I need the signal to last for 17.28 seconds, so I set the frequency to 1/17.28.  When it generates the log file, it appears that the frequency is increasing, but as I said, I need this to be continuous, and I need to continuously know what the amplitude is as well. 
 
I have one other problem, but I believe that I can easily fix it after I get the signals sorted out.  I want the VI to create new files every time it goes through the VI, but for some reason, it continues to write to the same file continuously.  I only want it to write readings to a log for 17.28 seconds, close it, zip it, and open a new file, but like I said, it isn't doing this.
 
SOMEONE PLEASE HELP MY APPARENTLY MISGUIDED PROGRAMMING!!! 


Backup 2.zip:
http://forums.ni.com/attachments/ni/170/344648/1/Backup 2.zip
bnsaflsujt
2008-07-29 04:40:05 UTC
Permalink
Here are the individual files for those that fear the my other file of virii.


HASP.vi:
http://forums.ni.com/attachments/ni/170/344650/1/HASP.vi


File Setup.vi:
http://forums.ni.com/attachments/ni/170/344650/2/File Setup.vi


Gather and Output.vi:
http://forums.ni.com/attachments/ni/170/344650/3/Gather and Output.vi
bnsaflsujt
2008-07-29 13:10:05 UTC
Permalink
Does anyone have any ideas?  Is what i am trying to do impossible?
Eli_S
2008-08-11 18:40:07 UTC
Permalink
Hi, I took a look at your code and it seems like you have the Acquire Sound VI configured improperly. If you want to acquire for 17.28 seconds then set this in the duration field. As far as the sampling rate, you mention that you want to Acquire at 2500 Hz. This number is too low and cannot be entered in the Sample Rate Field (at least for my sound card). In my specific case, I can only enter a number between 11025 HZ and 44100 Hz. When I set the duration to 17.28 Sec. and the Frequency to 25000Hz the VI acquires for 17.28 Hz without any problems.As far as sending the Sawtooth and acquiring at the same time, you have to create two separate loops and acquire in one and output in the other one because the way you have it set up right now, you will not acquire until you are done outputting because of the data flow. You need to do these two things in parallel and this is accomplished using two separate loops.
Loading...