Does anyone know how can I crop an audio signal and maintain the same values in the sample vector?

I am working on a audio signal processing project for song recognition in Python and I wanted to crop a song in Audacity. To my surprise, the audio samples (for both the left and right channel) in the cropped version were "corrupted", meaning that they were different from the corresponding samples from the original song.

  • 1
    $\begingroup$ maybe audacity performed some audio format conversions on the way? $\endgroup$ – Marcus Müller Jun 10 '19 at 17:12
  • $\begingroup$ Hi @Adrian, and welcome to DSP.SE. What format do you use? If it is a compressed format, Audacity had to decode the file for loading it and encode it again for saving. The compression algorithm may have produced different sample values, possibly depending on the surrounding samples of your cropped region. $\endgroup$ – applesoup Jun 11 '19 at 12:03
  • $\begingroup$ Thank you @applesoup for the warm welcome! I use .wav files in order no to lose too much information from the signal. I am quite at the beginning in this field, so I don't know so much about the various formats. Would you recommend choosing another format? $\endgroup$ – Adrian Jun 12 '19 at 12:40
  • $\begingroup$ @MarcusMüller perhaps this is the case. I also tried cropping a song with an online tool and also changed the sample vector. I don't know whether it's because of the wav format that I use or the tool for cropping. $\endgroup$ – Adrian Jun 12 '19 at 12:43
  • $\begingroup$ @Adrian .wav is just a container. It can contain different kinds of compressed and uncompressed data. $\endgroup$ – Marcus Müller Jun 12 '19 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.