One my codes i've used for this track, it reinforces the attack of a sound. as always, beware of the sound selected: from scipy.io.wavfile import * from scipy.fftpack import * import math import numpy as np amplification = np.int(14) fs, data = read("/sound.wav") time = (len(data)/fs) at = math.exp(-1/(time*fs)) print at seconds = np.array_split(data,time/at) def rms(array): for i in array: rms = lambda: np.sqrt(np.mean(np.square(np.abs(fft(array))))) return rms() break def dB(rms): dB = 10 * np.log10(np.abs(rms(array=seconds[0])/seconds[0])) return np.max(dB[dB<120]) dBofrms = dB(rms) def dBoftrack(): for i in seconds[:]: dBoftrack = 20 * np.log10(np.abs(data)) return dBoftrack dBoftrack = dBoftrack() def amplifyAttack(): a1 = dBoftrack <= dBofrms dBoftrack[a1] *= 30 return np.int16(dBoftrack) output = amplifyAttack()+data write("/newpath",192000,np.int16(output))
Channels: 2 | Samplerate: 48000 | Genre: Rock | Instrument: Bass
"Avoidance" by Court Society is licensed under a Creative Commons Attribution-ShareAlike 4.0 International. Published: 15 de julio de 2016 a las 17:15 by Court Society. Permanent link.