Csound Csound-dev Csound-tekno Search About

Re: [Csnd] terminating at end of wav file

Date2012-12-25 00:49
Frompj@pjb.com.au
SubjectRe: [Csnd] terminating at end of wav file
Hi :-)    Victor Lazzarini wrote:
> I would suggest this:
> 1) don't use -i
> 2) Use the following CSD:
> ... 
> instr 1
> SFile = "rawfile.wav"
> idur filelen SFile
> p3 = idur
> a1, a2 diskin2 SFile, 1
> event_i "i", 100, 0, p3,0.5, 0.9
> ga1 = a1 + ga1
> ga2 = a2 + ga2
> endin
> ... 

That works well ... but is there a way to pass that filename in
from the command line ?  I mean, if the csd has to be rewritten
every time, I'd want to do that automatically in a wrapper-script;
in which case I might just as well use Csound Power's p268 csd,
and detect the file-length using e.g.
  my $length = `soxi -D '$wav_file'`;
and rewrite the "e 3600" line accordingly, then invoke csound.
That would work with both -i rawfile.wav and with -i adc.

I understand that ins needs to return 0,0 after EOF, but it
would be nice if there were _some_ way of testing for EOF.
E.g. there could be a reserved variable gkEOFtime that I could
test, and if it's set I could schedule an appropriate exit...

Is there a way for a csd to detect what -i is being used ?

Thanks for your help,
Peter Billam

http://www.pjb.com.au      pj@pjb.com.au     (03) 6278 9410
"Follow the charge, not the particle."  --  Richard Feynman
 from The Theory of Positrons, Physical Review, 1949


Date2012-12-25 09:31
Fromjoachim heintz
SubjectRe: [Csnd] terminating at end of wav file
hi peter -

as to this question:
"but is there a way to pass that filename in from the command line ?"

yes, you can set strset values in the command line, in the format
--strsetN=VALUE
so, for instance: --strset1='$wave_file.wav', and then just use '1' as 
input for diskin (or change back to a string via strget).

it might also be useful for you to work with the macro option:
--smacro:XXX=YYY
    Set score macro XXX to value YYY
as macros are executed first, it might be preferable in some cases.

	joachim

Am 25.12.2012 01:49, schrieb pj@pjb.com.au:
> Hi :-)    Victor Lazzarini wrote:
>> I would suggest this:
>> 1) don't use -i
>> 2) Use the following CSD:
>> ...
>> instr 1
>> SFile = "rawfile.wav"
>> idur filelen SFile
>> p3 = idur
>> a1, a2 diskin2 SFile, 1
>> event_i "i", 100, 0, p3,0.5, 0.9
>> ga1 = a1 + ga1
>> ga2 = a2 + ga2
>> endin
>> ...
>
> That works well ... but is there a way to pass that filename in
> from the command line ?  I mean, if the csd has to be rewritten
> every time, I'd want to do that automatically in a wrapper-script;
> in which case I might just as well use Csound Power's p268 csd,
> and detect the file-length using e.g.
>    my $length = `soxi -D '$wav_file'`;
> and rewrite the "e 3600" line accordingly, then invoke csound.
> That would work with both -i rawfile.wav and with -i adc.
>
> I understand that ins needs to return 0,0 after EOF, but it
> would be nice if there were _some_ way of testing for EOF.
> E.g. there could be a reserved variable gkEOFtime that I could
> test, and if it's set I could schedule an appropriate exit...
>
> Is there a way for a csd to detect what -i is being used ?
>
> Thanks for your help,
> Peter Billam
>
> http://www.pjb.com.au      pj@pjb.com.au     (03) 6278 9410
> "Follow the charge, not the particle."  --  Richard Feynman
>   from The Theory of Positrons, Physical Review, 1949
>
>
>
> 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"
>
>