Live data from Hacker News

A hidden gem in sound symmetry

soundshader.github.io

41–50 of 54 posts

Re: A hidden gem in sound symmetry

#41
post #5
post #3

Earlier quoted context omitted.

I'm guessing that triple correlation could also be rendered into pretty pictures, did you try that?

Heh, you're reading my mind. Try the URL below, but don't increase fps/n params, as that will eat all your GPU cycles very quickly: soundshader.github.io/?s=acf3&n=512&fps=1&acf.decay=0 It effectively computes the bispectrum as B(p, q) = F(p)F(q)F^(p+q) and runs the inverse 2D FFT to restore the triple autocorrelation. The results are interesting, but not impressive and very GPU intensive (NxNxlog(N) per frame is slo…

Cool! Maybe it's because it contains phase information which is not that relevant to hearing. FWIW I remember long time ago using it for image processing and the trick was to look at a sections of it, i.e. TC(p1, p2) where one of p1 or p2 was fixed.

Re: A hidden gem in sound symmetry

#42
I've been playing some music on the livedemo. I like it a lot. The harmony changes are easy to see as concentric slices slighty rotated. On heavy drum music the rythm also leaves a trail of spaced circles easy to recognize. You might be onto something here. Colored waveforms, like those used in djing software, might be better for locating a point in a song, but I've never been able to locate a chord change on those based on the waveform representation alone. I would totally love to try to "mix" some of those mandalas, or try an editor software using this visualization where I can move around a virtual needle, copy paste slices, etc. Not saying It will be better than using a waveform, but I would experiment with it given the chance.

Very nice job, congratulations!

Re: A hidden gem in sound symmetry

#43
post #39

Earlier quoted context omitted.

Surprisingly, I stumbled across a result that seemed similar yet weirdly different: https://twitter.com/theshawwn/status/1176070857468329984?s=2... I take the FFT of the phase component, which is very similar to ACF; it’s the FFT of an FFT, but preserves phase. It even takes abs(), which might be mostly equivalent to your squaring operation. Weird. I am really not trying to claim that I discovered ACF — quite the opp…

Interesting. Figuring out the phase problem is one of my biggest TODO items. How did you compute FFT of the phase? The thing is, phase is discontinuous or multivalued function if we represent phase as a real number. We could also represent phase as a complex number of unit magnitude: exp(i phi). It would be continuous, but complex-valued. And phase is indeed important for hearing: https://auditoryneuroscience.com/voc…

You're in luck -- I managed to dig up my WIP notes from a year ago.

https://imgur.com/xLcvLIm

As you can see, the raw phase waveform is very "wavy", as might be expected. It oscillates rapidly, making it hard to see the patterns. But if you go to the tweets I linked above, you'll see the phase is much smoother in those images. How did I do it?

The key is to focus on every other line. Notice that if you simply pay attention to every odd row, it will be smooth.

I think I simply did "row 0, row 2, row 4, ... row n" followed by "row 1, row 3, row 5, ... row n + 1"

As for the fft of the fft trick for phase, I'm rsync'ing all of my old code and demo images to here:

https://battle.shawwn.com/sdb/voicecloning/

You may be interested in the png images, in particular the ones with "phase" in the names. You can probably ignore all the code except repl2.py.

Those images were generated via unknown methods -- sadly my repl sessions weren't saved. But, I happened to write down in repl2.py how the tweet images were generated:

  cv2.imwrite(os.path.expanduser("~/Downloads/mel-phase-spectrogram-phase-fft-abs.png"), np.abs(np.fft.fft2(-1+2*1/255*cv2.imread(os.path.expanduser("~/Downloads/mel-phase-spectrogram-phase.png")))))

  cv2.imwrite(os.path.expanduser("~/Downloads/mel-phase-spectrogram-phase-fft-abs2.png"), -1+2.0*np.abs(np.fft.fft2(-1+2*1/255*cv2.imread(os.path.expanduser("~/Downloads/mel-phase-spectrogram-phase.png")))))
So, input: https://battle.shawwn.com/sdb/voicecloning/mel-phase-spectro...

Then, using the code above, the result: https://battle.shawwn.com/sdb/voicecloning/mel-phase-spectro...

I've verified that it still works. I think you can wget those images and copy-paste that code into a python repl.

So the only remaining question is, how was mel-phase-spectrogram-phase.png generated? Unfortunately that seems to be lost with the sands of time. But, as a hint, I think it was simply a matter of turning the phase component into x,y using atan2, then turning it into blue and red.

Also, completely unrelated, but I once made a super high resolution mel spectrogram that looked way cool and I can't resist showing it off: https://battle.shawwn.com/sdb/voicecloning/ultra-mel.png

I did all this when making 'Dr Kleiner sings "I Am the Very Model of a Modern Major General"' around a year ago.

https://www.youtube.com/watch?v=koU3L7WBz_s&ab_channel=Shawn...

Kinda funny that all of this visualization work was just to make memes, but the quest to meme turns out to be surprisingly motivating.

https://battle.shawwn.com/sdb/voicecloning/demo_output_101.w...

https://battle.shawwn.com/sdb/voicecloning/demo_output_75.wa...

Anyway, I think there's a lot left to discover in terms of audio visualization! I would definitely encourage you to play around with the phase component. The results can be pretty striking, as you can see from the "Result" image above (https://battle.shawwn.com/sdb/voicecloning/mel-phase-spectro...).

Sorry for the scattered explanation -- it's 4am here, but I wanted to give you some kind of writeup, even if it's rather disjointed. If you have more questions, be sure to ask! I can give better details tomorrow.

Re: A hidden gem in sound symmetry

#44
post #2

Hi HN, author here. A few comments on how I came up with this idea. I've been trying to find a "proper" connection between audible sound and visible shape, a connection that would not only preserve all the information, but would also properly visualize the "symmetry" in sound, so that messy sound would turn into messy images and harmonic sound would turn into visually appealing images. The latter part is hard, as per…

Probably not related at all, but this reminded me of the Fourier-Mellin transformation, of which a nice overview can be found here[1], used for image registration.

Images are Fourier transformed, and the result is transformed to log-polar coordinates. This turns rotation and scaling in the source image into translations in the resulting log-polar data.

Anyway, fun stuff, thanks for the share!

[1]: https://sthoduka.github.io/imreg_fmt/ (follow link to the pipeline description)

Re: A hidden gem in sound symmetry

#46
Interesting maths. I'm enjoying the graphics, they are beautiful to watch unfold, but bear little relation to the full range that is heard in the audio examples. Not in volume, or varying pitch. This technique seems to be a way of showing an aspect of sound via graphics that mean the two are unrelated in immediately meaningful ways. The word 'Periodic' is mentioned, but that isn't seen.

Still, great experiment, and interesting results!

Re: A hidden gem in sound symmetry

#47
post #11

Earlier quoted context omitted.

In your example saying that the ear doesn’t work as an FFT, I think you’re confusing physical processes (the ear) with perceptual processes (psychoacoustics and interaction between the brain and ear). The cochlea itself is a physical FT, based on resonances in the thickness at various points. That gets passed to the brain as basically sine-frequency data. The autocorrelation part comes in when the brain processes thi…

IIRC, that's probably not quite true. It's been about a decade since I studied hearing, but my understanding is that the idea of the cochlea being a physical FT (e.g. the place theory of hearing) doesn't explain some phenomena, which also probably aren't psychoacoustic. https://en.m.wikipedia.org/wiki/Temporal_theory_(hearing)

I'll read more about it, but the thickness/stiffness of the cochlea resonates at frequencies with sensitivity that matches our ability to distinguish frequencies - it has been removed from the inner ear and resonance tested outside of the context of other processes. Interesting that it doesn't explain some phenomena, but are the temporal theory and place theory mutually exclusive?

(Edit) After reading a bit more, it seems to make more sense that it's a combination of both, as the resonance on the cochlea is likely not 100% accurate, and conversely the impulses from peaks would tend to be around the areas of resonance, so rather than being mutually exclusive it makes sense these two effects work in parallel.

  Modern research suggests that the perception of pitch depends on both the places and patterns of neuron firings. Place theory may be dominant for higher frequencies.[4] However, it is also suggested that place theory may be dominant for low, resolved frequency harmonics, and that temporal theory may be dominant for high, unresolved frequency harmonics.[5]

Re: A hidden gem in sound symmetry

#48
post #26
post #25

Earlier quoted context omitted.

I checked the live demo with some music. I was expecting something different and maybe you agree that it would be a better visualization. Right now, the visual experience is like watching movement through a high-speed tunnel. I was expecting the "mandala" you mentioned in the sense that the end result is the accumulated visualization of all waves. The sound representation would not disappear out of the borders. The f…

If you're on desktop, try moving your mouse vertically. "Up" seems to zoom in, and "Down" zooms out. Fully zoomed-out, I think it's closer to what you expected to see.

That's it! Thanks for the tip

Re: A hidden gem in sound symmetry

#49
post #45

Very great work. I'm also interested to see this patterns "unrolled". Not on a circle but on timeline (like spectrogram). Where x-axis is time and y-axis is unrolled pattern (0..2pi).

You can press "c" to switch to flat coordinates. Edit: or add ?acf.polar=0 to the URL.
Post reply on HN