Some audio applications will require the ability to extract only portions of a wave file. Some applications of this feature include:
All of these scenarios can be handled with the ACCTools Audio Splicing Tool. This object is created using CreateObject("ACCTools.AudioSplicer").
The splicing object has a GetLength method which accepts the name of a wave file and returns the length of the audio file in seconds. Two other methods, ExtractBeginning and ExtractEnding allow the user to extract any number of seconds from the beginning or ending of the audio file. The three methods are as follows:
The following sample code shows how to extract the beginning and ending 1.5 seconds of an audio file:
Set obj = CreateObject("ACCTools.AudioSplicer")MsgBox obj.GetLength(AppPath & "\Examples\Goodbye.wav")obj.ExtractBeginning(AppPath & "\Examples\Start.wav", _
AppPath & "\Examples\Goodbye.wav", 1.5)obj.ExtractEnding(AppPath & "\Examples\End.wav", _
AppPath & "\Examples\End.wav", 1.5)
The ExtractBeginning and ExtractEnding functions are very fast and will work well with even large wave files.