How to use the control in your projects |
|
First of all let us say that if this guide should not be clear to you, feel free to contact our support team for any doubt or curiosity you may have: we usually answer all of our customers questions in less than 24 hours. Note that the purpose of this guide is to give a taste of the main features available inside Active Sound Editor.
As an integration to this guide some example of use of this component, in Visual Basic 6 and Visual C++ languages, can be found inside the "Samples" folder: if during the setup phase you left the installation directory to its default, you will find them inside "\Program files\MultiMedia Soft\Active Sound Editor\Samples".
The first needed step is to add the control to your project: see the Adding the control to a project section for details.
Before starting sound editing management, the component needs to be initialized: for this purpose it's mandatory a call to the InitEditor method; the best place to call this initialization method is usually the container form initialization function: for example, when using Visual Basic 6, it will be the Form_Load subroutine or, when using Visual C++, it will be the handler function of the WM_INITDIALOG Windows message. The main purpose of calling the InitEditor method is to synchronize the component with its container form.
Important note
All of our audio-related components share the same instance of the multimedia engine AdjMmsEng.dll or AdjMmsEng64.dll whose initialization/disposal requires a certain amount of time because it needs to negotiate with the underlying Windows multimedia system and the sound card drivers: this operation, depending upon the system and quality of sound card drivers in use, may require some second. In order to obtain a better efficiency when instancing the component on multiple container forms within the same application, it would be highly recommended hosting and initializing, through the InitEditor method, an instance of the component inside a form that will stay alive for the full life of the container application, for example the application's main form: although this instance of the component may stay hidden and may never be used, the memory footprint would be in any case irrelevant but it would keep the multimedia engine alive, allowing a faster loading/disposal when the container form is closed/opened.
|
After the control's initialization we should decide if the sound under editing will be stored in memory or inside a temporary file: this can be done through the GetStoreMode and SetStoreMode methods; it's important to note that the sound under editing will be always stored in uncompressed WAV PCM format so its total size could become an issue when dealing with low-end systems:
• | when stored in memory, it will be possible getting the pointer to the memory buffer containing WAV PCM data through the GetMemoryPtr64 method and the total size in bytes of the memory buffer through the GetMemorySize method: it's strongly suggested avoiding memory based storage for clips longer than 10 minutes. |
• | when stored inside a temporary file, it will be possible getting its absolute pathname through the GetTempFilePathname method and its total size in bytes through the GetTempFileSize64 method. |
At this point we can load a sound for editing purposes from different sources:
• | from a disk file through the LoadSound or LoadSoundFromRawFile methods; the most diffused file formats are supported. In case the file to load should be a multi-channel one, like 5.1 or 7.1, you could keep existing channels separated by invoking the MultiChannelLoadingModeSet method with the nMode parameter set to MULTICHAN_DOWNMIX_NONE: without this call the source audio file will be automatically converted to stereo during the loading procedure. |
• | from a file, previously encrypted through our CryptSound™ application, through the LoadSoundEncrypted method. |
• | from a memory buffer through the LoadSoundFromMemory or LoadSoundFromRawMemory methods; the most diffused file formats are supported. |
• | from the system Clipboard through the LoadSoundFromClipboard method: the availability of a sound inside the Clipboard can be detected calling the IsSoundAvailableInClipboard method. |
• | from another instance of Active Sound Editor through the LoadSoundFromEditingSession method. |
• | from a recording session activated by an instance of our Active Sound Recorder ActiveX control through the LoadSoundFromRecordingSession method. |
• | from an entry of a ZIP file through the LoadSoundFromZip method |
• | from an external source which provides raw audio data by invoking the RawAudioFromExternalSourceStart method, followed by a number of calls to the RawAudioFromExternalSourcePush method, which allows storing raw audio data, and finally by invoking the RawAudioFromExternalSourceStop method which allows loading received raw audio data into the editor |
A loading session can be canceled through the LoadSoundCancel method.
By default, each of the mentioned loading methods will create a new editing session discarding the existing one: this behaviour can be modified through the SetLoadingMode method which allows loading a new sound without discarding the existing editing session and to perform one of the following operations:
• | Append the loaded sound to the existing editing session. |
• | Insert the loaded sound at a given position within the existing editing session: the insertion position must be previously set through the SetInsertPos method. |
• | Mix the loaded sound at a given position within the existing editing session: the mixing position must be previously set through the SetMixingPos method; it's important to note that, during the mixing phase, you can separately modify the volume of the loaded sound and the volume of the existing editing session through a previous call to the SetMixingParams method: as a further feature this method allows putting the loaded sound in loop over a given range of the existing editing session. |
• | Overwrite the existing editing session with the loaded sound: the overwrite position must be previously set through the SetOverwritePos method. |
As a further loading feature, you can limit the range of sound data that will be loaded from the given sound file with a previous call to the SetLoadingRange method, a useful feature if you want to extract a small portion of an existing sound file for editing purposes.
Information about the loaded sound file, for example the audio format, can be retrieved through the GetFileType and GetFileInfo methods.
Further editing features, applicable to the whole editing session or to a specific range, can be summarized by the following list:
• | Copy to the clipboard through the CopyRangeToClipboard method. |
• | Delete through the DeleteRange method. |
• | Delete of portions outside of a given range through ReduceToRange method. |
• | Silence insertion through the InsertSilence method. |
• | Trim initial and final portions of silence through the TrimSilence method. |
A certain number of special effects can be applied to the existing editing session through the Effects COM object:
• | Flat volume |
• | Sliding volume |
• | Volume automation |
• | Equalization |
• | DMO (DirectX Media Object) effects |
• | Chorus, Compressor, Distortion, Echo, Phaser, Reverb, Auto Wah and Dynamic amplifier effects |
• | Internal and External Custom DSP effects |
• | Commercial and freeware VST effects |
• | Reverse sound |
• | Tempo change |
• | Playback rate change |
• | Pitch change |
• | IIR and FIR filters |
• | Vocal removal filter |
• | Normalization |
• | DC Offset removal |
All of the mentioned effects are applied through separate editing sessions meaning that, for each of them, there will be a corresponding method to invoke. Through the interaction with our Active DJ Studio component, which supports most of the mentioned effects in real time during playback, you have the possibility to apply a certain amount of settings in a single editing session by invoking the Effects.PlayerSettingsApply method.
Basic noise removal is also supported for the following kind of noises:
• | Pops and Clicks removal |
• | Hiss noise removal |
See the How to perform noise removal tutorial for further details.
During the editing session the WaveformAnalyzer COM object allows performing a deep analysis and detailed graphical visualization, with zooming and panning capabilities, of the sound's waveform.
An editing session can be canceled through the EditSoundCancel method.
Contents of the editing session can be exported to an output file through the ExportToFile method. The encoding format used for the output file can be set through the EncodeFormats.FormatToUse property and settings specific for each available sound format can be set through the available sub-properties of the EncodeFormats property: if for example you need to export in MP3 format, you will have to deal with properties and methods available inside the EncodeFormats.MP3 property.
A basic playback system is also available in order to play the current content of the editing session; available methods are the following:
• | PlaySound and PlaySoundRange |
If you should need more sophisticated playback features, for example displaying visual feedbacks (VU-Meter, Spectrum, etc.) during playback, you should consider using Active Sound Editor in conjunction with our Active DJ Studio ActiveX control which comes with a method, named LoadSoundFromEditingSession, that allows loading and playing back contents of an editing session.
Through the SilencePositionsDetect method, the control supports Silence detection, a feature which allows detecting positions of silent portions inside the loaded sound and store them inside a list. The list of detected silent portions can be enumerated at a later time through the SilencePositionsNumGet and SilencePositionsGetRange methods.
Silence detection can be canceled at any time through the SilencePositionsCancelDetect method.
Related to the mentioned silenced detection, through the TracksPositionsDetect method the control support audible tracks detection also so, instead of detecting silent portions, in a very similar way it allows detecting and enumerating audible track separated by portions of silence. The list of detected audible tracks can be enumerated at a later time through the TracksPositionsNumGet and TracksPositionsRangeGet methods.
After reviewing enumerated tracks, you may decide that two tracks should be attached together in order to consider them as a single one: this can be done through a call to the TracksPositionsRangeAttachToNext method.
Audible tracks detection detection can be canceled at any time through the TracksPositionsCancelDetect method.
Finally, an editing session can be closed and its contents discarded from memory through a call to the CloseSound method.
Further capabilities of the control, not directly related to sound editing, are the following:
• | the JoinFilesFromDisk method allows joining two mono sound files into one single stereo output sound file. |
• | the ExtractAudioFromVideoFile method allows extracting the audio track from a video clip and to store it inside an output sound file that may be used later for further editing. |
• | Conversion of sound files from an audio format to another one with the possibility to keep existing tags and to apply normalization and DC Offset removal: see the How to convert the format of sound files tutorial for details. |
An important topic to keep count of is how synchronization between the container application and events generated by this control works: see the How to synchronize the container application with the control tutorial for further details.