Can you turn a recording upside-down?

If I had a recording of some music, I could play it backwards. This is pretty simple.

If I had some music recorded, could I flip it around a note like in this image? If possible, how does that work?

• If by "recording" you mean a midi file, I'm sure you could write a transformation algorithm to accomplish the task. But "how does that work" seems a little too broad.
– user39614
May 8, 2019 at 1:37
• @DavidBowling I mean like an MP4 or OGG file May 8, 2019 at 1:38
• I'm not sure that those formats store audio information in a way that would allow this kind of manipulation (I don't think so). The answer will really come down to the particulars of the file formats in question, so may be off-topic here. It sounds like a question that topo morto may have some insight into; I'm sure that he will be along sooner or later....
– user39614
May 8, 2019 at 1:46
• To me, "turning a recording upside down" implies a process that somehow inverts the frequency spectrum of the audio, but as Your Uncle Bob says in their answer, that wouldn't have the note-by-note effect that you imply in the pictures. May 8, 2019 at 6:30
• @Tim There's an urban legend about a music student who was late for a composition assignment and decided to turn one of his teacher's compositions upside-down, only to find that it was itself a famous composition turned upside-down. May 8, 2019 at 14:05

Theoretically, this could be done by adapting the techniques used in a vocoder.

A vocoder works by measuring the amplitude of different frequency bands in a modulator signal (e.g. vocals), and then using that information to filter a carrier signal (e.g. a synthesizer sound), giving it a similar frequency spectrum as the modulator signal.

If you inverted the connections, you could control the low frequencies in the carrier signal with the high frequencies in the modulator signal, and vice versa. In fact, patching the connections in a non-linear way was a feature of some analog vocoders, like the EMS Vocoder 5000 from 1975 and the Moog 16-Channel Vocoder from 1979.

Moog 16-Channel Vocoder (1979) with frequency band switching patch bay (image from vintagesynth.com)

To achieve completely frequency-mirrored audio, you'd have to use white noise (which contains all frequencies) as the carrier signal, and you would need to have a lot more frequency bands than the dozen or so of a classic vocoder. Software vocoders like Reason's BV512 can have hundreds of bands, but you'd probably need thousands to achieve anything "realistic".

Even then, the result would not be music with mirrored note pitches. Every sound would have its component harmonics mirrored, and the result would be inharmonic and unrecognizable.

Harmonicity of frequency inversion vs. pitch inversion

While it is true that Frequency Inversion would preserve the distance between the harmonics in a note, the result would only be harmonic if the mirror frequency was itself a harmonic of the note. If you mirrored A4 (440Hz) around 2200Hz, you'd get these harmonics:

```HARM   FREQ    Finv   Hinv
1     440    3960     9
2     880    3520     8
3    1320    3080     7
4    1760    2640     6
5    2200    2200     5
6    2640    1760     4
7    3080    1320     3
8    3520     880     2
9    3960     440     1
10    4400       0     0
```

However, if you played a C5 (523.25Hz) mirrored around 2200Hz, you'd get these harmonically unrelated frequencies:

```HARM    FREQ       Finv
1     523.25    3876.75
2    1046.50    3353.50
3    1569.75    2830.25
4    2093.00    2307.00
5    2616.25    1783.75
6    3139.50    1260.50
7    3662.75     737.25
8    4186.00     214.00
9    4709.25    -309.25
10    5232.50    -832.50
```

So the result would only sound harmonic for some notes, much like the way in which the related effect of ring modulation sounds harmonic if there is a simple ratio between the two signals being modulated.

• "Every sound would have its component harmonics mirrored, and the result would be inharmonic and unrecognizable." This sounds plausible but now I'm wondering what that actually would sound like. Should be easy to create some samples of for example a flute. I guess I'll do that when I have time if nobody else volunteers.
– JiK
May 8, 2019 at 13:12
• @JiK You could try experimenting with the method in unfa's answer. May 8, 2019 at 13:49

I think what you're asking for is flipping the frequency spectrum of an audio file.

You could attempt that by:

1. Converting the audio file into a spectrogram bitmap
2. Flipping the spectrogram bitmap file
3. Resynthesizing the spectrogram bitmap into an audio file.

You should probably use the linear frequency scale for spectrograms. The results will be very strange - you will inevitably flip not only the notes themselves, but also the harmonic series of all notes, which is not something that can occur in nature.

• True, but you have to be careful about flipping ratios vs. flipping delta frequency May 8, 2019 at 13:04
• ARSS has been superceded by Photosounder, the documentation of which promises "pitch inversion". photosounder.com May 8, 2019 at 13:57
• Yes, but Photosounder is not free software, like ARSS is.
– unfa
May 8, 2019 at 14:21
• Why use a linear frequency scale in particular? I would expect a log scale to have a better chance of sounding interesting, since then flipping would preserve intervals. May 8, 2019 at 18:23
• Note that the process you're describing, if using a linear scale, can actually be implemented without any Fourier decomposition at all. This is equivalent to ring modulation with a sine of the upper limit frequency and then filtering away the upper sideband of the heterodyne. May 8, 2019 at 21:54

Yes it can be done digitally, and someone's already done it, and written a blog post about how they did it, and uploaded some examples

William Tell Overture sounds absolutely incredible.

Posting this as an answer because I think it's better than the other examples given so far and a comment will get buried in the many other comments and lost.

• This is an actual practical example. Great!
– unfa
May 9, 2019 at 13:28
• Great find! The straightforwardly inverted examples indeed sound like ring modulation, but his further research into making it musically useful is incredible. May 9, 2019 at 17:06
• (I know an answer based almost entirely around an external link is usually frowned upon on SE but in this case it seemed appropriate to make an exception) May 9, 2019 at 21:16
• You could try to add a synopsis of the blog post, giving an overview of the techniques involved, so that the answer doesn't become meaningless if the link dies. That could make it a candidate for the accepted answer. May 10, 2019 at 4:24

No, there is no single-pass audio process that can invert notes or melodies. Something like Celemony Melodyn Studio could get you started by analyzing all the notes, and then maybe you could embark on a lengthy MIDI inversion process and then try to use the inverted MIDI to re-arrange the audio in Melodyn. That could take a long time.

• Actually, I'd say frequency shifting (not pitch shifting!) can do something that could be called melodic inversion, though it sounds really weird (as it also completely scrambles the overtones of each single note). May 8, 2019 at 4:03
• @leftaroundabout Is there any consumer software that does frequency shifting? May 8, 2019 at 4:09
• @YourUncleBob I'm not aware of any that does specifically frequency shifting, but the operation is mathematically related to ring modulation and indeed sounds almost as weird. May 8, 2019 at 4:18

From a mathematical perspective, it might be doable using Fourier series. (Mono) sound is just a mathematical function, basically saying how the speaker should move.

The Fourier series tells you how much there are of each frequency. One could do some type of inverting around say, A, (440hz), and map each frequency 440+F to 440-F, or, as a function, f(F) = 880-F. That is, the coefficient of cos(n x) is mapped to the coefficient of cos((880-n)x).

If this makes sense from a musical perspective, I don't know. As people mentioned, one should perhaps consider some log scaling.

It is indeed possible, using some old-school analog techniques. But probably not practical unless you are very much an electronics type. The principle sounds a lot like the vocoder described by @Your Uncle Bob, although not nearly as complicated. Basically the audio is subtracted from a fixed carrier frequency and the difference is what you hear. As pitch goes up, the resulting pitch goes down. One possible flaw is that the chosen carrier frequency can add an offset to the pitch, and if there's an fixed offset added to the pitch,then the intervals won't be correct. Then it sounds even stranger, because the harmonics (overtones) won't have the proper intervals, either. Also consider that the overtones will be lower, not higher, adding to the strangeness. That much strangeness probably makes you want to try it!

The first time I tried this was using a pair of ham radios (I won't explain that one). The second one was a project from an electronics magazine, effectively four diodes (the modulator) and two or three audio transformers. I think this was supposed to be a "voice scrambler". I have heard things called "scramblers" that appeared to do the same thing.

I think in today's world, it will be a lot more practical to use some of the computer-aided techniques cited in the other answers. But I had to point out that long ago, good ol' analog had its own bag of tricks.

This smacks of negative harmony, and I highly recommend you read that post. It's very informative, and one of the processes involved in that discussion is essentially inverting a song about an arbitrary axis, which seems to be what you want. However, though this is possible, I don't know of any software to do it for you, and generally this is a (rather rare) conceptual device used by musicians and applied to music, not just an algorithm that gets applied to existing sheet music to get a new result.