nstrstr
Prev | Orchestra Opcodes and Operators | Next

## nstrstr

nstrstr — Returns the string of a named instr from its number.

## Description

Returns the string of a named instr from its number or an empty string if no such association exists.

## Syntax

    Sname nstrstr insno

    Sname nstrstr knsno

## Initialization

insno -- the instrument number of the named instrument.

## Performance

knsno -- the named instrument's number.

Sname -- the named instrument's name.

If an instrument with the specified name does not exist an empty string is returned.

## Examples

Here is an example of the nstrstr opcode. It uses the file nstrnum_nstrstr.csd.

Example 643. Example of the nstrstr opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>
    <CsOptions>
    -n
    </CsOptions>
    <CsInstruments>

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

    instr nothing
    endin

    instr john
     prints "instrument name = "
     puts nstrstr(p1),1
     prints "instrument number = %d\n", nstrnum("john")
    endin

    instr test
    endin

    </CsInstruments>
    <CsScore>
    i "john" 0 0
    </CsScore>
    </CsoundSynthesizer>

The example will produce the following output:

    instrument name = john
    instrument number = 2

## Credits

Author: John ffitch
New in version 6.13
Written in the year 2019.

Prev | Up | Next
nstrnum | Home | ntrpol