Csound Csound-dev Csound-tekno Search About

Re: Audio file lengths

Date1999-07-09 20:09
FromRichard Dobson
SubjectRe: Audio file lengths
Of course the silly thing about this is that the information is already
there in the file header. An elegant solution would be to extend the
soundin and diskin opcodes to return a second value. Ideally this should
be optional - is such a thing feasible with the current Csound syntax?
Alternatively, 'sndinfo' could become an opcode.


Richard Dobson

> David Boothe wrote:
> 
> 1. Use a GEN01 table with power-of-two (+1 if you want), that you know
> is larger than the file. This will take some experimentation if you
> have no way of knowing that externally (such as Cool Edit or
> equivalent).
> 
> 2. Use nsamp to measure the length of the soundfile. nsamp should not
> count empty table points after the  end of the sound file.
> 
> 3. Divide the number returned by nsamp with the original sample rate
> of the file to get the original length.
> 
> -David.
> 
> > -----Original Message-----
> > From: richard bowers
> [mailto:richardbowers@simulacrum.freeserve.co.uk]
> > Sent: Friday, July 09, 1999 3:45 AM
> > To: csound csound
> > Subject: Audio file lengths
> >
> >
> > Can anyone offer me a solution to obtaining the duration (if
> > possible) or
> > file size of an audio file stored on disk from within a
> > instrument? I feel
> > it would be useful to know the duration of a file to make
> > better use of -
> > and prevent errors when using - the skiptime on the
> > soundin/diskin ugs.
> >
> > Thanks,
> > Richard Bowers.
> >

-- 
Test your DAW with my Soundcard Attrition Page!
http://wkweb5.cableinet.co.uk/rwd (LU: 6th July 1999)