Infrasound processing with SoX

Infrasound processing with SoX

In this post I’ll cover how to use SoX to make low frequency sounds audible in a range that can be listened to. Infrasound is a low frequency sound wave that ranges from 20 hertz down to .1 hertz. Monitoring audio frequencies in this range is typically done to detect seismic activity that is caused either by nature or artificially,

I have a sample of video that was shot with a Mobius camera. The audio range of the camera’s microphone does not go below 20 hertz, so true infrasound detection can not be obtained. However, low frequency energy is captured and I can use SoX to raise the low frequencies. First, I’ll extract the audio clip from a section of my source video using FFMpeg, here is the command.

ffmpeg -i "/home/local/Desktop/REC_0044.MOV" -ss 00:02:15 -t 00:00:30 -acodec pcm_s16le -ac 1 -ar 44100 "/home/local/Desktop/REC_0044.wav"

It starts extracting audio at 2:15 into the source video and continues for a duration of 30 seconds. The codec used is a standard 16bit pulse code modulation, commonly used in wav files. I then specified the number of audio channels and the sampling rate, mono and 44.1 kbps. With this audio clip, the SoX command can be run to determine the best filtering and pitch control. I used this command.

play "/home/local/Desktop/REC_0044.wav" sinc -60 pitch -q 3985

I modified the sinc and pitch -q values to get the best results I was looking for. Once the values were determined, I used this command to create new audio file that contains audible low frequencies that are shifted to higher frequencies for easier listening.

sox "/home/local/Desktop/REC_0044.wav" "/home/local/Desktop/REC_0044_Infrasound.wav" sinc -60 pitch -q 3985

Next, I extracted a new video with the same time range from the source video. I want to use this later to replace my process audio on to this new video clip.

ffmpeg -i "/home/local/Desktop/REC_0044.MOV" -ss 00:02:15 -t 00:00:30 -c:v copy "/home/local/Desktop/REC_0044_Clip.MOV"

Now the final video can be processed with the low frequency audio clip inserted.

ffmpeg -i "/home/local/Desktop/REC_0044_Clip.MOV" -i "/home/local/Desktop/REC_0044_Infrasound.wav" -c:v copy -map 0:v:0 -map 1:a:0 -shortest "/home/local/Desktop/REC_0044_Infrasound.MOV"

Notice I used a map command to specify the video and audio to be used. The sample here is of the West Seattle Water Taxi arriving at Alki. You can hear a sounding device used by the ferry, not sure what its purpose is. Also, I’m not certain if this is audio detected by the microphone or some other electronic noise picked up by my Mobius electrical circuitry. Either way it demonstrates how to use SoX to raise the frequency of sounds often too low to be easily heard. This can be useful for monitoring machinery or other devices that create low frequency sounds to indicate normal or abnormal operation.

True infrasound detection requires the use of special microphones that have a frequency response in the .1 to 20 hertz range. Using standard microphones, such as my Mobius camera will not detect infrasound audio. It should also be noted that the actual operating frequency range of SoX is not defined, or at least I have not seen mention of it. Since SoX works at a software level, it is not restricted by the frequency range of audio hardware, such as headphones, mixers, sound cards, or other computer hardware that handles audio. If a PCM data file contains infrasound data, it is possible to pitch shift that data to make it audible in SoX.

In the absence of infrasound detection equipment, I generated infrasound audio in Audacity. Here are the SoX commands I used to bring that audio in range of hearing.

play "/home/local/Desktop/Audacity_10Hertz_InfraSound.wav" pitch -q 3985
play "/home/local/Desktop/Audacity_1Hertz_InfraSound.wav" pitch -q 3985

I then layered the pitch shift on the infrasound to bring the frequency up further

sox "/home/local/Desktop/Audacity_10Hertz_InfraSound.wav" "/home/local/Desktop/Audacity_10Hertz_InfraSound_x3000.wav" pitch -q 3000

I applied another shift to bring the audio up further

sox "/home/local/Desktop/Audacity_10Hertz_InfraSound_x3000.wav" "/home/local/Desktop/Audacity_10Hertz_InfraSound_x3000_2x.wav.wav" pitch -q 3000

As you can see from the spectrogram, there are several artifacts introduced into the audio. However, it does prove that SoX has a frequency range that works well inside the infrasound audio range. I hope you have enjoyed this post. Please check back as I cover more topics in future posts.


Comments are closed.