ex-ce-lent! Thank you David, work like a charm. And your explanation about the parameters (a, b). Very very useful
Thank you very much David! Regards Normando El 22/12/2010 05:44 a.m., David Baelde escribió: > Hi Normando, > > Sorry for the slight delay in replying, I needed to run a quick test > to make sure my proposition works. > > On Mon, Dec 20, 2010 at 5:56 PM, Normando Hall<[email protected]> wrote: >> def smart_crossfade (~start_next=5.,~fade_in=3.,~fade_out=3., >> ~default=(fun (a,b) -> sequence([a, b])), >> ~high=-15., ~medium=-32., ~margin=4., >> ~width=2.,~conservative=false,s) >> fade.out = fade.out(type="sin",duration=fade_out) >> fade.in = fade.in(type="sin",duration=fade_in) >> add = fun (a,b) -> add(normalize=false,[b, a]) >> log = log(label="smart_crossfade") >> >> def transition(a,b,ma,mb,sa,sb) > Here a and b are the volumes (float) ma and mb are the metadata and sa > and sb are the sources, before and after the track change. > >> list.iter(fun(x)-> log(level=4,"Before: #{x}"),ma) >> list.iter(fun(x)-> log(level=4,"After : #{x}"),mb) > Those past two lines can help to troubleshoot, raise the log level > (for example using --debug) to see them. > > Now the change will be at this point, we'll insert: > > if not (ma["source"]=="tangos" and mb["source"]=="tangos") then > log("Not crossing except between tangos.") > sequence([sa,sb]) # equivalently, default(sa,sb) > elsif # replaces the first if > >> # If A and B are not too loud and close, fully cross-fade them. >> a<= medium and b<= medium and abs(a - b)<= margin >> then >> log("Old<= medium, new<= medium and |old-new|<= margin.") >> log("Old and new source are not too loud and close.") >> log("Transition: crossed, fade-in, fade-out.") >> add(fade.out(sa),fade.in(sb)) >> >> elsif >> # If B is significantly louder than A, only fade-out A. >> # We don't want to fade almost silent things, ask for>medium. >> b>= a + margin and a>= medium and b<= high >> then >> ... # etc everything as before >> end > Enjoy! ------------------------------------------------------------------------------ Forrester recently released a report on the Return on Investment (ROI) of Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even within 7 months. Over 3 million businesses have gone Google with Google Apps: an online email calendar, and document program that's accessible from your browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew _______________________________________________ Savonet-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/savonet-users
