Csound Csound-dev Csound-tekno Search About

Re: determining sound file length

Date1999-01-14 09:09
FromGabriel Maldonado
SubjectRe: determining sound file length
In DirectCsound there is ftlen2(x) and nsamp(x) function which returns the samples
effectively loaded from a wavefile. This can be useful to set parameters for loop points
with loscil (or my loscil2). Another soultion is to use diskin opcode, which can play a
soundfile looping start to end.

I hope this will help you

Gabriel

Peter M. Traub wrote:
> 
> Hi all,
> 
> I'm looking for a way to determine the length of random soundfiles for loop points for loscil. I'm creating a web based piece that uses Perl to search for and download whatever soundfiles it can find on the web. The soundfiles will all be converted to .aiff w/Sox once downloaded. From there, Csound will generate a new piece every 10 minutes or so using the most recently downloaded soundfiles. I would just like the files to loop through their full length. Since the whole piece will eventually be automated, it needs some way of dynamically finding out the soundfile length or number of sample frames, so that Perl can write in the correct loop points for loscil. Since most of the files it downloads will be in different formats and will probably not have loop points, I need some way to work around this. Can sndinfo be used within an orchestra to return a particular value to an i-rate variable (in this case the number of sample frames)? Are there any other ways to work around this!
? My
> other option is to run sndinfo seperately and parse the output w/Perl to get the number of sample frames, but this seems like a bigger hassle than it should be. Many thanks in advance.
> 
> Peter Traub
> 
> ptraub@dartmouth.edu

-- 
Gabriel Maldonado

http://www.agora.stm.it/G.Maldonado/home2.htm