Live data from Hacker News

A hidden gem in sound symmetry

soundshader.github.io

51–54 of 54 posts

Re: A hidden gem in sound symmetry

#52
post #24

Earlier quoted context omitted.

Why the slowdown? (given that slowdown typically introduces artifacting, making the result as much a pattern of those artifacts as it is of the original signal) (also note that your site does not currently work in Firefox, which would be nice to fix)

It's just a random sound sample I found on freesound. The demo works on Firefox 78, Ubuntu. However you'd have to set correct sample rate with ?sr=44.1 to match the mp3's sample rate: Firefox won't do resampling.

Fun fact, I ran into the esampling problem myself back in April when I posted https://github.com/WebAudio/web-audio-api/issues/30, V2 of the spec will allow this natively, but it also not seemingly making any headway towards initial release so who knows when it'll land...

What you can do though is look at the first few bytes of an .mp3 file (since it's a file drop/file load) to just directly read the sample rate from the MP3 block header[1], where you directly check the value encoded by [data[19], data[20]]: if it's [0,0] that means it's 44100, [0,1] means it's 48000, [1,0] means it's 32000 and that's it. There are no other sample rates allowed for MP3.

[1] http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html for the full block format)

Re: A hidden gem in sound symmetry

#53
post #24

Earlier quoted context omitted.

It's just a random sound sample I found on freesound. The demo works on Firefox 78, Ubuntu. However you'd have to set correct sample rate with ?sr=44.1 to match the mp3's sample rate: Firefox won't do resampling.

Fun fact, I ran into the esampling problem myself back in April when I posted https://github.com/WebAudio/web-audio-api/issues/30 , V2 of the spec will allow this natively, but it also not seemingly making any headway towards initial release so who knows when it'll land... What you can do though is look at the first few bytes of an .mp3 file (since it's a file drop/file load) to just directly read the sample rate fro…

Thanks for the note! I've been wanting to auto-detect the sample rate.

Re: A hidden gem in sound symmetry

#54
post #39

Earlier quoted context omitted.

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 att…

Thanks for the notes! Another idea I've been thinking about is to capture the phase by splitting ACF into multiple complementary parts at the spectral density step, i.e. when we draw the spectrogram, we use |r exp(i phi)|^2 of the FFT output and that |...|^2 drops the phi. However, we could split this |...|^2 into a sum of a few terms that would add up to the same spectral density, but would separately capture the phase. In the simplest case, |x + iy|^2 = x^2 + y^2, can be interpreted as two half-spectrograms: one for x^2 and another for y^2. If colored the same, we'd get the original spectrogram, but if colored differently, we'd know values of x^2 and y^2 and that's enough to know the phase up to a quadrant.
Post reply on HN