11-02-2010 12:07 PM
Hi Ilja,
The German in the screenshots is not a problem, I read German just fine. Nevertheless, I am still confused. You say, "...one of my customers would like to use the WAV GPI Filter, which offers a dialog with settings. Changing them does generate the appropriate wav-file." Sooo, if your customer wants to use the WAV GPI filter because it has the dialog they like, and if that dialog creates an appropriate wav file, then... what is the problem exactly?
Then you ask a lot of interesting questions about using the Audio DataPlugin. But if your customer wants to use the WAV GPI Filter, then why the interest in this other approach? I'm also confused on the order of actions that leads to the various screenshots you posted.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
11-03-2010 04:29 AM - edited 11-03-2010 04:31 AM
Hello Brad,
thank you very much for your efforts, I admit I have to clarify my questions:
1. How to change bits per sample when exporting to WAV format
The WAV GPI Filter works with the delivered example data only. When I try to export customer´s data with the WAV GPI Filter I only get scratched sound, i. e. WAV GPI Filter fails. If the WAV GPI Filter worked, I would be able to change those settings.
At least exporting with Audio Data Plugin works, with the restriction I am not able to change Bits_Per_Sample with the appropriate group property, the resulting audio consists of noise only.
What is the right way to change Bits_Per_Sample with the Audio Data Plugin?
2. General question:
How to explain my customer why the sound data has to be rescaled through the VBScript before exporting to WAV?
In case with the delivered example data amplitudes range approximetely from +1 to -1 and WAV export is working fine. Customer´s data has to be rescaled to amplitudes from 1.6E9 to -2.1E9.
That is what I am trying to show with the screenshots below:
Example data delivered with DIAdem: Customer´s data after rescaling through the VBScript:
The original customer´s data:
ftp://ftp.ni.com/outgoing/946878.zip
Best regards
11-03-2010 04:50 AM
Hi Ilja,
We set the Bits_Per_Sample & Sampling_Rate as follows:
Call GroupPropValSet(1, "Bits_Per_Sample", L1) 'L1=16 or 32
Call GroupPropValSet(1, "Sampling_Rate", Frequency_)
Hope that helps.
Regards,
Marc.
11-03-2010 05:21 PM
Hi Ilja,
I can get the GPI-WAVE Filter to "work" for this customer data set, but I have to cheat a little on the sampling rate. The TDMS file is sampled with a 2.00E-05 sec period. If I select the closest matcher in the GPI-WAVE dialog (44100 Hz), that corresponds to a 2.27E-05 sampling period.
If you read the resulting *.wav file back into DIAdem, it has a (16 bit) scaling very close to -32000 to 32000. This is the standard way *.wav files work.
16 bit wave files are unscaled integers from -2^15 to +2^15
24 bit wave files are unscaled integers from -2^23 to +2^23
32 bit wave files are unscaled integers from -2^31 to +2^31
I certainly get the correct export behavior by using the "Bits_Per_Sample" and "Sampling_Rate" properties-- did you assign them to the Group as Long Integers?. What about if we scale the channel BACK to what it was prior to the WAV file export, so the user never needs to know that the waveform values have changed?
Bits = 16 Rate = "" '44100 Call DataDelAll Call DataFileLoad(AutoActPath & "Diadem Wave.tdms", "TDMS") IF Rate <> "" OR NOT IsNUmeric(Rate) THEN Rate = 1/ChnPropValGet(1, "wf_increment") Call GroupPropValSet(1, "Bits_Per_Sample", CLng(Bits)) Call GroupPropValSet(1, "Sampling_Rate", CLng(Rate)) Amplitude = MaxV(Abs(CMin(1)), Abs(CMax(1))) Call ChnLinScale(1, 1, 2^(Bits-1)/Amplitude, 0) Call ChnCharacter(1) Call DataFileSave(AutoActPath & "Diadem Wave " & Bits & " - " & Rate & ".wav", "Audio") Call ChnLinScale(1, 1, Amplitude/2^(Bits-1), 0) Call ChnCharacter(1)
Brad Turpin
DIAdem Product Support Engineer
National Instruments
11-10-2010 12:38 PM - edited 11-10-2010 12:38 PM
Hello Brad,
today I had time to try your suggestions.
Everything works as described.
Thank you very much.
Best regards