Mercurial > hg > auditok
changeset 100:cee5037f17ad
Add _guess_audio_format
author | Amine Sehili <amine.sehili@gmail.com> |
---|---|
date | Tue, 08 Jan 2019 20:14:18 +0100 |
parents | ccab869cdbcb |
children | a3da97fad36e |
files | auditok/io.py |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/auditok/io.py Mon Jan 07 21:12:10 2019 +0100 +++ b/auditok/io.py Tue Jan 08 20:14:18 2019 +0100 @@ -52,6 +52,13 @@ "multiple of `sample_width * channels`") +def _guess_audio_format(fmt, filename): + if fmt is None: + extension = os.path.splitext(filename.lower())[1][1:] + return extension if extension else None + return fmt.lower() + + class AudioSource(): """ Base class for audio source objects.