Code

Audio Editing with SciPy Full Example

''' Document containing functions to edit audio ''' import scipy.io.wavfile as spw def make_quiet(filename): ''' Lowers the volume of WAV file to a quarter of the original volume Parameters: filename - the name of a WAV file Returns: A new WAV file that is a quarter of the original volume ''' try: sample=spw.read(filename) LOWER_VOLUME=4 for i in range(len(sample[1])): sample[1][i]=sample[1][i]//LOWER_VOLUME spw.write('quieter.wav', 44100, sample[1]) except IOError: print('Incorrect filename, please try again')

0

1

Updated 2021-06-22

Contributors are:

Who are from:

Tags

Python Programming Language

Data Science