Data#
- pylstraight.read(filename: str, **kwargs: Any) tuple[ndarray, int] [source]#
Read audio file. This is the simple wrapper of soundfile.read.
- Parameters:
- filenamestr
The path to the input file.
- **kwargsAny
Keyword arguments passed to soundfile.read.
- Returns:
- xnp.ndarray [shape=(nsample,) or (nchannel, nsample)]
The audio signal.
- fsint
The sampling frequency in Hz.
Examples
>>> import pylstraight as pyls >>> x, fs = pyls.read("assets/data.wav") >>> x.shape, fs ((19200,), 16000)
- pylstraight.write(filename: str, x: ndarray, fs: int, **kwargs: Any) None [source]#
Write audio file. This is the simple wrapper of soundfile.write.
- Parameters:
- filenamestr
The path to the output file.
- xnp.ndarray [shape=(nsample,) or (nchannel, nsample)]
The audio signal.
- fsint
The sampling frequency in Hz.
- **kwargsAny
Keyword arguments passed to soundfile.write.
Examples
>>> import pylstraight as pyls >>> x, fs = pyls.read("assets/data.wav") >>> pyls.write("copy.wav", x, fs)
- pylstraight.fromfile(filename: str, fs: int = 0, *, frame_length: float | None = None, dtype: np.dtype = <class 'numpy.float64'>) np.ndarray [source]#
Read a STRAIGHT parameter from file.
- Parameters:
- filenamestr
The file to read.
- fsint
The sampling frequency in Hz. If non-positive, the data is assumed to be F0, otherwise spectrum.
- frame_lengthfloat
The frame length in msec. If None, the default value is used.
- dtypenp.dtype
The data type of the file.
- Returns:
- outnp.ndarray [shape=(nframe,)] or [shape=(nframe, nfreq)]
The STRAIGHT parameter.
Examples
>>> import pylstraight as pyls >>> f0 = pyls.fromfile("tests/references/data.f0") >>> f0.shape (239,)