Utilities — Pyo 1.0.4 documentation

Pyo 1.0.4 documentation

# Utilities

## Functions in this category

- `example()` : Execute the documentation example of the object given as an argument.

- `class_args()` : Returns the signature of a pyo class or function.

- `getVersion()` : Returns the version number of the current pyo installation.

- `getPrecision()` : Returns the current sample precision as an integer.

- `getPyoKeywords()` : Returns a list of every keywords (classes and functions) of pyo.

- `getPyoExamples()` : Returns a listing of the examples, as a dictionary, installed with pyo.

- `withPortaudio()` : Returns True if pyo is built with portaudio support.

- `withPortmidi()` : Returns True if pyo is built with portmidi support.

- `withJack()` : Returns True if pyo is built with jack support.

- `withCoreaudio()` : Returns True if pyo is built with coreaudio support.

- `withOSC()` : Returns True if pyo is built with OSC (Open Sound Control) support.

- `convertStringToSysEncoding()` : Convert a string to the current platform file system encoding.

- `convertArgsToLists()` : Convert all arguments to list if not already a list or a PyoObjectBase.

- `wrap()` : Return value at position i from arg with wrap around arg length.

## example

example(cls, dur=5, toprint=True, double=False)

  Execute the documentation example of the object given as an argument.

  Args
    cls: PyoObject class or string

      Class reference of the desired object example. If this argument is the string of the full path of an example (as returned by the getPyoExamples() function), it will be executed.

    dur: float, optional

      Duration of the example.

    toprint: boolean, optional

      If True, the example script will be printed to the console. Defaults to True.

    double: boolean, optional

      If True, force the example to run in double precision (64-bit) Defaults to False.

      >>> example(Sine)

## class_args

class_args(cls)

  Returns the signature of a pyo class or function.

  This function takes a class or a function reference as input and returns its signature with the default values.

  If the operation can’t succeed, the function silently fails and returns an empty string.

  Args
    cls: callable (class or function from pyo lib)

      Reference of the class or function for which the signature is retrieved.

      >>> print(class_args(Sine))
      >>> 'Sine(freq=1000, phase=0, mul=1, add=0)'

## getVersion

getVersion()

  Returns the version number of the current pyo installation.

  This function returns the version number of the current pyo installation as a 3-ints tuple (major, minor, rev).

  The returned tuple for version ‘0.4.1’ will look like: (0, 4, 1)

      >>> print(getVersion())
      >>> (0, 5, 1)

## getPrecision

getPrecision()

  Returns the current sample precision as an integer.

  This function returns the current sample precision as an integer, either 32 for 32-bit (single) or 64 for 64-bit (double).

## getPyoKeywords

getPyoKeywords()

  Returns a list of every keywords (classes and functions) of pyo.

      >>> keywords = getPyoKeywords()

## getPyoExamples

getPyoExamples(fullpath=False)

  Returns a listing of the examples, as a dictionary, installed with pyo.

  Args
    fullpath: boolean

      If True, the full path of each file is returned. Otherwise, only the filenames are listed.

      >>> examples = getPyoExamples()

## withPortaudio

withPortaudio()

  Returns True if pyo is built with portaudio support.

## withPortmidi

withPortmidi()

  Returns True if pyo is built with portmidi support.

## withJack

withJack()

  Returns True if pyo is built with jack support.

## withCoreaudio

withCoreaudio()

  Returns True if pyo is built with coreaudio support.

## withOSC

withOSC()

  Returns True if pyo is built with OSC (Open Sound Control) support.

## convertStringToSysEncoding

convertStringToSysEncoding(strng)

  Convert a string to the current platform file system encoding.

  Returns the new encoded string.

  Args
    strng: string

      String to convert.

## convertArgsToLists

convertArgsToLists(*args)

  Convert all arguments to list if not already a list or a PyoObjectBase. Return new args and maximum list length.

## wrap

wrap(arg, i)

  Return value at position i from arg with wrap around arg length.