DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

import an audio file in diadem

Hi there,
 
I have to open/import an audio file (WAV or MP3) in DIAdem (Ver 10.2.0f3031) to make some analysis. For this I installed the Audio dataplugin (Ver. 1.0.0.247). Butr if I open the WAv-file in the Navigator I get an error message, saying that the opeing failed. The WAV file seems not to be corrupted, cause it can be played on a media player.
 
What am I doing wrong?
 
Is there another way to transform an audio file into a TDM-file?
0 Kudos
Message 1 of 15
(9,806 Views)

Hi Frrranky,

I would have expected that to work.  I have had very good experiences with the Audio DataPlugin.  If you can post one of these WAV files, I'll be happy to see if I can reproduce the problem and then forward the file on to R&D to adjust the DataPlugin.

Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 15
(9,800 Views)

Hi,

 

I have a similar problem to export data files to .WAV format with Audio Dataplugin (http://zone.ni.com/devzone/cda/epd/p/id/44) in DIAdem 10.2 or DIAdem 11. I have signals (in Pascals) acquired with microphones (with a sampling rate = 41000 Hz). But when I open the .WAV file I get an error message.

 

Do you Know  what I'm doing wrong?

 

Thanks in advance.

 

0 Kudos
Message 3 of 15
(9,331 Views)

Hi asanchez3,

 

I'm confused, are you trying to use the Audio DataPlugin to import the WAV file into DIAdem or to export DIAdem data channels to a WAV file?  You used both verbs in your post.

 

Regardless, this should work.  Would you please post a sample WAV file or DIAdem data set, whichever is your starting point?  If you prefer you can instead send the data file to brad.turpin@ni.com.

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 4 of 15
(9,312 Views)

 

Hello Brad,

 

I would like to export data file (DIAdem DAT files) toWAV file with DIAdem Audio Dataplugin (http://zone.ni.com/devzone/cda/epd/p/id/44), Ihave signals (in Pascals) acquired with microphones (with a sampling rate =41000 Hz). But when I open the .WAV file I get an error message.

 

I attach a .DATfile with the original signal and the WAV file obtained with the AudioDataPlugin (this file can not be opened with any audio player).

 

Thanks!

 

Adrià.

 

0 Kudos
Message 5 of 15
(9,298 Views)

Hi Adrià,

 

Thanks for the data set, I now know what was going wrong.  It was actually quite easy to debug the problems in my DIAdem 2010 Alpha version, which sports a new feature to play back any channel in the Data Portal as audio.

 

There were 2 issues.  The first is that you have to add a time base to the data channel before you export it, the second is that you have to rescale the amplitude of the signal to the bit range (+/- 2^31) of a WAV file.  Here's a quick VBScript that does that, which I did test in DIAdem 10.2:

 

Channel = 1

WavFilePath = ChnPropValGet(Channel, "sourcedatafilepath") & ChnPropValGet(Channel, "sourceparentname") & ".wav"

Call ChnWfPropSet(Channel, "Time", "s", 0, 1/41000)

Amplitude = MaxV(Abs(CMin(Channel)), CMax(Channel))

Call ChnLinScale(Channel, Channel, 2^31/Amplitude, 0)

Call ChnCharacter(Channel)

IF FilEx(WavFilePath) THEN Call FileDelete(WavFilePath)

Call DataFileSave(WavFilePath, "Audio")

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 6 of 15
(9,291 Views)

Hi Brad,

 

You found the right answer for me.

 

Thank you for your useful help!!

 

Adrià. 

0 Kudos
Message 7 of 15
(9,286 Views)

That helped me a lot, I would even say this is a good base for a knowledgebase entry.

 

Another question: how to get the scaled TDM saved with "WAV GPI Filter"? I only get corrupted scratch sounds, the WAV GPI Filter does work with the example files, when setting amplitudes to min=-1 max=1.

0 Kudos
Message 8 of 15
(8,666 Views)

Hi Ilja,

 

Why would you be using the "WAV GPI Filter"?  What version of DIAdem do you have?  DIAdem versions 9.1 and later can use DataPlugins, and DIAdem 10.0 and later support waveform channels.  Have you tried using the "Audio" DataPlugin to export the data set to *.WAV file?

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 9 of 15
(8,652 Views)

Hello Brad,

you are totallay right. Nevertheless, 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.

 

wav-gpi.png

 

 

In case with Audio DataPlugin you have to add group properties

 

 


Audio DataPlugin

http://zone.ni.com/devzone/cda/epd/p/id/44

 

Writing audio files:

  • The Audio DataPlugin will write all channels of the first group to the wav file.
  • The sampling rate can be controlled by adding the property "Sampling_Rate" to the group and apply the desired sampling rate. The default is 44100.
  • Also the bit resolution can be adapted by assigning 8, 16, 24 or 32 to the group property "Bits_Per_Sample". The default is 32.

I am using DIAdem 11.2.0f4178

Well, I manage to add property "Sampling_Rate", the value have to be of integer type, then exporting with changed sampling rate works.

Adding "Bits_Per_Sample" property with an integer value generates a wav file which cannot be played or opened in an audio editor.

 

For example, when I modify the original audio file with Audacity to 16 Bits per Sample, the file has the same size, as when exported with DIAdem, with the difference the DIAdem generated audio cannot be played.

 

I was experimenting with the DIAdem example data, I am not sure what is the equivalent in English version, it should be "Sound_1" (car engine starting), please excuse all the German expressions in my screenshots.

 

diadem_data.png

 

Still one last question, why there is no need to rescale the example audio data (e .g . "Sound_1") and exporting to WAV still works, while having amplitudes from ca. 0.6 to -0.6

 

wav_amplitude.png

 

In case with the customer´s audio data, which has been rescaled through the VBScript, you necessarily need amplitudes from 1.6E9 to -2.1E9

 

wav_scaled.png

 

Thank you very much in advance

Best regards

0 Kudos
Message 10 of 15
(8,638 Views)