Csound Csound-dev Csound-tekno Search About

[Csnd] tablew question

Date2011-09-11 17:48
Fromebmtranceboy
Subject[Csnd] tablew question
Hi everyone,
I don't know what is the main reason why instr 2 doesn't sound like instr 1
in 



-d -odac 


sr        =         44100
kr        =         44100
nchnls    =         1
0dbfs     =         1

instr 1
  ilen =        2048
  ifn  ftgentmp 0,0,ilen,10,1
  icps =        cpspch(p4)

  aenv expsega 1,7,0.0001
  aph  phasor icps
  aval tablei aph*ilen, ifn

  asig = aenv*aval
  out asig
endin

instr 2
  ilen =        2048
  ifn  ftgentmp 0,0,ilen,10,1
  icps =        cpspch(p4)

  aph  phasor icps
  asig tablei aph*ilen, ifn
       tablew asig*0.95,aph*ilen,ifn

  out asig
endin




f2 0 2048 10 1

i1 0 4 8.00
i1 4 4 8.07

i2 8  4 8.00
i2 12 4 8.07
 



It seems like a numerical effect but maybe I'm misusing tablew too. Is there
a way to get instrument 2 working as I wish (I mean sounding like instrument
1 but using tablew) ?
Thanks

--
View this message in context: http://csound.1045644.n5.nabble.com/tablew-question-tp4791875p4791875.html
Sent from the Csound - General mailing list archive at Nabble.com.


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"

Date2011-09-14 17:11
Fromebmtranceboy
Subject[Csnd] Re: tablew question
So far, I have this solution

instr 2
  icps =        cpspch(p4)
  iend =        int(sr/icps)
  ilen =        powoftwo (ceil(logbtwo(iend)))
  ifn  ftgentmp 0, 0, ilen, 7,0
  
  idx init 0
filltab:
      tableiw sin(2*$M_PI*idx/iend),idx,ifn
  idx =       idx+1
  if (idx<ilen) goto filltab

  kndx init   0
  andx =      kndx
  asig table  andx,ifn
       tablew asig*0.995,andx,ifn
  kndx = kndx+1
  if (kndx>=iend) then
     kndx=0
  endif

  out asig
endin

where I had to 
1) get rid of phasor which seemed to be the problem (interpolation ?) and
replace it with a variable length mecanism
2) recompute the initial sine table because of the frequency dependance of
the table length

I wish I can find a shorter solution (with suited opcodes)...


--
View this message in context: http://csound.1045644.n5.nabble.com/tablew-question-tp4791875p4803392.html
Sent from the Csound - General mailing list archive at Nabble.com.


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"