Jump to content
Joaquin_H

Issue getting sound samples

Recommended Posts

Hi,

I'm trying get the correct size of the array data from the acquire sound block. I have set it up at 44100 Hz sample rate and 1 second of duration.

I convert the output data from dynamic data to single waveform and then using get waveform components I can get the size of the Y array.

But the size I get is 33075 samples, instead of 44100. I don't know where are the 1025 samples, maybe this samples are used to carry the timestamp and dt info.

Can anyone help me with this?

Thanks!

Share this post


Link to post
Share on other sites

Are you collecting the data by setting the number of samples in the DAQ Read or are you waiting for 1 second then collecting the data points present?

Share this post


Link to post
Share on other sites

Are you using the lvsound2 library, particularly the Sound Input library? I know first-hand that its input parameters are buggy, in that asking for x samples at x Hz will not actually return x samples, it will be some proportion fewer. I ended up using a coefficient to tweak some of the inputs to give me (approximately) the right amount of data.

Share this post


Link to post
Share on other sites

Sounds like an express vi but it may be built on that library still. If you can post some code it will help us understand what your doing.

Share this post


Link to post
Share on other sites

Are you collecting the data by setting the number of samples in the DAQ Read or are you waiting for 1 second then collecting the data points present?

I'm using the express VI and waiting for a second, I don't know another way to do it, I'm just starting with Labview

Thanks

Are you using the lvsound2 library, particularly the Sound Input library? I know first-hand that its input parameters are buggy, in that asking for x samples at x Hz will not actually return x samples, it will be some proportion fewer. I ended up using a coefficient to tweak some of the inputs to give me (approximately) the right amount of data.

Sorry I don't know about libraries yet, I'm just starting with Labview and a guide book. I just put an acquire sound express VI and convert the dynamic data into an array to get the size.

I'm trying to make a scope and for some calculus I need the right amount of data. I'm learning now about queue the data to implement the diferents types of inputs I need as mic, text o wav files.

Thanks

Share this post


Link to post
Share on other sites

I'm pretty sure the Express VI you're referring to depends on the library I mentioned. You should follow James' suggestion and post your code.

Share this post


Link to post
Share on other sites

Yes, I'm using an express VI. I don't know how to upload the file to the forum, you have it here: http://www.2shared.c...qBSEg/test.html

If you click "More Reply Options" on this page, it will take you to the full post editor, which has a panel for uploading attachments.

I took a peek at your VI - it does depend on the lvsound2 library. As I mentioned before, my workaround was not elegant; I just multiplied my acquisition duration by a constant to get the right output duration. Do me a favor and report this to NI (http://www.ni.com/support) so they know someone else is running into this problem.

  • Like 1

Share this post


Link to post
Share on other sites

... I just multiplied my acquisition duration by a constant to get the right output duration...

Just info for the thread; if you want X samples you'll actually get X mod (4) * 3 samples out, or roughly 0.75X

So the input should approximately be set to X * 4 /3 to get close to X samples out.

I've seen this type of bug in another application a long time ago, and then it was due to the conversion from a 24bit stream to a 32bit stream.

/J

  • Like 1

Share this post


Link to post
Share on other sites

I remember reading on ni.com somewhere that there are issues with only getting 75% of requested sound.

FWIW, I just fixed all my sound problems (both input and output) by upgrading from LV2011 to LV2012. lvsound2.dll seems to be the same for both (exact same # of bytes, anyway), so it seems to be something in LV2011 that just doesn't play well with sound.

Share this post


Link to post
Share on other sites

FWIW, I just fixed all my sound problems (both input and output) by upgrading from LV2011 to LV2012. lvsound2.dll seems to be the same for both (exact same # of bytes, anyway), so it seems to be something in LV2011 that just doesn't play well with sound.

Do you, by chance, add or remove devices during your application's lifetime? I had a big problem with that on a tester which paired and unpaired BT audio devices. I can't remember if we ever tested it on LV2012.

Share this post


Link to post
Share on other sites
Do you, by chance, add or remove devices during your application's lifetime? I had a big problem with that on a tester which paired and unpaired BT audio devices. I can't remember if we ever tested it on LV2012.

Not programmatically, if that's what you mean. I did try various devices with no luck, but all of that was all via configuration files.

All I can say is, if you had any issues with sound while running LV2011, try it with LV2012 and you may be pleasantly surprised. Or really annoyed that you spent all that time trying to debug something that was actually a LV problem. :-)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.