Page 1 of 1

xAudio - Simple Wav Editor

Posted: Fri May 12, 2006 2:01 am
by Xombie
This is a small part of a much larger program (which I'll post here later... without the source code). Also, 97% of it is about 7 or 8 months old. I started on it and then let it sit for a long time because I had other stuff to do. Finally today I thought I would try and get it in working condition.

First, this is an extremely modified version of zapman's old wav editor code. Extremely modified. Second, I mainly planned on just making this in it's very basic form - a grapher for wav files that you could zoom around and such. Then I thought, heck, how hard would it be to implement a simple effect system? So I tried that out. Let me emphasize Simple there. Very simple. I put in a silencer (that was easy :) ) and both an increase/decrease volume effect. I called them filters in the code. Oops :) Anyway, it's the first time I tried that and it was purely because I figured *someone* would ask if it was possible. Don't expect to be impressed by that. My wonderfully complex increase/decrease volume thing simply multiplies the sample by a number. Yeah. Sorry :)

This will only currently load wav files. Theoretically, you could drop in other types fairly easily. I've built it so that most of the procedures aren't specific to what kind of audio file it is. Once you have it read into memory, it's cool. 8, 16 and 32 bit wav files are supported with mono and stereo. It wouldn't be too hard to modify it for more than 2 channels.

The neat trick that I was proud of is that it can load a 250 mb file into memory and only use about 6mb. I store info in blocks of data which are then drawn to screen. Playing the file still reads from the original.

Here's the demo app with a simple wav file loaded. The three scrollbars are scale, zoom & position (left to right).

Image

Nothing special. The next is after applying a silence effect. It also shows a selection. There are 'events' that can be set up and one of them is shown there - the selection event. The demo app is set up to display the currently selected samples & time (in milliseconds).

Image

Finally, the very very simple and laughable increase volume effect added as well.

Image

Note the selection again.

Anyway, there are still bugs and legacy code so don't be surprised when it formats your computer and sends your email addresses out to random erotic websites. Also, I stripped this sucker out of my main project and tore it to pieces for this release so there are probably bits of the old code floating around in it uselessly. Ah well :D In fact, I can almost guarantee you'll run into a bug when you mess with the zoom too much. You'll get empty red lines. So, yes, I am aware of that one :)

http://www.seijin.net/Storage/Code/xAud ... io-PB4.rar

I have to thank zapman for getting me started on this. This (and my main project) would not have happened without his original code. I doubt I'll be maintaining this release much. I don't see any major changes for it in the future. I've got several other things to concentrate on >_<

Hope it's useful for somebody out there :) If not in an actual program, perhaps as code examples. There's possibly a few interesting things in there ^_^

Posted: Fri May 12, 2006 4:41 am
by J. Baker
Unable to download. I'll try again later. :wink:

Posted: Fri May 12, 2006 9:43 am
by inc.
NICE!
This will only currently load wav files.
Im already looking for someone with bigger programming skills like me who wants to participate making LibAVcodec accessable in Purebsic.

Because ... this would make your and other audio apps. capable importing almost all known video and audio formats. Libavcodec handles almost all known containers (avi, mkv, mp4) and streamtypes ( wav(8,16,20,32 bit ), ac3, mp2, aac, ogg etc).
So with a wrapper via PB internally LibAVcodec uses the (in this case audio) stream and decodes it to the wanted PCM waveform type. Even if the source is 5.1 Libavcodec is capable decoding it to PCM keeping its discrete 6 channels. That PCM Data could be handled as common like in your code.

http://www.purebasic.fr/english/viewtop ... libavcodec
!!! http://mplayerhq.hu/~michael/ffmpeg-dox ... ource.html !!!
http://mplayerhq.hu/~michael/ffmpeg-dox ... ource.html

Posted: Fri May 12, 2006 4:11 pm
by KarLKoX
Excellent :!:
Especially the formula resolver :)

Posted: Sun May 14, 2006 1:25 am
by Xombie
Thanks :) You have sharp eyes, KarlKoX. I didn't think anyone would notice that very much. I don't think it's very useful at the moment. Perhaps with more functions added to my expression evaluator it might become useful. Of course, I don't know much about audio stuff and effects so I don't know ^_^

@inc. - I was planning on trying that out. I can't promise anything soon but I think within a few weeks I'll start working on making the libAVcodec useable from PB. I need the video part for another project so... >_>

:D

Posted: Sun May 14, 2006 2:59 am
by inc.
Im also still on aproject to be finished.

After that (I think it matches your mentioned time) I'd apreciate to participate.
Im thinking about writing a Wrapper for accessing C Code or to translate all that needed stuff, means all structures to PB etc.
Libavcodec would give a BOMB capability to audio/video appl. programmers. And its LGPL :)