fin
Prev | Deprecated Orchestra Opcodes and GEN Routines | Next

## fin

fin — Read signals from a file at a-rate.

## Description

Read signals from a file at a-rate.

## Syntax

    fin ifilename, iskipframes, iformat, ain1 [, ain2] [, ain3] [,...]

    fin ifilename, iskipframes, iformat, arr[]

## Initialization

ifilename -- input file name (can be a string or a handle number generated by fiopen).

iskipframes -- number of frames to skip at the start (every frame contains a sample of each channel)

iformat -- a number specifying the input file format for headerless files.

- -2 - 32 bit floating points without header

- -1 - 16 bit integers without header

- 0 - take values from the header

## Performance

fin (file input) is the complement of fout: it reads a multichannel file to generate audio rate signals. The user must be sure that the number of channels of the input file is the same as the number of ainX arguments.

| Note
Please note that since this opcode generates its output using input parameters (on the right side of the opcode), these variables must be initialized before use, otherwise a 'used before defined' error will occur. You can use the init opcode for this.

## Examples

Here is an example of the fin opcode. It uses the file fin.csd and fox.wav.

Example 1336. Example of the fin opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>
    <CsOptions>
    ; Select audio/midi flags here according to platform
    -odac     ;;;realtime audio out
    ;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
    ; For Non-realtime ouput leave only the line below:
    ; -o fin.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    sr = 44100
    ksmps = 32
    nchnls = 2
    0dbfs  = 1

    instr 1

    asnd init 0 			;input of fin must be initialized
         fin  "fox.wav", 0, 0, asnd	;read audiofile
    aenv follow asnd, 0.01		;envelope follower
    kenv downsamp aenv
    asig rand kenv			;gate the noise with audiofile
         outs asig, asig
    endin

    </CsInstruments>
    <CsScore>

    i 1 0 3
    e

    </CsScore>
    </CsoundSynthesizer>

## See also

File Input and Output

## Credits

Author: Gabriel Maldonado
Italy
1999
Author: John ffitch
NUIM, 2013

New in Csound version 3.56

Array version new in 6.01

Meaning of format parameter changed in 6.15

Prev | Up | Next
clock | Home | hrtfer