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 [, iallowraw]

Initialization

ifilcod -- sound file to be queried

iallowraw -- (Optional) Allow raw sound files (default=1)

Performance

filenchnls returns the number of channels in the sound file ifilcod. filechnls can return the number of channels of convolve and PVOC files if the iallowraw flag is not zero (it is non-zero by default).

Examples

Here is an example of the filenchnls opcode. It uses the file filenchnls.csd, and mary.wav.

Example 137. Example of the filenchnls 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
; Audio out   Audio in
-odac           -iadc    ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o filenchnls.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

; 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


</CsInstruments>
<CsScore>

; Play Instrument #1 for 1 second.
i 1 0 1
e


</CsScore>
</CsoundSynthesizer>


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