@@ -357,7 +357,7 @@ def callback(indata, frames, time, status):
357357 return ctx .out
358358
359359
360- def playrec (data , samplerate = None , input_channels = None , input_dtype = None ,
360+ def playrec (data , samplerate = None , channels = None , dtype = None ,
361361 out = None , input_mapping = None , output_mapping = None , blocking = False ,
362362 ** kwargs ):
363363 """Simultaneous playback and recording.
@@ -366,12 +366,14 @@ def playrec(data, samplerate=None, input_channels=None, input_dtype=None,
366366 ----------
367367 data : array_like
368368 Audio data to be played back. See :func:`play`.
369- input_channels : int, sometimes optional
370- See the parameter `channels` of :func:`rec`.
371- input_dtype : str or numpy.dtype, optional
372- See the parameter `dtype` of :func:`rec`.
373- If `input_dtype` is not specified, it is taken from `data.dtype`
369+ channels : int, sometimes optional
370+ Number of input channels, see :func:`rec`.
371+ The number of output channels is obtained from `data.shape`.
372+ dtype : str or numpy.dtype, optional
373+ Input data type, see :func:`rec`.
374+ If `dtype` is not specified, it is taken from `data.dtype`
374375 (i.e. :attr:`default.dtype` is ignored).
376+ The output data type is obtained from `data.dtype` anyway.
375377 input_mapping, output_mapping : array_like, optional
376378 See the parameter `mapping` of :func:`rec` and :func:`play`,
377379 respectively.
@@ -402,10 +404,10 @@ def playrec(data, samplerate=None, input_channels=None, input_dtype=None,
402404 """
403405 ctx = _CallbackContext ()
404406 output_frames = ctx .check_data (data , output_mapping )
405- if input_dtype is None :
406- input_dtype = data .dtype # ignore module defaults
407- input_frames = ctx .check_out (out , output_frames , input_channels ,
408- input_dtype , input_mapping )
407+ if dtype is None :
408+ dtype = data .dtype # ignore module defaults
409+ input_frames = ctx .check_out (out , output_frames , channels , dtype ,
410+ input_mapping )
409411 if input_frames != output_frames :
410412 raise PortAudioError ("len(data) != len(out)" )
411413 ctx .frames = input_frames
0 commit comments