Click here to Skip to main content
15,914,452 members
Articles / Desktop Programming / ATL

MMWaveEditX - Advanced Wave File Editor Control

Rate me:
Please Sign up or sign in to vote.
4.25/5 (20 votes)
20 Aug 20012 min read 292.3K   6.5K   91   78
A control for editing wave files which uses peak values for visual display

Sample Image

Introduction

I have loads of ActiveX controls laying around that I have written.  Some seem somewhat useful, others are wasted drive space.  I came across this one the other day and decided somebody out there might be able to use it.

Audio programming is somewhat of a black art, it took me a while to figure out that "Peak" files are used by waveform editing software to visualize the waveform.

What are peak files? Well essentially you comb through a wave file and take snapshots of averages at different intervals.

The benefit is obvious, by using a peak file we can visualize a .wav file using a much smaller dataset than the 'pcm' data contained in it.

Here is an example: a .wav file whose size is 41.6 megabytes can be visualized with peak data totaling just under 333k. That is how we are able to do really fast zooms and selections on what is in reality a huge amount of data.

I tested my peak file algorithms against SoundForge ( a well known audio editor) and they come pretty close to matching the speed at which
a peak file can be built.

This control is not finished, has bugs, and in general should be used as a starting point for creating your own editor (or just as a learning tool). I do not have time to fully document (or partially) the code, so you will have to dig through it to figure it out (sorry).  I wrote this code more than a year ago and just by looking at it I can see numerous places for optimization.

The control itself contains all the visualization/wave file parsing/peak creation routines.  I included a dialog based app to show how you can use it.

Being a black art it is notoriously hard to find out how the sound coding wizards do the things they do, hopefully my little control will help you in some way.

You are free to use the code as you wish, just drop me an email if you use it in something interesting, extended its usefulness, hate me for not documenting it, love me for giving it away, just want to say "hey!".


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralBasic understanding Pin
RJSoft27-Jun-04 5:33
RJSoft27-Jun-04 5:33 
GeneralRe: Basic understanding Pin
RJSoft27-Jun-04 5:38
RJSoft27-Jun-04 5:38 
GeneralRe: Basic understanding Pin
RJSoft27-Jun-04 6:14
RJSoft27-Jun-04 6:14 
GeneralRe: Basic understanding Pin
RJSoft27-Jun-04 11:24
RJSoft27-Jun-04 11:24 
GeneralProblem to open Pin
Mehdi_Hosseinpour1-Apr-04 1:04
Mehdi_Hosseinpour1-Apr-04 1:04 
GeneralUsage of activeX Pin
Jezzy Lee5-Nov-03 18:21
Jezzy Lee5-Nov-03 18:21 
GeneralRe: Usage of activeX Pin
dswigger6-Nov-03 6:21
dswigger6-Nov-03 6:21 
GeneralGreat interface but some problems Pin
LrdElder24-Oct-03 7:30
LrdElder24-Oct-03 7:30 
Let me start off by saying good job!! I love the interface. Graphically this is excellent work. I think you might want to mention somewhere that this only works with 16 bit stereo wave files though. I know this is a work in progress so I thought I might share a couple of things I have found. This mainly pertains to the CEditWaveFile::BuildPeakFile16BS since this is a major function in the code and I haven't yet had a chance to look at the rest of it very much. You are reading in a chunk data of size 512000 into a variable that is only sizeof 256000. This is going to give you an overwrite of 256000 which is the only reason the &lpSamples[0] and &lpSamples[1] actually work. The &lpSamples[1] is actually pointing to the overwritten data. You might want to add another variable or increase your array size. At the end of the function you are calling "delete lpSamples" which is the variable you read your file input into. The only problem with this is that lpSamples points to wSamples which gets destroyed when it loses scope at the end of the function anyways. You can safely remove this line. I love the graphical part of the interface and I do plan on using it, I just wanted to pass along a couple of thoughts I had on it. Smile | :) Good job Smile | :)
GeneralRe: Great interface but some problems Pin
dswigger24-Oct-03 10:25
dswigger24-Oct-03 10:25 
GeneralRe: Great interface but some problems Pin
Anonymous14-Feb-05 10:15
Anonymous14-Feb-05 10:15 
GeneralHey David Pin
zonix15-Oct-03 7:21
zonix15-Oct-03 7:21 
GeneralGood Pin
wu29-Sep-03 0:49
wu29-Sep-03 0:49 
Generalproblem with used in VB or delphi Pin
xtnl778-Aug-03 3:47
xtnl778-Aug-03 3:47 
GeneralPeak files Pin
Juan Carlos Cobas24-Jun-03 11:10
Juan Carlos Cobas24-Jun-03 11:10 
GeneralIt's not editor! It's viewer! Pin
icezone4-Jun-03 4:25
icezone4-Jun-03 4:25 
GeneralRe: It's not editor! It's viewer! Pin
dswigger4-Jun-03 13:22
dswigger4-Jun-03 13:22 
GeneralRe: It's not editor! It's viewer! Pin
icezone4-Jun-03 20:36
icezone4-Jun-03 20:36 
GeneralRe: It's not editor! It's viewer! Pin
PMartos8-Jan-04 4:49
PMartos8-Jan-04 4:49 
GeneralRe: It's not editor! It's viewer! Pin
icezone4-Jun-03 20:43
icezone4-Jun-03 20:43 
GeneralRe: It's not editor! It's viewer! Pin
dswigger5-Jun-03 3:19
dswigger5-Jun-03 3:19 
GeneralRe: It's not editor! It's viewer! Pin
RJSoft22-Apr-04 3:09
RJSoft22-Apr-04 3:09 
GeneralLot, lot, lot of bugs ...... Pin
Anonymous5-May-03 23:57
Anonymous5-May-03 23:57 
GeneralRe: Lot, lot, lot of bugs ...... Pin
dswigger6-May-03 3:15
dswigger6-May-03 3:15 
GeneralRather nice. Thanks. Pin
Jerry Evans1-Mar-03 7:47
Jerry Evans1-Mar-03 7:47 
GeneralRe: Rather nice. Thanks. Pin
dswigger1-Mar-03 12:00
dswigger1-Mar-03 12:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.