Copyright © 2005-2019 MultiMedia Soft

How to export the loaded song into a WAV file

Previous pageReturn to chapter overviewNext page

If you need to perform a specific analysis of a sound loaded inside a player, the best thing to do is to have it available in uncompressed WAV format: for this purpose, the container application can choose to export the sound to a WAV file on hard-disk or in memory. It's important to note that the exported WAV file will not be resampled at all so it will have the same sample rate and number of channels of the loaded sound file; if you should need to perform a resampling you should consider using the ExportToFile method of our Audio Sound Editor for .NET component in place of Audio DJ Studio for .NET.


The first thing to do is calling the RequestSoundExportToWav method: this method has a strPathname parameter were you can specify the full pathname of the output disk file in WAV format or, if the parameter is left empty, the exported WAV file will be stored inside a memory buffer.


Depending upon the size of the loaded sound, the export session could result in a lengthy operation so it will be performed on a separate thread: during the export session, the container application will be notified about the exporting advancement through the following intuitive events: ExportToWavStart, ExportToWavPerc and ExportToWavStop.


As you will understand, the ExportToWavStop event will notify the container application about the exported WAV file availability and will report the effective size in bytes used to store the WAV file; if the exported WAV file has been stored on a hard-disk file, you will have the possibility to access its contents through the file access functions allowed by your development environment; if the exported WAV file has been stored in memory, you will have the possibility to copy the file contents into a buffer allocated by the container application through a call to the CopyExportedWavToMemory method: in this last case, it's important to note that after calling the CopyExportedWavToMemory method the original memory buffer, internal to the control and containing the exported WAV file, will be discarded from memory so it won't be accessible for further copies.