Csound Csound-dev Csound-tekno Search About

[CSOUND-DEV:4475] Re: Thoughts of fout and friends

Date2004-04-12 10:24
FromGabriel Maldonado
Subject[CSOUND-DEV:4475] Re: Thoughts of fout and friends
John,

jpff@codemist.co.uk wrote:
> 
> fouti/foutir is fundamentally flawed.  It allows one to open a file
> with a number, which has previously been opened without knowing the
> number of channels or the audio format.  This just does not fit the
> libsndfile idea, and is anyway dangerous.
> 
> I think I want to rebuild these opcodes in a major way.  If one uses
> fouti then the file must have been opened as an audio file with type,
> and we can check the format if necessary.  fiopen would have its
> second argument changed in meaning.

Have you clear the main purpose of fouti and foutir? They are not 
intended to output a signal, but to record a csound-compatible score to 
a text file. I think that it is meaningless to make fouti/foutir to 
output a .wav or .aif file. I post you the man page of these opcodes:

=================================================
fouti and foutir write i-rate values to a file. The main use of these 
opcodes is to generate a score file during a realtime session. For this 
purpose the user should set iformat to 0 (text file output) and iflag to 
1, which enable the output of a prefix consisting of the following 
strings:

i num  actiontime duration

before the values of iout1...ioutN arguments. Prefix is referring to 
instrument number, action time and duration of current note.

The difference between fouti and foutir is that,  in the case of fouti, 
when iflag is set to 1, the duration of the first opcode is undefined 
(so it is replaced by a dot ) wheras in the case of foutir is defined at 
the end of note, so the corresponding text line is written only at the 
end of the current note (in order to recognize its duration). The 
corresponding file is linked by the ihandle value generated by fiopen 
opcode (see below). So fouti and foutir can be used to generate a Csound 
score while playing  a realtime session.

fiopen  opens a file to be used by the foutX opcodes. It must be defined 
outside of any instruments, in the header section of the orchestra file. 
  It returns a number ihandle, which is univocally referring to the 
opened file.

Notice that fout and foutk can use both a string containing a file 
pathname or a handle-number generated by fiopen, wheras in the case of 
fouti and foutir, the target file can be only specified by means of a 
handle-number.
==========================================================================


-- 
Gabriel Maldonado
http://csounds.com/maldonado
--