filelen — Retourne la longueur d'un fichier son.
ifilcod -- fichier son à interroger
iallowraw -- (facultatif) permet des fichiers son bruts (vaut 1 par défaut)
filelen retourne la longueur du fichier son ifilcod en secondes. filelen peut retourner la longueur des fichiers de type convolve et PVOC si le paramètre iallowraw est différent de zéro (il est non nul par défaut).
Voici un exemple de l'opcode filelen. Il utilise les fichiers filelen.csd et mary.wav.
Exemple 152. Exemple de l'opcode filelen.
Voir les sections Audio en Temps Réel et Options de la Ligne de Commande pour plus d'information sur l'utilisation des options de la ligne de commande.
<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 filelen.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 length of the audio file ; "mary.wav" in seconds. ilen filelen "mary.wav" print ilen endin </CsInstruments> <CsScore> ; Play Instrument #1 for 1 second. i 1 0 1 e </CsScore> </CsoundSynthesizer>
Le fichier audio « mary.wav » dure 3.5 secondes. Ainsi la sortie
de filelen contiendra une ligne comme :
instr 1: ilen = 3.501