ntom
Prev | Orchestra Opcodes and Operators | Next

## ntom

ntom — Convert note name to midi note number

## Description

Plugin opcode in emugens.

Convert note name to midi note number. It allows note name to include microtones or a deviation in cents.

## Syntax

    kmidi ntom Snote

    imidi ntom Snote

## Performance

Snote -- Note name

kmidi -- Midi note number

Example of note names:

    		midi    note name
    		-------------------
    		60      4C
    		60.4    4C+40
    		60.5    4C+
    		60.9    4Db-10
    		61      4C#
    		61.5    4D-

| Note
4C is the central C in the piano

## Examples

Here is an example of the ntom opcode. It uses the file mton-ntom.csd.

Example 664. Example of the ftom opcode.

    <CsoundSynthesizer>
    <CsOptions>
    --nosound
    </CsOptions>
    <CsInstruments>

    instr 1
        S4 mton ntom("7D+63")
        puts S4, 1

        S1  mton 60
        printf_i "midi 60 = %s \n", 1, S1

        S2 mton ftom(442)
        printf_i "442 Hz = %s \n", 1, S2

        S3 = mton(48.25)
        printf_i "midi 48.25 = %s \n", 1, S3

        k1 = ntom("4C")
        printf_i "4C = midi %f \n", 1, k1

        i2  ntom "4E"
        printf_i "4E = %f \n", 1, i2

        S5 = mton(ntom("4G+"))
        printf_i "roundtrip 4G+: %s \n", 1, S5

        turnoff
    endin

    instr 2
        ; test i-time and k-time execution
        k1 = ntom("4Eb-31")
        printf "4Eb-31 = %f \n", 1, k1

        i0  ntom "4C+"
        printf_i "4C+ = %f \n", 1, i0

        i1 = ntom:i("4A")
        printf_i "4A = %f \n", 1, i1
        turnoff
    endin

    </CsInstruments>
    <CsScore>

    i 1 0 1
    i 2 0 1

    </CsScore>
    </CsoundSynthesizer>

## See Also

cpsmidinn, mtof, ftom, mton

## Credits

By: Eduardo Moguillansky 2017

Prev | Up | Next
nstance | Home | ntof