Csound Csound-dev Csound-tekno Search About

table and phasor

Date1999-07-21 15:08
FromDaniel Nass
Subjecttable and phasor
Hello CSounders...

I have a question about GEN 01.  I think I finally have a good handle on
how table and phasor works (I think) so I am using this simple orc and sco
just to read through a sound file.  I want to make sure I have this much
down before I start trying to get fancy with other things.  

Here's my problem.  I would expect that the following orc and sco would
simply play back the file called in by GEN01 at normal speed, and play it
only once.  Instead, it plays it back faster than normal and it also puts a
huge clip at the end of the soundfile.  Is there something I'm not
understanding here?

Thanks for you help...

Dan

;orchestra
instr 1
kenv	linen	20000, .01, p3, .01
aph	phasor	1/p3
a1	table	aph, 1, 1
a1	=	a1    *   kenv
out 	a1

endin

;score
f1	0	131072	1	6	0	4	1

;i#	st	dur(sf duration is 2.136)
i1	0	2.136					

*************************************************************
     
Daniel Nass		http://cctr.umkc.edu/~dnass/
     
"Wherever we are, what we hear is mostly noise. 
When we ignore it, it disturbs us. When we listen 
to it, we find it fascinating." 
     
                                            John Cage (1961)
     

Date1999-07-21 17:05
From"Matt J. Ingalls"
SubjectRe: table and phasor
> only once.  Instead, it plays it back faster than normal and it also puts a
> huge clip at the end of the soundfile.  Is there something I'm not
> aph	phasor	1/p3
> a1	table	aph, 1, 1

> f1	0	131072	1	6	0	4	1
> i1	0	2.136					

you didnt specify what your sample rate of your orch or soundfile is, but
i am assuming its the same.  if you want to play the entire file your
table size must be greater than the # of sample frames in the sound file
(2.136*sr).  what i usually do is store the actual length of the sound
file
in a look-up table, multiply that value with the phasor output, then use
"raw" index mode of the table:

ilenlookup = 50
isndfile = p4

ilen table isndfile-1, ilenlookup
aph   phasor  1/p3
a1    table   ilen*aph, isndfile, 0

f1    0       131072  1       6       0       4       1
;f2... other sound files here....
;f3
;etc..
f50    0       8      -2       88200 ; other "real" lens here

i1    0       2      1


-matt

Date1999-07-22 04:40
FromDaniel Nass
SubjectRe: table and phasor
Thanks for you reply, Matt.  Unfortunately, I'm still a little thick-headed.

I am making sure the table size is greater than that of the file  (there
are 106752 samples in the file, so my table size should be 131072, right?).
 The only way I seem to be able to avoid this problem is to add silence so
that the length of the file is EXACTLY 131072 samples in the file, even if
the last 25000 or so are only silence.  It also seems that it puts the huge
clip at the exact point the original soundfile ends.  

Let me try to explain better.  My original file that I'm calling in with
GEN01 is 106752 samples long.  The resultant file, after using table and
GEN 01 to call in the file is 131072 samples long with a huge SNAP at
106752.  This happens with just about any sample I try and use, unless the
sample's length is close to a power of 2.  Sorry if this doesn't make sense
but let me know if you have any other advice.

Thanks again,

Dan


P.S.  Here is the orc and sco that I'm using:

;ORCHESTRA
sr=44100
kr=4410
ksmps=10
nchnls=1

instr 1
kenv	linen	20000, .01, p3, .01
aph	phasor	1/p3
a1	table	aph, 1, 1
a1	=	a1    *   kenv
out 	a1

endin



;SCORE
f1	0	131072	   1	5	0	4	1

i1	0	2.972					

*************************************************************
     
Daniel Nass		http://cctr.umkc.edu/~dnass/
     
"Wherever we are, what we hear is mostly noise. 
When we ignore it, it disturbs us. When we listen 
to it, we find it fascinating." 
     
                                            John Cage (1961)
     

Date1999-07-22 18:14
From"Matt J. Ingalls"
SubjectRe: table and phasor
Daniel,

> I am making sure the table size is greater than that of the file  (there
> are 106752 samples in the file, so my table size should be 131072, right?).

	just to make sure: that's 2.42 seconds, not 2.9 as your score p3.

> GEN 01 to call in the file is 131072 samples long with a huge SNAP at
> 106752.  This happens with just about any sample I try and use, unless the

	i still think you need to use "raw" index mode for your table.
what is happening is you are using "normalized" so you get to the end of
the table(not the file!) by time p3, which is when your envelope is
decaying - i think what you want is the envelope to be sync'd with the
file, right?

see if changing your table statement to:
	a1    table   106752*aph, 1, 0
and your p3 time to:
	2.42
and see if that works.
-matt

 > > ;ORCHESTRA
> sr=44100
> kr=4410
> ksmps=10
> nchnls=1
> 
> instr 1
> kenv	linen	20000, .01, p3, .01
> aph	phasor	1/p3
> a1	table	aph, 1, 1
> a1	=	a1    *   kenv
> out 	a1
> 
> endin
> 
> 
> 
> ;SCORE
> f1	0	131072	   1	5	0	4	1
> 
> i1	0	2.972					
> 
> *************************************************************
>      
> Daniel Nass		http://cctr.umkc.edu/~dnass/
>      
> "Wherever we are, what we hear is mostly noise. 
> When we ignore it, it disturbs us. When we listen 
> to it, we find it fascinating." 
>      
>                                             John Cage (1961)
>      
> *************************************************************
>