Csound Csound-dev Csound-tekno Search About

Re: determining sound file length

Date1999-01-14 08:44
FromPedro Batista
SubjectRe: determining sound file length

>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

You can use gen01 with a size of 0, which deferres memory allocation; then 
in the orc you can use tableng/itableng to find out the samples' sizes.

Btw, a small parentesis: the table generated this way will be readable by 
loscil, but not by conventional ugens, like table. Why is that? shouldnt 
table (at least) work with non-power-of-2 tables? The solution is to 
allocate a power-of-two size that is biger than the sample length, but this 
forces one to know the sample length in advance. Or else read the table with 
loscil and then with tablewa write it to another (big) power-of-2 table 
which can then be read by any table access ugen.