def _get_pyo_codes(fmt='', dtype='int16', file_out=''):
 if (not fmt):
  dot_ext = os.path.splitext(file_out)[1]
  fmt = dot_ext.lower().strip('.')
 if (fmt in pyo_formats.keys()):
  file_fmt = pyo_formats[fmt]
 else:
  msg = 'format `{0}` not supported'.format(file_out)
  raise PyoFormatException(msg)
 if (fmt in ['sd2', 'flac']):
  ok_dfmt = {'int16': 0, 'int24': 1}
 else:
  ok_dfmt = pyo_dtype
 if (dtype in ok_dfmt.keys()):
  data_fmt = pyo_dtype[dtype]
 else:
  msg = 'data format `{0}` not supported for `{1}`'.format(dtype, file_out)
  raise PyoFormatException(msg)
 return (file_fmt, data_fmt)

def _get_pyo_codes ( fmt = '' , dtype = 'int16' , file_out = '' ) : if ( not fmt ) : dot_ext = os . path . splitext ( file_out ) [ 1 ] fmt = dot_ext . lower ( ) . strip ( '.' ) if ( fmt in pyo_formats . keys ( ) ) : file_fmt = pyo_formats [ fmt ] else : msg = 'format `{0}` not supported' . format ( file_out ) raise PyoFormatException ( msg ) if ( fmt in [ 'sd2' , 'flac' ] ) : ok_dfmt = { 'int16' : 0 , 'int24' : 1 } else : ok_dfmt = pyo_dtype if ( dtype in ok_dfmt . keys ( ) ) : data_fmt = pyo_dtype [ dtype ] else : msg = 'data format `{0}` not supported for `{1}`' . format ( dtype , file_out ) raise PyoFormatException ( msg ) return ( file_fmt , data_fmt )
convert file and data formats to int codes .