filesr
Prev | Orchestra Opcodes and Operators | Next

## filesr

filesr — Returns the sample rate of a sound file.

## Description

Returns the sample rate of a sound file.

## Syntax

    ir filesr ifilcod

## Initialization

ifilcod -- sound file to be queried

## Performance

filesr returns the sample rate of the sound file ifilcod.

## Examples

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

Example 126. Example of the filesr opcode.

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

    ; Instrument #1.
    instr 1
      ; Print out the sampling rate of the
      ; audio file "mary.wav".
      isr filesr "mary.wav"
      print isr
    endin
    /* filesr.orc */

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

The audio file “mary.wav” was sampled at 44.1 KHz. So filesr's output should include a line like this:

    instr 1:  isr = 44100.000

## See Also

filelen, filenchnls, filepeak

## Credits

Author: Matt Ingalls
July 1999

Example written by Kevin Conder.

New in Csound version 3.57

Prev | Up | Next
filepeak | Home | filter2