Skip to content

Generation audio frames and creating silent mp3 files

License

Notifications You must be signed in to change notification settings

splash58/silence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

silence

Generation audio frames and saving silent mp3 files

Could be used alone but was designed to use with gtts to make a pause between sounds

The class constructor has only one argument - the silence time in seconds (a float is available). The timing accuracy is no worse than 0.024 seconds (this is the length of one frame) which seems to be sufficient for audio applications

Usage Example

create a 10-second silent file

>>> from silence import *
>>> Silence(10).save('silence.mp3')

making 3-second mp3

>>> from silence import *
>>> with open('silence.mp3', 'wb') as f:
>>>     f.write(Silence(3).get_frames())

usage with gtts

>>> from gtts import gTTS
>>> from silence import *

>>> with open('hello.mp3', 'wb') as f:
>>>     gTTS('hello', lang='en').write_to_fp(f)
>>>     Silence(5).write_to_fp(f)
>>>     gTTS('bonjour', lang='fr').write_to_fp(f)

About

Generation audio frames and creating silent mp3 files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages