Play method. Only one SignalObj channel can be played through each sound card output channel. Check the input parameters below For usage insights, check the examples folder. Parameters (default), (type): --------------------
(self,
channels: list = None,
mapping: list = None,
latency='low',
**kwargs)
| 465 | return np.size(inputArray.shape) |
| 466 | |
| 467 | def play(self, |
| 468 | channels: list = None, |
| 469 | mapping: list = None, |
| 470 | latency='low', |
| 471 | **kwargs): |
| 472 | """ |
| 473 | Play method. |
| 474 | |
| 475 | Only one SignalObj channel can be played through each sound card |
| 476 | output channel. Check the input parameters below |
| 477 | |
| 478 | For usage insights, check the examples folder. |
| 479 | |
| 480 | Parameters (default), (type): |
| 481 | ------------------------------ |
| 482 | |
| 483 | * channels (None), (list): |
| 484 | list of channel numbers to play. If not specified all existent |
| 485 | channels will be chosen; |
| 486 | |
| 487 | * mapping (None), (list): |
| 488 | list of channel numbers of your sound card (starting with 1) |
| 489 | where the specified channels of the SignalObj shall be played |
| 490 | back on. Must have the same length as number of SignalObj's |
| 491 | specified channels (except if SignalObj is mono, in which case |
| 492 | the signal is played back on all possible output channels). |
| 493 | Each channel number may only appear once in mapping; |
| 494 | |
| 495 | |
| 496 | """ |
| 497 | if channels is None: |
| 498 | channels = self.channels.mapping |
| 499 | |
| 500 | else: |
| 501 | treta = False |
| 502 | inexistentChs = [] |
| 503 | for chNum in channels: |
| 504 | if chNum not in self.channels.mapping: |
| 505 | treta = True |
| 506 | inexistentChs.append(chNum) |
| 507 | if treta: |
| 508 | raise IndexError("SignalObj channel number(s) " + |
| 509 | str(inexistentChs) + |
| 510 | " don't exist.") |
| 511 | |
| 512 | indexes = [self.channels.mapping.index(chNum) for chNum in channels] |
| 513 | |
| 514 | timeSignalSel = self.timeSignal[:,indexes[0]] |
| 515 | |
| 516 | if len(channels) > 1: |
| 517 | for idx in indexes[1:]: |
| 518 | timeSignalSel = np.vstack((timeSignalSel, |
| 519 | self.timeSignal[:,idx])) |
| 520 | |
| 521 | timeSignalSel = timeSignalSel.T |
| 522 | |
| 523 | if mapping is None: |
| 524 | if self.numChannels <= 1: |
no test coverage detected