Mercurial > hg > auditok
changeset 99:ccab869cdbcb
Add function to save audio data as a raw file
author | Amine Sehili <amine.sehili@gmail.com> |
---|---|
date | Mon, 07 Jan 2019 21:12:10 +0100 |
parents | da2330e5b9ce |
children | cee5037f17ad |
files | auditok/io.py |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/auditok/io.py Mon Jan 07 20:51:58 2019 +0100 +++ b/auditok/io.py Mon Jan 07 21:12:10 2019 +0100 @@ -468,6 +468,14 @@ start += chunk_size +def _save_raw(filename, data): + """ + Save audio data as a headerless (i.e. raw) file. + """ + with open(filename, "wb") as fp: + fp.write(data) + + def _save_wave(filename, data, sampling_rate, sample_width, channels): """ Save audio data to a wave file.