0

I want to cut the audio files. However, whenever I cut it, there adds a glitch, a cutting noise where I cut the audio. How can I remove this noise?

The code I use to record the audio is:

import sounddevice as sd
from scipy.io.wavfile import write

fs = 16000  # Sample rate
seconds = 1.5  # Duration of recording

myrecording = sd.rec(int(seconds*fs), samplerate=fs, channels=1, dtype='int16') #recor the audio
sd.wait()  # Wait until recording is finished
myrecording=myrecording[8000:] #get one second data
write('output.wav', fs, myrecording)  # Save as WAV file

Thanks in advance.

  • 2
    This isn't really related to the `sounddevice` module, it can always happen when you cut a signal. You should add a "fade in" and/or "fade out". See https://nbviewer.jupyter.org/github/spatialaudio/communication-acoustics-exercises/blob/master/intro.ipynb#Listening-to-the-Signal for instructions. – Matthias Apr 20 '20 at 13:16
  • Thank you for that! fade in and fade out worked for me. – ml_user0993 Apr 23 '20 at 09:44

0 Answers0