extractor
Prev | Other Csound Utilities (CS, CSB64ENC, DNOISE, ENVEXT, EXTRACTOR, MAKECSD, MIXER, SCALE) | Next

## extractor

extractor — Extract a section of audio from an audio file.

## Description

Extract a section of audio, by time or sample, from an existing sound file.

## Syntax

    extractor [OPTIONS ... ] infile

## Initialization

Flags:

- -S integer = Start the extract at the given sample number.

- -Z integer = End the extract at the given sample number.

- - Q integer = Extract given number of samples.

- -T fpnum = Start the extract at the given time in seconds.

- -E fpnum = End the extract at the given time in seconds.

- -D fpnum = Extract given time in seconds.

- -v = Verbose mode.

- -R = Continually rewrite the header while writing soundfile (WAV/AIFF).

- -H integer = Show a "heart-beat" to indicate progress, in style 1, 2 or 3.

- -N = Alert call (usually ringing the bell) when finished.

- -v = Verbose mode.

- -o fname = output file name (default: test.wav)

## Examples

The default values are

        extractor -S 0 -Z end-of-file -otest

For example

        extractor -S 10234 -D 2.13 in.aiff -o out.wav

This creates a new sound file taken from sample 10234 and lasting 2.13 seconds.

Here is a complete example of the extractor utility. It uses the file extractor.csd.

Example 1367. Example of the extractor utility.

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   -m0  ;;;realtime audio out, with limiter protection
    ; For Non-realtime ouput leave only the line below:
    ; -o extractor.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

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

    ; by Menno Knevel 2022

    ; cuts a piece of a sound file and outputs result to SFDIR
    ires1 system_i 1,{{ extractor -S 0 -Z 40000 -v Mathews.wav -o ext1.wav  }} ; in samples
    ires2 system_i 1,{{ extractor -T 10 -E 13 -v   Mathews.wav -o ext2.wav  }} ; in seconds

    instr 1

    asig    diskin2 p4, 1
    outs    asig, asig
    endin

    </CsInstruments>
    <CsScore>

    i1 0 2 "ext1.wav"
    i1 2 2 "ext2.wav"
    e
    </CsScore>
    </CsoundSynthesizer>

| NOTE
This utility was added before we had waveform editors and DAWs.

## Credits

Author: John ffitch

1994

Prev | Up | Next
envext | Home | makecsd