So for university I'm supposed to remove noise from a audio file. I have the original audio file and the teacher added some noise on top of it and I'm supposed to get rid of it using python. We have learnt the concepts on basic signals but I'm unable to use it on an audio file. Can someone tell me what resources I can study to learn that or probably some tips with the code?
-
What kind of audio is it, and what kind of noise? – Jon Nordby Nov 28 '20 at 10:55
1 Answers
read the wav file into an array which will hold the raw audio curve ... assure this is working by simply plotting out this array to view the audio curve ... so same for the other wav file into its own array
now its critical to identify the value of the zero crossing for each of these two arrays ... when the audio curve in the array wobbles its value up and down over time this zero crossing is the height of this curve when its playing silence meaning there is no wobbling
next you need to iterate across both arrays simultaneously ... assure you have confirmed each is playing the same audio at the same time ... perhaps you need to offset the index of one array so the points on the audio curve line up
you must invert the audio curve ( on the arrayA which is your original audio ) about its zero crossing value ... so instead of going up then down it will do down then up ... there are many ways to achieve this toggle ... if the zero crossing happens to have a value of zero then simply multiply the curve height by negative one
next you simply make one loop to iterate across both arrays simultaneously from beginning to end ... inside this loop obtain the sample value from arrayA and sample value from arrayB as mentioned above ... add together these two sample values and save this new value into your output wav file ... this output file will ONLY contain the noise
also inside that same loop mentioned above that sum value which is strictly only the noise now subtract that from the arrayB which is the audio with the noise ... save the result into your de-noised wav output file

- 26,870
- 12
- 93
- 104