| Stan Olejarz wrote:
>
> Just a quick question from a rookie Csounder.How do you calculate the file
> size?
use sndinfo, a great utility that comes with csound.
For instance:
[pw@slink drums]$ sndinfo church_spirit_kick.wav
church_spirit_kick.wav: WAVE, 15082 samples
WAVE soundfile
srate 44100, monaural, 16 bit shorts, 0.34 seconds
headersiz 44, datasiz 30164 (15082 sample frames)
If you insist on doing it by hand... let's see if I can do it right:
file size in bytes = (length in seconds * sampling rate) * (bits / 8) *
(number of channels)
e.g. for a 5-second, 16-bit, 44.1kHz, 2-channel file, you get:
5 * 44100 * (16/8) *2 = 882000 bytes.
But I think you really want to know the number of samples. That's just
this:
length in seconds * sampling rate
e.g. 5 * 44100 = 220500 samples.
---------------- paul winkler ------------------
slinkP arts: music, sound, illustration, design, etc.
zarmzarm@hotmail.com --or-- slinkp AT ulster DOT net
http://www.ulster.net/~abigoo/ |