diskin

diskin --  Reads audio data from an external device or stream and can alter its pitch.

Description

Reads audio data from an external device or stream and can alter its pitch.

Syntax

ar1 [,ar2] [, ar3] [, ar4] diskin ifilcod, kpitch [, iskiptim] [, iwraparound] [, iformat]

Initialization

ifilcod -- integer or character-string denoting the source soundfile name. An integer denotes the file soundin.filcod ; a character-string (in double quotes, spaces permitted) gives the filename itself, optionally a full pathname. If not a full path, the named file is sought first in the current directory, then in that given by the environment variable SSDIR (if defined) then by SFDIR. See also GEN01.

iskptim (optional) -- time in seconds of input sound to be skipped. The default value is 0.

iformat (optional) -- specifies the audio data file format:

iwraparound -- 1 = on, 0 = off (wraps around to end of file either direction)

If iformat = 0 it is taken from the soundfile header, and if no header from the Csound -o command-line flag. The default value is 0.

Performance

kpitch -- can be any real number. a negative number signifies backwards playback. The given number is a pitch ratio, where:

diskin is identical to soundin except that it can alter the pitch of the sound that is being read.

CautionNote to Windows users
 

Windows users typically use back-slashes, "\", when specifying the paths of their files. As an example, a Windows user might use the path "c:\music\samples\loop001.wav". This is problematic because back-slashes are normally used to specify special characters.

To correctly specify this path in Csound, one may alternately:

  • Use forward slashes: c:/music/samples/loop001.wav

  • Use back-slash special characters, "\\": c:\\music\\samples\\loop001.wav

Examples

Here is an example of the diskin opcode. It uses the files diskin.orc, diskin.sco, beats.wav.

Example 1. Example of the diskin opcode.

/* diskin.orc */
/* Written by Kevin Conder */
; Initialize the global variables.
sr = 44100
kr = 44100
ksmps = 1
nchnls = 1

; Instrument #1 - play an audio file.
instr 1
  ; Play the audio file backwards.
  asig diskin "beats.wav", -1
  out asig
endin
/* diskin.orc */
        
/* diskin.sco */
/* Written by Kevin Conder */
; Play Instrument #1, the audio file, for three seconds.
i 1 0 3
e
/* diskin.sco */
        

See Also

in, inh, ino, inq, ins, soundin

Credits

Authors: Barry L. Vercoe, Matt Ingalls/Mike Berry

MIT, Mills College

1993-1997

Warning to Windows users added by Kevin Conder, April 2002