normalizeNamedPfields

normalizeNamedPfields#

csoundengine.csoundlib.normalizeNamedPfields(pfields, namesToIndexes=None)[source]#

Given a dict mapping pfield as str to value, return a dict mapping pfield index to value

Parameters:
  • pfields (dict[str, float]) – a dict of the form {pfield: value} where pfield can be

  • pfield (a key like 'p<n>' or a variable name which was assigned to this)

  • p4 ((like ifreq =)

  • namesToIndexes (dict[str, int] | None) – a dict mapping variable names to indexes

Returns:

value}

Return type:

a dict of the form {pfieldindex

Example

>>> normalizeNamedPfields({'p4': 0.5, 'ifreq': 2000}, {'ifreq': 5})
{4: 0.5, 5: 2000}