The Alternative Csound Reference Manual
Previous |  | Next

# filenchnls

filenchnls -- Returns the number of channels in a sound file.

## Description

Returns the number of channels in a sound file.

## Syntax

ir filenchnls ifilcod

## Initialization

ifilcod -- sound file to be queried

## Performance

filenchnls returns the number of channels in the sound file ifilcod.

## Examples

Here is an example of the filenchnls opcode. It uses the files filenchnls.orc, filenchnls.sco, and mary.wav.

Example 1. Example of the filenchnls opcode.

    /* filenchnls.orc */
    ; Initialize the global variables.
    sr = 44100
    kr = 4410
    ksmps = 10
    nchnls = 1

    ; Instrument #1.
    instr 1
      ; Print out the number of channels in the
      ; audio file "mary.wav".
      ichnls filenchnls "mary.wav"
      print ichnls
    endin
    /* filenchnls.orc */

    /* filenchnls.sco */
    ; Play Instrument #1 for 1 second.
    i 1 0 1
    e
    /* filenchnls.sco */

The audio file "mary.wav" is monoaural (1 channel). So filenchnls's output should include a line like this:

    instr 1:  ichnls = 1.000

## See Also

filelen, filepeak, filesr

## Credits

Author: Matt Ingalls
July 1999

Example written by Kevin Conder.

New in Csound version 3.57

Previous | Home | Next
filelen | Up | filepeak