[Csnd] Triggering random cross-fades between segments of two files
Date | 2012-04-24 08:02 |
From | Alex Weiss |
Subject | [Csnd] Triggering random cross-fades between segments of two files |
Hi list I'm having some difficulties implementing an idea in csound. Here's what I want to do: play one sound file, and at random intervals switch over to a different sound file with constant-power crossfades between the two. My plan was to have two instruments, each playing one sound file, and a third master instrument that controls the amplitudes of the other two instruments. But I'm not sure how to trigger the cross-fades. Any idea?
Thanks, Alex
|
Date | 2012-04-24 10:18 |
From | Tarmo Johannes |
Subject | Re: [Csnd] Triggering random cross-fades between segments of two files |
hello, I am not sure if it works but perhaps you could use two global k-variables for the amplitudes and call another instrument for the crossfade from your master instrument ( it is necessary to control what is the state of gkAmp1 in the current moment, it is the i-time of the isntr crossfade): gkAmp1 init 1 gkAmp2 init 0 #define FADETIME #3# ; 3 seconds for crossfade? instr master ;... if (ktrigger==1) then event "i","crossfade",0,$FADETIME endif endin instr crossfade if ( i(gkAmp) == 0) then gkAmp1 line 0, p3 1 ; fade in else gkAmp1 line 1, p3, 0 ; fade out gkAmp2=1-gkAmp1 ; amp2 is the opposite endin and use the gkAmps in the playing isntrument I did not try it myself and I am sure there are more elegant ways to do it but this is one ide. greetings, tarmo On Tuesday 24 April 2012 00:02:03 Alex Weiss wrote: > Hi list > > I'm having some difficulties implementing an idea in csound. Here's what I > want to do: play one sound file, and at random intervals switch over to a > different sound file with constant-power crossfades between the two. My > plan was to have two instruments, each playing one sound file, and a third > master instrument that controls the amplitudes of the other two > instruments. But I'm not sure how to trigger the cross-fades. Any idea? > > Thanks, > Alex > > Send bugs reports to the Sourceforge bug tracker > https://sourceforge.net/tracker/?group_id=81968&atid=564599 > Discussions of bugs and features can be posted here > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe > csound" |
Date | 2012-04-24 10:22 |
From | Rory Walsh |
Subject | Re: [Csnd] Triggering random cross-fades between segments of two files |
I was thinking that you could trigger two instruments with event that would control the amplitude of the two sound files by means of global variables. If you use the 'r' family of of envelopes you could also have a fade out as well as fade in when you turn them on and off. Sorry, I'm about to start work and don't ave time to explain what I mean in code! Good luck! On 24 April 2012 02:18, Tarmo Johannes |