Convenience function for one-shot STFT Parameters ---------- x: array_like, (n_samples) or (n_samples, n_channels) input signal L: int frame size hop: int shift size between frames win: array_like the window to apply (default None) zp
(x, L, hop, win=None, zp_back=0, zp_front=0)
| 732 | |
| 733 | |
| 734 | def analysis(x, L, hop, win=None, zp_back=0, zp_front=0): |
| 735 | """ |
| 736 | Convenience function for one-shot STFT |
| 737 | |
| 738 | Parameters |
| 739 | ---------- |
| 740 | x: array_like, (n_samples) or (n_samples, n_channels) |
| 741 | input signal |
| 742 | L: int |
| 743 | frame size |
| 744 | hop: int |
| 745 | shift size between frames |
| 746 | win: array_like |
| 747 | the window to apply (default None) |
| 748 | zp_back: int |
| 749 | zero padding to apply at the end of the frame |
| 750 | zp_front: int |
| 751 | zero padding to apply at the beginning of the frame |
| 752 | |
| 753 | Returns |
| 754 | ------- |
| 755 | X: ndarray, (n_frames, n_frequencies) or (n_frames, n_frequencies, n_channels) |
| 756 | The STFT of x |
| 757 | """ |
| 758 | |
| 759 | if x.ndim == 2: |
| 760 | channels = x.shape[1] |
| 761 | else: |
| 762 | channels = 1 |
| 763 | |
| 764 | the_stft = STFT( |
| 765 | L, hop=hop, analysis_window=win, channels=channels, precision=x.dtype |
| 766 | ) |
| 767 | |
| 768 | if zp_back > 0: |
| 769 | the_stft.zero_pad_back(zp_back) |
| 770 | |
| 771 | if zp_front > 0: |
| 772 | the_stft.zero_pad_front(zp_front) |
| 773 | |
| 774 | # apply transform |
| 775 | return the_stft.analysis(x) |
| 776 | |
| 777 | |
| 778 | # inverse STFT |
nothing calls this directly
no test coverage detected