01-30-2006 04:48 AM
02-07-2006 10:44 AM
02-08-2006 03:28 AM
There are some examples in the NI Example finder that may help with this application if you're still working on it. If you open the Example Finder and search for the keyword "sound".
The examples Record Wave File.vi and Play Sound.vi should give you an idea of how to set up your wav file to play.
02-08-2006 03:44 AM
Sarah
Thanks for your input, however what I am doing is slightly different to these examples. I basically have a data file, which I would like to open and save a copy as a wav file. What I am interested in is the range of values which the write wav file vi can accept. If I use sound pressure then the values will be from about -20 to +20 whearas if I use SPL then the values should be from 0 to 120.
Cheers
Dave
02-08-2006 03:59 AM
Hi Dave,
I found the following on another discussion forum:
A few things you should know before trying to record a wave file:
The type of wave file must be known. This is either 8 bit mono, 8 bit stereo, 16 bit mono, or 16 bit stereo. You have a 2D array, which indicates stereo. The 8 or 16 bit selection is then a matter of the levels of your array (amplitude). If the values are in the range of -127 to 127, then you have an 8 bit array. If they are between -32687 and 32687, then you have a 16 bit array. If they are somewhere in between, you will have to scale them, otherwise, you risk the volume being too low.
In order to input your array, you have to convert
it to an integer. In the math palette, you will find a conversion sub palette. Just drop in a U8 or U16 between your array and the appropriate input, and you will be set.
Again, depending upon your data, you will need either 8 or 16 bit stereo, and you have to put that in the Sound Format cluster (constant). The bottom variable is for the sample rate, which again, depends on your data.
Do you think your data is formated correctly according to this?
If so, and it's still not working, could you post your code so I can have a play around with it.
02-28-2006 07:54 AM
Hi Sarah
Thanks for that info and sorry for the delay in replying - I've only just got back round to looking at this project again. I wrote a vi that normalises the wave and scales it up to +-32000 and converts to integers. Fed it ino a wav vi and it now works perfectly.
Thanks for the help
Dave
03-13-2006 12:56 PM
03-15-2006 05:31 AM
Hi Nitin
Here is a JPG of the main part of the Vi. As you will see I am actually reading the data from a file. Hope this is some help.
Cheers
Dave
03-15-2006 11:26 AM