Csound Csound-dev Csound-tekno Search About

[Csnd] Csound for mixing files of unknown length

Date2008-09-11 20:25
FromJonas Nyström
Subject[Csnd] Csound for mixing files of unknown length
AttachmentsNone  None  

Date2008-09-11 21:57
Fromjoachim heintz
Subject[Csnd] Re: Csound for mixing files of unknown length
Hi Jonas -

you can do something like

Sfile	=	p6
ilen		filelen	Sfile
p3		=	ilen

Then you can write in the score for p3 anything (e.g. 1) and it  
should be exactly the length of your file (if you declare ksmps=1  
what you already did).

Hope this works -

	joachim



Am 11.09.2008 um 21:25 schrieb Jonas Nyström:

> Hi!
>
> I use the following csd for mixing wav files.
> The third parameter to the instrument (P3) represents the length of  
> the the current file.
> What if I don't know the length of the files?
> In this case I work with files of same length, and I just want to  
> mix them together...
>
> Regards / Jonas
>
> - - -
>
> ;
>
>   
>     csound -W -o test.wav
>   
>
>   
>
>     sr = 44100
>     kr = 44100
>     ksmps = 1
>     nchnls = 2
>
>     ; ***************************************************
>     ; Instrument 1
>     ; ***************************************************
>     ; p2 = start position
>     ; p3 = duration
>     ; p4 = volume
>     ; p5 = pan
>     ; p6 = filename
>     ;
>     instr 1
>        ivol = p4
>        ipan = p5 * 1.570796327
>        aleft, aright diskin p6, 1
>        aleft = aleft * ivol * cos(ipan)
>        aright = aright * ivol * sin(ipan)
>        outs aleft, aright
>     endin
>
>
>   
>
>   
>
>      ; PARAMETERS:
>      ; instrument, start position, length, volume, pan, file name
>
>      i1 0 10 1 0 "beats.wav"
>      i1 0 10 1 1 "mary.wav"
>
>   
>
> 
>
>