Browse Source

startup function `wavfile_read_mono`: added type hints

Fabian Peter Hammerle 3 years ago
parent
commit
37f7da54b8
1 changed files with 5 additions and 1 deletions
  1. 5 1
      profile_default/startup/init.py

+ 5 - 1
profile_default/startup/init.py

@@ -1,5 +1,7 @@
+import pathlib
 import typing
 
+import numpy
 import scipy.io.wavfile
 
 
@@ -24,7 +26,9 @@ def trim_where(
     return sequence[start:stop]
 
 
-def wavfile_read_mono(path):
+def wavfile_read_mono(
+    path: typing.Union[pathlib.Path, str]
+) -> typing.Tuple[int, numpy.ndarray]:
     # https://docs.scipy.org/doc/scipy/reference/generated/scipy.io.wavfile.read.html
     rate, data = scipy.io.wavfile.read(path)
     data_first_channel = data[:, 0]