Csound Csound-dev Csound-tekno Search About

[Csnd] My brain is on holiday..

Date2008-06-23 17:53
Fromjpff
Subject[Csnd] My brain is on holiday..
I want an instrument that can play a section from a soundfile starting
at an arbitrary point (as a parameter) for some time.  At present I
am using diskin2 which is clearly stupid as i am reading the same two
files hundreds of times.  There must be a simpler way!  I tried to use
table but I could not work out how to do it.  There is no sr change
and no interpolation needed, but I am out of ideas.  There must be a
simpler way than me writing a new opcode in C.
  Please help a tired mind.  I get so little time to compose and this
is really holding me up!
==John ffitch

Date2008-06-23 19:14
FromJulian Peterson
Subject[Csnd] Re: My brain is on holiday..
Perhaps I am misunderstanding the question, but if you have loaded the  
soundfile as a table, then reading an arbitrary segment out of the  
table would be fairly straightforward:

instr 1
	; p3 = duration, in seconds
	; p4 = starting point in file, in seconds
	; p5 = transposition, where 1 is normal, 2 is one octave higher, etc.
	; p6 = table N
	adur line p4,p3,p4+(p3*p5) ; gives position in seconds
	adur = adur*sr ; convert to samples
	asnd table adur,p6,0 ; read from table
	...




On Jun 23, 2008, at 9:53 AM, jpff wrote:

> I want an instrument that can play a section from a soundfile starting
> at an arbitrary point (as a parameter) for some time.  At present I
> am using diskin2 which is clearly stupid as i am reading the same two
> files hundreds of times.  There must be a simpler way!  I tried to use
> table but I could not work out how to do it.  There is no sr change
> and no interpolation needed, but I am out of ideas.  There must be a
> simpler way than me writing a new opcode in C.
>  Please help a tired mind.  I get so little time to compose and this
> is really holding me up!
> ==John ffitch
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"


Date2008-06-23 19:59
Frompeiman khosravi
Subject[Csnd] Re: My brain is on holiday..
How about using tablexkt? The manual example is working for me. I'm actually using tablexkt and tablexkt for the same reason, maybe there is a better way (anyone!?).

I set ilpsilpe and imode (of lphasor) to zero to turn off looping, and use istrt to indicate starting point of the playback. Bellow is my modification of the manual example.  

Best
Peiman


<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
; Audio out   Audio in
-odac           -iadc     ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o tablexkt.wav -W ;;; for file output any platform
</CsOptions>

<CsInstruments>
;Example by Jonathan Murphy

  sr    =  44100
  ksmps    =  10
  nchnls    =  1

 instr 1

  iskip     =  1 ; skip in seconds
  ipitch    = 1 ; transposition factor

  ifn         =  1    ; query f1 as to number of samples
  ilen    =  nsamp(ifn)
 
  itrns    =  ipitch   ; transpose up 4 octaves
  ilps    =  0  ; loop start
  ilpe    =  0  ; loop end
  imode    =  0  ; looping off
  istrt    =  iskip*sr  ; start position 

  alphs    lphasor   itrns, ilps, ilpe, imode, istrt
; use lphasor as index
  andx    =  alphs

  kfn    =  1   ; read f1
  kwarp    =  ipitch ; anti-aliasing, should be same value as itrns above
  iwsize    =  32  ; iwsize must be at least 8 * kwarp

  atab    tablexkt  andx, kfn, kwarp, iwsize
  atab    =  atab * 10000

   out      atab

    endin


</CsInstruments>

<CsScore>
f 1 0 262144 1 "beats.wav" 0 4 1
i1 0 4
e
</CsScore>

</CsoundSynthesizer>    



On 23 Jun 2008, at 17:53, jpff wrote:

I want an instrument that can play a section from a soundfile starting
at an arbitrary point (as a parameter) for some time.  At present I
am using diskin2 which is clearly stupid as i am reading the same two
files hundreds of times.  There must be a simpler way!  I tried to use
table but I could not work out how to do it.  There is no sr change
and no interpolation needed, but I am out of ideas.  There must be a
simpler way than me writing a new opcode in C.
  Please help a tired mind.  I get so little time to compose and this
is really holding me up!
==John ffitch


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2008-06-26 21:22
FromLou Cohen
Subject[Csnd] Re: My brain is on holiday..
Re: [Csnd] My brain is on holiday.. How about GEN01 to put the file into a table.

Then use OSCIL or a variant, choosing the correct amp and cps by trial and error. To start the file at specific place, use iphs (phase.) I guess you could stop playing by limiting play to a certain amount of time.

Since iphs has to be an init value, you can use my favorite trick: calculate the desired value for iphs (it will be a k-value), then invoke an instrument, using “event” and pass the k-valued phase to the instrument as a parameter, thus transforming it into an i-value.

I hope this helps. It would be the first time I’ve ever been able to return the favor!

-Lou Cohen


On 6/23/08 12:53, "    jpff" <jpff@cs.bath.ac.uk> wrote:

I want an instrument that can play a section from a soundfile starting
at an arbitrary point (as a parameter) for some time.  At present I
am using diskin2 which is clearly stupid as i am reading the same two
files hundreds of times.  There must be a simpler way!  I tried to use
table but I could not work out how to do it.  There is no sr change
and no interpolation needed, but I am out of ideas.  There must be a
simpler way than me writing a new opcode in C.
  Please help a tired mind.  I get so little time to compose and this
is really holding me up!
==John ffitch


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


---------------------------
Permanent email:           loucohen@jolc.net
Music and video:            http://ruccas.org/wiki.pl/Lou_Cohen
More music and video:   http://www.youtube.com/loucohen
Astronomy:                    http://www.jolc.net
Open Sound:                 http://www.opensound.org
QFD:              
http://www.pearsonhighered.com/educator/academic/product/0,3110,0201633302,00.html
----------------------------