|
ECS-L Home Automation and Security Archives |
learn more
| view messages for this
month | NetBloc® | terms of use | search
subject (prev) or (next) |
time (prev) or (next) |
author (prev) or (next) |
view more subjects
Subject: From: Date: | Re: [ECS] Low modem Record level Dario Greggio Sun, 04 Jun 2000 11:25:29 +0200 |
Mark Gilmore wrote:
>
> A while back, I spent a lot of time searching for
> a utility pgm that would add gain to an existing
> .WAV, but I could never find one that did NOT
> require some user-interaction.
> Perhaps one of you could give it a try.
> If we can find one, I can have ECS execute
> automatically after recording phone messages.
Hi Mark, I know you don't like such things written in C, but I'm sending
it anyway... :-))
This function takes a bunch of samples (8 bit, mono) "s", whose length
is "l", and gives you back in a buffer called "d" the samples amplified
or reduced by "level" (percentage). In fact, level=100 does nothing.
If you need to start from a WAV file rather than the raw samples, you
should open the file, move to position following "data" plus 4 bytes
(I'm attaching a hex dump of a WAV file from my telephone system) and
from there to EOF execute my function or equivalent.
BYTE *volWaves(BYTE *s,BYTE *d,DWORD l,int level) {
register int ch;
if(level==100)
return d;
if(!d)
d=s;
while(l--) {
ch=*s;
if(ch>=0x80)
ch=(((ch-0x80)*level)/100)+0x80;
else
ch=0x80-(((0x80-ch)*level)/100);
*d=ch;
s++;
d++;
}
return d;
}
Hope it helps!
--
Ciao,
Dario
--
ADPM Synthesis sas - Torino
--
http://www.geocities.com/adpm99
subject (prev) or (next) |
time (prev) or (next) |
author (prev) or (next) |
view more subjects