Frequency compression around a center?

Audio software developers forum.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Post Reply
dmeat
Posts: 4
Joined: Sat Aug 31, 2013 8:27 pm
Operating System: Please select

Frequency compression around a center?

Post by dmeat » Sat Aug 31, 2013 9:07 pm

Hi folks, new user here.

My question is about frequency compression. I need to write a plugin to shift lower frequencies up, and higher ones down - around a defined center frequency, with an optional factor to increase the amount shift based on distance from center (e.g. logarithmic).

Obviously this would be terrible for music production because it would destroy the necessary frequency relationships that help to make it music. But it's not for music - it is for processing natural and ambient recordings, to bring the frequency response that a mic can capture, into a comfortably human-audible range.

Searching Google and this forum site in particular, I have found absolutely nothing, nada, not even close. (As far as code ideas - much less an actual plugin!)

The idea behind this would be similar in concept to dynamic range compression, except in the frequency domain rather than amplitude. And simpler. I have to believe this would be simple to write. ...But although I'm a programmer comfortable in multiple languages, I'm not familiar with programming for audio at all. (I'm also not trying to be an audio programmer - just the minimal to write this simple plugin.)

After I get this working as a basic plugin, I might extend the idea to quasi-real-time processing. (To augment my War Machine armor's light frequency compression HUD, which enables me to "see" radio through visible to gamma radiation. JK. Actually just for research purposes.)

Thanks in advance for ideas or pointers!
-Jim

kozikowski
Forum Staff
Posts: 69357
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: Frequency compression around a center?

Post by kozikowski » Sat Aug 31, 2013 9:36 pm

Yes, well. Whereas frequency compression in the visual domain turns radio frequencies into something you can see, doing it in the audio domain turns sound into garbage.

This should be interesting to watch. I think this a cousin to the early research people did with ring modulators to make more efficient use of transmission bandwidth. Transmit the intelligence without necessarily the actual sound.

Koz

dmeat
Posts: 4
Joined: Sat Aug 31, 2013 8:27 pm
Operating System: Please select

Re: Frequency compression around a center?

Post by dmeat » Sat Aug 31, 2013 9:56 pm

kozikowski wrote:Whereas frequency compression in the visual domain turns radio frequencies into something you can see, doing it in the audio domain turns sound into garbage.
Not necessarily any more than dynamic range compression must turn music into noise. It's all about proper application and source material. (Also to your point about radio, applying this to EMF would probably take some serious brain adaptation, and for everyday outdoor experience in a city, would probably be a visual mess. Unless the center visual frequency was compressed less, and the higher outlying frequencies compressed gradually more and also attenuated in amplitude to avoid making a big visual blur.)

Likewise, I plan on making the frequencies near the center shifted less, with logarithmically more shifting relative to how far from center a frequency band is. (And also probably attenuated more relative to shift amount, to avoid a sonic mess, depending on the source. I once manually processed a quiet outdoor soundscape in a very crude approximation of this several years ago, and it was quite revealing. Lots of dynamic range compression also helped in that case, as did a pristine and high-sample rate source.)

Thanks for the feedback!

Robert J. H.
Posts: 3633
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 10

Re: Frequency compression around a center?

Post by Robert J. H. » Sun Sep 01, 2013 7:51 am

What are the frequency ranges you want to convert from -- i.e what is the original sample rate?
There's actually a lot source material available on the web.
Most algorithms are FFT-based.
For example, if you calculate a mel frequency cepstrum, you have to re-map the linear FFT bins to the Mel scale. This scale is linear up to 1000 Hz and afterwards logarithmic.
Julian O. smith uses a first-order allpass filter to map from linear to Bark scale (100 Mel = 1 Bark). You'll probably need a higher order allpass because the lower frequencies are also compressed.
The results of those calculations (if FFT is envolved) build the base for analytic interpretations. In your case, you would simply apply an IFFT to bring the frequency domain values back into the time domain.
That would all be fairly easy in Nyquist (Audacity's internal plug-in language). But I assume that you want to write a stand-alone plug-in.
Hence, you have to include a library with Filter and Fast Fourier or discreet cosine transformation capabilities. Or use Mathlab/Octave.

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Frequency compression around a center?

Post by steve » Mon Sep 02, 2013 2:42 pm

Theoretically you could adapt a "phase vocoder" algorithm (http://www.dspdimension.com/admin/time-pitch-overview/)
This is not an easy programming task.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Robert J. H.
Posts: 3633
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 10

Re: Frequency compression around a center?

Post by Robert J. H. » Mon Sep 02, 2013 4:54 pm

steve wrote:Theoretically you could adapt a "phase vocoder" algorithm (http://www.dspdimension.com/admin/time-pitch-overview/)
This is not an easy programming task.
It might be easier in this case because the sound has not to be shifted in a musical sense.
The task seems similar to the rendering of whale song to an audible frequency range.
Both results won't represent the reality and the outcome is only subjectively adapted to our hering experience.
We can hardly judge without further input.

Post Reply