Ben, I did figure it all, but only after I had the RIFF specs well in front of me... :) Thank you Duilio At 11.41 18/10/99 -0700, you wrote: >Duilio, > >Sure it can. If it's a simple PCM .WAV file, with no compression, then all >you have to do is figure out where the header ends. The rest is raw audio >data, and all you need to do is figure out whether it's hi or lo endian (in >the case of 16-bit data), and what the midpoint is. > >Cheers, >Ben > >----- Original Message ----- >From: Duilio Foschi >To: >Sent: Monday, October 18, 1999 11:17 AM >Subject: Re: [OT] WAV files > > >> Daniel, >> >> I tried that. >> >> I can assure you that the RIFF structure of a WAV file cannot be guessed >by >> a binary dump. >> >> You'd have a better chance with the state lottery :) >> >> Thank you >> >> Duilio >> >> At 20.23 18/10/99 +1300, you wrote: >> >Duilio, why don't you open a 16 bit *.wav for random binary input and >> examine the >> >data ? try a silent sample and then a low frequency sine wave, the >results >> should >> >be fairly apparent. >> > >> >regards, >> >Graham Daniel. >> > >> >Duilio Foschi wrote: >> > >> >> Brent, >> >> >> >> my files are sampled at 16 bits. >> >> >> >> How do this change things ? >> >> >> >> Also, when does the header exactly end and data start ? (I need to take >a >> >> regular WAV file for input and output a regular WAV file to be played >later). >> >> >> >> Thank you >> >> >> >> Duilio Foschi >> >> >> >> At 22.44 16/10/99 +1300, you wrote: >> >> >> I need to know how the sound information is stored in a WAV file and >how I >> >> >> can programmatically raise the volume of the sound in a WAV file. >> >> >> >> >> >> Any hint welcome >> >> >> >> >> >> Thank you >> >> >> >> >> >> Duilio Foschi >> >> >> >> >> > >> >> >Not so [OT] because you can do this on a PIC. Here's some ideas. >> >> > >> >> >Assuming a simple mono 8 bit per sample recording, there is a >> >> >about 20 bytes or so of header information at the start of the file >> >> >and then the audio samples are stored as 8 bit values. The data is >> >> >"biased" with a 7Fh DC offset so that silence is recorded as 7Fh. >> >> >Kind of like a single rail audio amplifier would be biased at half the >> >> >supply voltage. For simple play back from a micro with a PWM >> >> >output just send each byte to the PWM register sequentially at the >> >> >original sample rate. Put an RC filter on the output and >> >> >capacitively couple it to an audio amp. A little rough by hey - it >> >> >works! Even play back the header bytes, they go by so fast you >> >> >hardly hear a scratch. >> >> > >> >> >Back to the subject, to digitally amplify a .wav file you would need >> >> >to do something like this for each 8 bit sample: >> >> >- Remove the offset by subtracting 7Fh for data above 7Fh or >> >> >subtracting from 7Fh for data below 7Fh >> >> >- Multiply by your amplification factor >> >> >- Put the offset back in by adding 7Fh or subtracting from 7Fh as >> >> >necessary >> >> >- Store it or play it >> >> > >> >> >You are limited to what you can do in an 8 bit file before clipping. >> >> >Using 16 bit intermediate maths helps by letting you do stuff like >> >> >this: for 10% increase in volume, multiply by 11 then divide by 10. >> >> > >> >> >Brent Brown >> >> >Electronic Design Solutions >> >> >16 English Street >> >> >Hamilton, New Zealand >> >> >Ph/fax: +64 7 849 0069 >> >> >Mobile: 025 334 069 >> >> >eMail: brent.brown@clear.net.nz >> >> > >> > >