mp3in

mp3in — Reads mono or stereo audio data from an external MP3 file.

Description

Reads mono or stereo audio data from an external MP3 file.

Syntax

ar1, ar2 mp3in ifilcod[, iskptim, iformat, iskipinit, ibufsize]
ar1 mp3in ifilcod[, iskptim, iformat, iskipinit, ibufsize]

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

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

iformat (optional) -- specifies the audio data file format: currently not implemented and always defaults to stereo.

iskipinit (optional) -- switches off all initialisation if non zero (default =0).

ibuffersize (optional) -- sets the internal buffer size for reading. If the value is omitted, zero or negative it defaults to 4096 bytes.

Performance

Reads audio data from an external MP3 file.

Examples

Here is an example of the mp3in opcode. Play mp3in.csd

Example 635. Example of the mp3in 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
-odac    ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o mp3in.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1

instr 1

iskptim	 = .3
ibufsize = 64
ar1, ar2 mp3in "beats.mp3", iskptim, 0, 0, ibufsize
         outs ar1, ar2

endin
</CsInstruments>
<CsScore>

i 1 0 2
e
</CsScore>
</CsoundSynthesizer>


See Also

diskin, ins, in, inh, inh, ino, inq, mp3len, soundin

Credits

Author: John ffitch
Codemist Ltd
2009

New in version 5.11

Mono added in 6.05