Spectral splitting & reshuffling

Hi all,

I’m working on a thing where I’m planning to take a soundmass and split it into vertical / spectral parts – for example, a slice from 0-100hz, 100-300hz, 300-600hz, 600-1000hz, 1000-5000hz, 5000-10000hz, 10000-20000hz, or something along those lines.

(Then do various time-based etc processing to each layer to taste)

The approach I’m taking is to include an overlap/bleed between sections, with a bleed tuned so the basic reconstruction when stacking the sounds back together is reasonably transparent. Eg, no audible notches at the seams. For my project it’ll be nice if the original sound can reassemble untreated, since I just want to do things with the splits sparingly.

That’s the plan anyway. It seemed like a reasonable topic for discussion, just curious if you all have approaches to this sort of thing that you like – filters all the way! analysis/resynthesis all the way! etc – or find a set of tools or particular workflow useful when operating on vertical slices of the sound spectrum like this.

My filter tool of choice for this particular project is just going to be sox, but if I don’t like the results I might give SPEAR a go and get a little more creative (and manual) with the slicing.

(Edited because I used the word horizontal to describe a vertical stack of frequency bands. Derp.)

2 Likes

Here’s the dumb little python script I made to split a soundfile by a list of frequency breakpoints:

import subprocess
import sys

bands = [100, 300, 500, 1000, 3000, 4000, 6000, 8000, 10000, 15000, 20000]
overlap = 50
inputfile = sys.argv[1]
outfilebase = 'bands'

lowfreq = 0

for i, band in enumerate(bands):
    highfreq = band
    if lowfreq > 0:
        lowfreq -= overlap

    subprocess.run('sox %s %s%s.wav sinc %s-%s' % (inputfile, outfilebase, i, lowfreq, highfreq), shell=True)

    lowfreq = band

Save it as something.py and then use it by calling python3 something.py yoursoundfile.wav

Requires sox of course!

Tweak the list at the top to change the breakpoints…

Actually this seems fine for my purposes at the moment using just a fixed 50hz bleed. I thought I’d have to tune it a lot but the sound I’m processing is a big ole slab 'o drone so it doesn’t reveal the artifacts of this process as easily as I thought I guess…

2 Likes

Omg sorry I’ll stop. BUT. Here’s more about running sox on OSX tho: https://github.com/JoFrhwld/FAVE/wiki/SoX-on-OS-X

This guide also walks you thru adding sox to your PATH which you will need to do to run this script. This script should run fine under python 2 as well fwiw but I haven’t tested it.

Can i remove the 50hz bleed from that processing and make it 0hz? That script is really handy.

1 Like

try this? change the bands to whatever.

import subprocess
import sys

bands = [40, 100, 300, 500, 1000, 3000, 4000, 6000, 8000, 10000, 15000, 20000]
inputfile = sys.argv[1]
outfilebase = 'bands'

for i, band in enumerate(bands-1):
    lowfreq = bands[i]
    highfreq = bands[i+1]
    subprocess.run('sox %s %s%s.wav sinc %s-%s' % (inputfile, outfilebase, i, lowfreq, highfreq), shell=True)```
1 Like

oh huh, interesting! i’ve been meaning to put together something on Norns that does something similar (spectral processor with independent delays for each freq range).

2 Likes

Any sinc filter will do! This is just a tiny wrapper around the sox filter.

(of course the implementation of the filter will change the sound of the edges. there is probably a smoother approach to dealing with overlap!)