Csound Csound-dev Csound-tekno Search About

Newbee: Avoiding click when mixing fagments of wav files?

Date2007-08-05 21:52
FromJonas Nyström
SubjectNewbee: Avoiding click when mixing fagments of wav files?
AttachmentsNone  None  

Date2007-08-05 22:42
Fromluis jure
SubjectRe: Newbee: Avoiding click when mixing fagments of wav files?
El Sun, 5 Aug 2007 22:52:20 +0200
"Jonas Nyström"  escribió:


> Maybe implementing some kind of amplitude envelope?

exactly. try the linen envelope, with a short attack and decay. i guess
a few cents of a second should be enough to avoid the click, without
being noticeable. try different values, beginning with something like:

adeclick	linen	1, .05, p3, .05

and multiply at output. perhaps you could use ivol instead of 1 as
amplitude for the linen, to clear the code a bit

instr 60
   ivol = p4
   ipan = p5 * 1.570796327
   aleft, aright diskin "Grand/80/60.wav", 1
   ampenv  linen  ivol, .05, p3, .05
   aleft = aleft * ampenv * cos(ipan)
   aright = aright * ampenv * sin(ipan)
   outs aleft, aright
endin

Date2007-08-05 22:44
FromJacob Joaquin
SubjectRe: Newbee: Avoiding click when mixing fagments of wav files?
Yes, an amplitude envelope will work.  Try this:

instr 60
   idur = p3  ; duration of note
   ivol = p4
   ipan = p5 * 1.570796327
   aleft, aright diskin "Grand/80/60.wav", 1
   aenv linseg 0, 0.02, 1, idur - 0.04, 1, 0.02, 0  ; envelope
   aleft = aleft * ivol * cos(ipan) * aenv
   aright = aright * ivol * sin(ipan) * aenv
   outs aleft, aright
endin


I haven't tested this code, so hopefully there aren't any bugs.

Best,
Jake

---- 
The Csound Blog 
http://www.thumbuki.com/csound/blog  




Cambiata wrote:
> 
> Hi!
> 
> In my project I'm compiling a new wave file from fragments of source wav
> files.
> The problem is that this that using parts of source files sometimes causes
> audiable clicks (when cutting through an wave peak, i guess).
> 
> Is there a way to avoid this?
> Maybe implementing some kind of amplitude envelope?
> 
> This is a typical instrument from my ORC file:
> 
> instr 60
>    ivol = p4
>    ipan = p5 * 1.570796327
>    aleft, aright diskin "Grand/80/60.wav", 1
>    aleft = aleft * ivol * cos(ipan)
>    aright = aright * ivol * sin(ipan)
>    outs aleft, aright
> endin
> 
> This is how I use it now in the SCO file:
> 
> ;inst start length vol pan
> i60 0 1 1 0
> i62 2 2 1 1
> i64 4 4 .5 .5
> i65 6 1 .2 0
> 
> Ideas? Solutions?
> Thank you in advance!
> 
> Jonas
> 
> 

-- 
View this message in context: http://www.nabble.com/Newbee%3A-Avoiding-click-when-mixing-fagments-of-wav-files--tf4221174.html#a12008544
Sent from the Csound - General mailing list archive at Nabble.com.

Date2007-08-05 23:02
FromJonas Nyström
SubjectRe: Newbee: Avoiding click when mixing fagments of wav files?
AttachmentsNone  None