Help building a frequency inverter/voice inverter?
Hi everyone!
Beginner-intermediate max user, no experience in gen.
Looking for a frequency inverter; also known as a voice inverter or voice scrambler.
I can't seem to find one anywhere, so I decided to try to build one myself.
This author seems to have come up with a pretty simple and clever means of getting frequency inverter.
How do I go about multiplying every other sample by -1 to achieve the frequency invert?
Hi
kind of intermediate myself here too, but my thoughts anyway:
you mention Gen, but I would guess that achieving this in the time domain would be quite tricky; have you any experience using fft~ in Max? i.e. doing it in the frequency domain. I quickly tried to phase shift an audio file using a simple pfft~, and failed - cuz my FFT chops are at best crap, so I won't even embarrass myself by posting it here (I used cartopol~/poltocar~ and added PI to the phase outlet = no change at all).
Brendan
It's just a ring modulator (with modulator at Nyquist freq). No fft or gen magic needed.
You can achieve a kind of downsampled effect with freqshift~
and negative frequencies (mirrored spectrum).
with fft you´d have the option to scale, limit and shift the range until it sounds useful.
for example you might want to dynamically assing a base frequency and mirror the spectrum around it.
with fft you´d have the option to scale, limit and shift the range until it sounds useful.
I don't disagree, but where is your patch? ;-) Joking aside, it's a matter of choosing convenient method. Simple RM in frequency domain is just a waste of CPU cycles.
for example you might want to dynamically assing a base frequency and mirror the spectrum around it.
This is what freqshift~
with negative frequency shift does. Of course it depends on what a "base frequency" is.
Ok, raja, Roman and AK, I have to ask: wtAf is going on here:
Is this sourcery or am I entirely stupid? I spent this afternoon trying to solve it and you guys do it with, like, 5 objects or 3 lines of code:
It's just basic DSP. If you know how to ring modulator works (side bands and stuff) it's quite obvious. Both examples (Raja's and mine) generate signal with alternating -1 and 1. Raja did this exactly like in the article linked by @OP, I did it using some stock msp objects. And this signal is how sine looks at Nyquist frequency (half the sampling rate). Multiplying a signal by sine is the 'ring modulator'. RM shifts entire spectrum up and down by the frequency of the sine. Given the sound spectrum mirrors at each multiple of Nyquist frequency, frequencies from 0 to Nyquist are moved beyond limit of hearing and frequencies from Nyquist to sample rate are moved into human hearing frequency range (see fft~ help file).
i dont find sidebands so obvious, but the default case of spectrum inversion by inverting every other sample could be called a "simple math trick" at least.
it is superior to fft solutions whenever you dont want to deal with latency, but for everything else but 180 degrees it will introduce aliasing (ak´s second example, correct me if i am wrong)
in many situations it might be best practice to use the ringmodulator method and apply post HP and LP filters.
fft: sorry for not having an example ready, but in fft you can inverse the spectrum quite easily, too, by doing something like !-1024 to the bin count before rebuilding the signal. adding a fft-banded brickwall filter lies next to it wih another 3-4 objects.
right inlet is frequency, float or signal. what the exact relationship between this value and the spectrum distortion is? no idea.
raja wrote:
"and you’re not worrying too much about what the author on that site wrote about "a sampling rate has to be chosen to (approximately) match the signal bandwidth",
which is, interesting enough, a perfect description of what you should do when "emulating" this "effect" on the digital layer.
because on the digital layer the spectrum is known, it goes from 0 to nyquist, while an radio signals spectrum is theoretically infinite and in practice it depends on the weather, which is why analog voice inverters allows willingly set modes, such as 5, 6, and 7 khz.
-110
Was dragging my feet about releasing this for a while... But this thread gave me some energy to post.
This is a project I have been working on for little while. It is not done at all. You will notice some artifacting on decryption. Open to suggestions on how to make it better, I want it to be open and available to the public at some point (I suppose it is now)
Essentially it is fft reordering or encryption based on a generated key. It basically pulls together 2 or 3 patches from the gen examples folder. Inspired by Simon Singh's "The Code Book", it approaches encryption using a monoalphabetic cipher. Not exactly what you are talking about here but related so here you go!
@AK, yes I understand the basic DSP *theory* behind it, I was merely marveling at the simplicity of raja's
History n(1);
out1 = in1 * n;
n *= -1;
which I have to admit I don't understand. Is the "n" in History a variable length?? I'm trying to realise his solution with gen objects, so I can understand it a bit better, as I have some Gen workshop stuff to prepare soon. I was able to RM a 22050Hz wave with various audio sources, which achieved the desired effect, what I found more challenging was inverting every other sample. Sorry to OP for the hijack.
Brendan
Is the "n" in History a variable length??
No, n is initialized to 1.
Thank you!
Hey raja
I didn't explicitly say "@raja", so no apology expected! Your wordiness is very much appreciated; I had a vague idea that 'n' was updating itself every time through the loop, but your explanation has clarified this to the point that even I get it ;)
Best regards, peace and love etc
Brendan
(OT; Gregory and I are delivering some gen stuff here in N.I. in a few months, so I need to brush up on my gen chops; been languishing in Linux/Supercollider land for the past year, so have grown a little rusty.)