[Csnd] fout - close the file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] fout - close the file

Roger Kelly-2
Is there a way to get fout to close the file before the end of the  score run?

I want to close fout and then reopen it with an ftgen.

basically this is the area of code:


if ktotaltick < isampletime then

   fout "/Users/A727200/proj/mbox/mbox/track3.wav", 14, ainl,ainr

   outs ainl,ainr

else

   ; NEED TO CLOSE THE FILE HERE!

   Sfile = "/Users/A727200/proj/mbox/mbox/track2.wav"

    

   ilen filelen Sfile ; Find length

   isr filesr Sfile ; Find sample rate


   isamps = ilen * isr*2 ; Total number of samples


    printks "samples %f\n", .1,isamps

    itab ftgen 8, 0, isamps, 1,"/Users/A727200/proj/mbox/mbox/track3.wav", 0, 0, 0

    printks "playback",.1

    al, ar loscil 1, 1, 8, 1

     outs al,ar


endif


Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] fout - close the file

Victor Lazzarini-2
stopping the instrument should close the file.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 6 Sep 2017, at 21:11, Roger Kelly <[hidden email]> wrote:

Is there a way to get fout to close the file before the end of the  score run?

I want to close fout and then reopen it with an ftgen.

basically this is the area of code:


if ktotaltick < isampletime then

   fout "/Users/A727200/proj/mbox/mbox/track3.wav", 14, ainl,ainr

   outs ainl,ainr

else

   ; NEED TO CLOSE THE FILE HERE!

   Sfile = "/Users/A727200/proj/mbox/mbox/track2.wav"

    

   ilen filelen Sfile ; Find length

   isr filesr Sfile ; Find sample rate


   isamps = ilen * isr*2 ; Total number of samples


    printks "samples %f\n", .1,isamps

    itab ftgen 8, 0, isamps, 1,"/Users/A727200/proj/mbox/mbox/track3.wav", 0, 0, 0

    printks "playback",.1

    al, ar loscil 1, 1, 8, 1

     outs al,ar


endif


Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] fout - close the file

Roger Kelly-2
Gave it a try.  Just what I needed!! Thanks

On Wed, Sep 6, 2017 at 3:17 PM, Victor Lazzarini <[hidden email]> wrote:
stopping the instrument should close the file.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 6 Sep 2017, at 21:11, Roger Kelly <[hidden email]> wrote:

Is there a way to get fout to close the file before the end of the  score run?

I want to close fout and then reopen it with an ftgen.

basically this is the area of code:


if ktotaltick < isampletime then

   fout "/Users/A727200/proj/mbox/mbox/track3.wav", 14, ainl,ainr

   outs ainl,ainr

else

   ; NEED TO CLOSE THE FILE HERE!

   Sfile = "/Users/A727200/proj/mbox/mbox/track2.wav"

    

   ilen filelen Sfile ; Find length

   isr filesr Sfile ; Find sample rate


   isamps = ilen * isr*2 ; Total number of samples


    printks "samples %f\n", .1,isamps

    itab ftgen 8, 0, isamps, 1,"/Users/A727200/proj/mbox/mbox/track3.wav", 0, 0, 0

    printks "playback",.1

    al, ar loscil 1, 1, 8, 1

     outs al,ar


endif


Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here