Click here to Skip to main content
15,909,898 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 291.7K   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

 
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 
The code that he gave to create a peak file to represent a wave file may be the key component to representing a wave file graphically.

I believe to create an editor one only has to have access to the wave buffer. Ability to change the size of the buffer to add-insert-delete or add effects to any portion of it.

That is the easy part.

But to make things understandable for the users of the editor you need visual representation that can tie into a control device (horizontal scroll or edit boxes etc..) so that the current position of the wave buffer is represented visually so the user can relate to what part of the wave buffer they are manipulating.

That is the hard part and the part this author addressed.

It should then be simple to write out the results since the only thing that changed was the size and/or values of the buffer. None of the header info or subchunks of the riff values output file (wav) is affected.

Me I would also like to visually represent the wav buffer as it is being created. Like the way you see some streaming video/music represented ( A graphic animation styled feedback)

I believe I may be able to take the logic of the Peak file and sampling to give visual feedback while doing the recording. I wont create a Peak file for that only a few samples. Then when the recording is done take the whole buffer and create a Peak file then represent it graphically.

When playing the wave buffer I want to logically tie into the buffer and Peak file so I can show a sweeping verticle line that shows the user the current position of buffer. Then I want the user to be able to stop at the current position and elect to truncate after or before the current position. Because during recordings the user may have recorded too long or there may have been an undesirable sound in beginning of recording (Example recording a song. DJ on radio keeps talking during songs beginning. And/or user keeps recording past song end). That way the user can edit the recording. I do not have a need to insert other wave buffer into each other but it is not beyond the grasp of my comprehension. Just no need.

I have all the functions to modify the buffer for effects. "Echo, reverb, chorus, high pitch, low pitch and volume control. BTW, low level api setvolume does not work.

But I have been wanting to add the ability to chop/cut out sections of the wave buffer. But in order to do that I needed graphic representation. Saving the results is a piece of cake.

Believe me I have been searching the web and as this author states there is not much out there.

I am hoping to chat with you dswigger.

Thanks much
RJ
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 
GeneralRe: Rather nice. Thanks. Pin
Azonacun24-May-03 23:12
Azonacun24-May-03 23:12 
Generalmp3 manipulation of speed and pitch Pin
Anonymous23-Jan-03 5:39
Anonymous23-Jan-03 5:39 
GeneralRe: mp3 manipulation of speed and pitch Pin
Mad Docs Hairy Belly3-Feb-03 9:24
Mad Docs Hairy Belly3-Feb-03 9:24 
Generalfrom normal wav to EBU format Pin
nmanes26-Nov-02 2:32
nmanes26-Nov-02 2:32 
GeneralRe: from normal wav to EBU format Pin
dswigger29-Nov-02 15:49
dswigger29-Nov-02 15:49 
GeneralRe: from normal wav to EBU format Pin
Trollslayer5-Apr-04 12:54
mentorTrollslayer5-Apr-04 12:54 
Generalfiles not in my include folder Pin
Anonymous17-Jul-02 16:21
Anonymous17-Jul-02 16:21 
Generalfiles not in my include folder Pin
Anonymous17-Jul-02 16:20
Anonymous17-Jul-02 16:20 
GeneralProgram doesn't start Pin
1-Feb-02 4:38
suss1-Feb-02 4:38 
GeneralRe: Program doesn't start Pin
8-Feb-02 21:07
suss8-Feb-02 21:07 
GeneralRe: Program doesn't start Pin
9-Feb-02 18:36
suss9-Feb-02 18:36 
GeneralWave form not visible Pin
cyberman_7721-Aug-01 7:27
cyberman_7721-Aug-01 7:27 
GeneralRe: Wave form not visible Pin
dswigger21-Aug-01 9:01
dswigger21-Aug-01 9:01 

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.