1
$\begingroup$

I have thousands of audio files that I want to "batch" process searching for audio tics. This is easily done using a DAW but that requires opening each file independently, searching for the tic (visually looking at the waveform or listening to the file play), and then cleaning the tic with signal processing tools within the DAW. However, this approach is extremely time consuming.

I'd like to write a program using python to process all of the files and provide candidate files that contain tics in the audio. I've been researching the web and found tons of references for plotting frequencies using fft after reading in the wav file but I don't want to plot the data I want to examine it in the program to determine if there is an audio tic (or potential tic) present.

Any help or ideas would be deeply appreciated.

$\endgroup$
  • 1
    $\begingroup$ Interesting challenge. Can you post a link to an example time domain data file where an example "tics" exists and what the time indexes are for the tic? My thought is a time domain based correlation approach but I would need to see several tics to see if that approach has any merit. $\endgroup$ – Dan Boschen Oct 12 '18 at 15:40
  • $\begingroup$ I posted a sample mono wav file with a tic contained in it at 2 sec and 24954 samples (sample rate 44100) - OutTest.wav. I also posted a mono wav file that just contains a tic - ticonly.wav. I posted screen scrapped image files (png) of what both wave files look like within a DAW (Audacity). The link to the flies are rbhooks.net/Files - looking forward to any suggestions or thoughts. Thanks Dan! $\endgroup$ – RBHCSD Oct 12 '18 at 22:33
  • $\begingroup$ are these "tics" jump discontinuities? $\endgroup$ – robert bristow-johnson Oct 13 '18 at 1:39
  • $\begingroup$ No, I don't believe so. I believe some of them are collapsed magnet fields on the disk drives causing bit erosion/bit error and some are due to DAT tape to disk transfer from old "dirty" tapes. $\endgroup$ – RBHCSD Oct 13 '18 at 1:48
  • $\begingroup$ After seeing your image I like Dan's suggestions, in particular the high pass and threshold should be robust enough (use an N-sigma for the threshold where sigma is the standard deviation of the data). A remaining challenge is what do you replace the removal with so that you don't hear another discontinuity. $\endgroup$ – Dan Boschen Oct 13 '18 at 21:45
1
$\begingroup$

I don’t know what DAW you use, but I’m pretty sure Waves and probably some other companies have plug ins for this kind of application. After reviewing your images it seems that the tics are high frequency and high amplitude so there are some simple things you could try. You could check each sample and compare the absolute value to some threshold, such that if it is higher, you have a tic. Second, you could high pass filter the signal to isolate the tic, then do the previous step. Third, you could calculate the RMS of the signal, then compare the absolute value (peak) of each sample to the RMS, such that a tic occurs whenever the ratio or difference exceeds a given threshold. Lastly, you could do frequency magnitude analysis. For this you would set up a window size N and step size M. Every M samples you take N samples and apply a window function, then calculate the frequency transform magnitude of the N samples. One idea would be to look at the rate of change of individual frequency components such that if it exceeds a threshold you have a tic. This is probably the most CPU intensive and complex implementation.

$\endgroup$
  • $\begingroup$ Yes Waves and several other DAWs (ProTools, Adobe Audition, MixBus etc.) do have mechanisms/tools to remove "tics" but to use a DAW to look at thousands of files is too labor intensive. I was thinking of using SOX to split the stereo wavs into two mono files and process each independently to reduce the complexity. I thought about going through each sample and calculate the amplitude and frequency but the examples I have been able to locate on the web using python to do this don't seem to be giving me the proper results - at least the frequencies aren't matching the DAW. $\endgroup$ – RBHCSD Oct 13 '18 at 19:09
  • $\begingroup$ It seems odd that your DAW would give you different results. If you to either modify your question or post a new one to reflect what you are trying in your implementation, I’m happy to try and help you straighten it out. $\endgroup$ – Dan Szabo Oct 13 '18 at 20:04
  • $\begingroup$ Welcome to SignalProcessing.SE Dan! $\endgroup$ – Dan Boschen Oct 13 '18 at 21:45
  • $\begingroup$ Thanks DanS! I've been using numpy, wave, struct, and pyplot in python to read in 440hz tone wav file and running struct.unpack on the samples, using a numpy.array, running numpy.fft against the array then numpy.abs on the array. From what I understand this should represent and hold the frequencies. However, numpy.argmax of the array yields the "strongest" frequency as 43100hz. So something is wrong with the example I found on the web for processing the wav file. The DAW shows 440Hz. Here is the info I was using - pythonforengineers.com/… $\endgroup$ – RBHCSD Oct 14 '18 at 1:27
  • $\begingroup$ PS - I'm happy to share the python code I've been working with to to chat over email. Thanks for the help!! $\endgroup$ – RBHCSD Oct 14 '18 at 1:28

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.