Csound Csound-dev Csound-tekno Search About

macro and more

Date2006-05-16 19:13
FromLuís Antunes Pena
Subjectmacro and more
Istvan Varga schrieb:
>Try using the quotes in the orchestra, as shown below:
>a1, a2 diskin "$FILCOD", 1

Thank you! Of course! this solves the problem - as usual!

Another thing I would like to ask is:

1) if there is a way to make csound run only for the duration dependent on
the length of an audio file.

2) and to make the nchnls variable dependent on the same file as well.
Something like this (which doesn't work):

ginchnls = filelen $FILCOD
nchnls = ginchnls
instr 1
...

Any ideas?

Thank you in advance, AND thank you very much to all of you who dedicate
your time to answer all these questions and to develop csound!!! It's a
wonderful thing to put you knowledge at the service of the csound users
community!

Luis


-- 
Luís Antunes Pena
http://icem.folkwang-hochschule.de/~pena

Date2006-05-16 20:04
FromRory Walsh
SubjectRe: macro and more
> 1) if there is a way to make csound run only for the duration dependent on
> the length of an audio file.

The code below is passed a soundfile in the CsOptions and then plays the 
soundfile for as long as the sound is. I set up the second instrument to 
play for the length of the sound file using event_i. It's not the 
prettiest but it's the only way I could think of doing it! You can then 
use the filenchnls opcode and an if statement for the number of 
channels. This is the way I built the sound file player that comes with 
my Lettuce frontend.

Rory.




-odac -b10 --strset1=D:/soundfile.wav


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

instr 1
Sname strget 1
ilen  filelen Sname
event_i "i", 2, 0, ilen
endin

instr 2

Sname  strget  1
ksearch chnget "skip"
ktrig changed ksearch
reset:
iskip = i(ksearch);
print iskip
print iskip;
if(ktrig==0) then
goto contin
else
reinit reset
endif
contin:
         a1 soundin Sname, iskip
         out a1
         rireturn
endin




f1 0 4096 10 1
i1 0 100
e






Date2006-05-16 21:56
From"Matt J. Ingalls"
SubjectRe: macro and more
at least in csound4 you were able to use
-i for an input file

> 
> -odac -b10 -iD:/soundfile.wav
> 
> 

instr 1

ilen filelen "-i"
  ktime init 0
  ktime times
  if (ktime >= ilen) then
 	event "e", 0, 0 ; or turnoff
  endif

asig in
out asig

endin

you might just be able to do an
event "e", ilen

but i havent tried any of this

-m

On Tue, 16 May 2006, Rory Walsh wrote:

>> 1) if there is a way to make csound run only for the duration dependent on
>> the length of an audio file.
>
> The code below is passed a soundfile in the CsOptions and then plays the 
> soundfile for as long as the sound is. I set up the second instrument to play 
> for the length of the sound file using event_i. It's not the prettiest but 
> it's the only way I could think of doing it! You can then use the filenchnls 
> opcode and an if statement for the number of channels. This is the way I 
> built the sound file player that comes with my Lettuce frontend.
>
> Rory.
>
>
> 
> 
> -odac -b10 --strset1=D:/soundfile.wav
> 
> 
> sr = 44100
> kr = 4410
> ksmps = 10
> nchnls = 1
>
> instr 1
> Sname strget 1
> ilen  filelen Sname
> event_i "i", 2, 0, ilen
> endin
>
> instr 2
>
> Sname  strget  1
> ksearch chnget "skip"
> ktrig changed ksearch
> reset:
> iskip = i(ksearch);
> print iskip
> print iskip;
> if(ktrig==0) then
> goto contin
> else
> reinit reset
> endif
> contin:
>        a1 soundin Sname, iskip
>        out a1
>        rireturn
> endin
>
> 
>
> 
> f1 0 4096 10 1
> i1 0 100
> e
>
>
>
>
> 
> 
> -- 
> Send bugs reports to this list.
> To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>