HNHacker News
TopNewBestAskShowJobs

ssfrr

463 karma · joined February 3, 2014

spencer@heavisideresearch.com https://heavisideresearch.com
submissionscomments
ssfrr··on SBCL: New in Version 2.2.1
Is your inner audio processing loop implemented in CL? What kind of real-time guarantees does it provide?
ssfrr··on Hotcaml: An OCaml interpreter with watching and reloading
I’ve been learning OCaml over the past week or two and these videos have been extremely helpful. They’re well-organized well-edited. Seems like a ton of work went into them.
ssfrr··on Left Alive And Unchanged: The Heaven’s Gate Website
1303789 (the wierdest flex).

It's wild that that number is wedged so deeply into my brain, like a lot of things that were on my mind as a teenager. Makes me want to make sure my kids are doing something worthwhile when they're that age (which I know is futile of course).

ssfrr··on Why can’t you design noise in frequency space?
But after you convolve in the time domain it will change the distribution, right? Every point in the convolved signal will be the sum of a bunch of points in the original signal multiplied by the kernel, which would make their distributions more gaussian, right?
ssfrr··on Why can’t you design noise in frequency space?
Sure for any specific signal x you can craft the corresponding signal X so that ifft(X)==x, but the idea here is to generate a random signal with certain properties (blue spectrum and uniformly-distributed time-domain values). This is the tricky bit.
ssfrr··on Why can’t you design noise in frequency space?
Does that approach end up with a uniform distribution if values in the time domain? That seemed like the difficult part here.
ssfrr··on Why can’t you design noise in frequency space?
Can you clarify? It’s not clear to me how to target a particular distribution in time and frequency domain simultaneously.
ssfrr··on Why can’t you design noise in frequency space?
The goal is not well-defined here. If the goal is to generate uniformly-distributed points in a circle then this algorithm is wrong, but it’s not clear that’s actually what they want.

Generating a spectrum with a given magnitude distribution and uniform phase distribution is pretty common (at least in audio).

ssfrr··on Why can’t you design noise in frequency space?
I wonder if there’s some iterative algorithm that would work here.

When synthesizing audio from the short-time Fourier transform (STFT) sometimes you have unknown or noisy phase, and there’s an algorithm called Griffey-Lim that’s pretty common for finding the corresponding time-domain signal. You start in the STFT-domain and continually swap between time and STFT domains, each time fixing the STFT magnitudes. Eventually the phase tends to converge (but not sure if that’s guaranteed).

Maybe there’s something similar here where you keep swapping back and forth while applying the blue spectrum and uniform sample histogram constraints (or partially applying them in a gradient-descent fashion).

(Side note that there are other/better phase estimation algos for this problem, but Griffin-Lim is simple and relatively common)

ssfrr··on Why can’t you design noise in frequency space?
Yeah I think that uniform time(space)—domain distribution constraint is the one that the author identifies as the main problem here.
ssfrr··on Why can’t you design noise in frequency space?
The goal is to generate a random spectrum that corresponds to a real-valued signal. If the positive and negative frequencies aren’t conjugate-symmetric then the resulting signal after the IDFT will be complex-valued.

You can think of it in terms of degrees of freedom. A real-valued length-N signal has N degrees of freedom. A length-N spectrum is complex-valued, meaning 2 degrees of freedom per frequency bin. When you constrain it to be conjugate-symmetric you bring the degrees of freedom back to N, which matches the real-valued signal.

ssfrr··on Why can’t you design noise in frequency space?
The author is sampling random magnitude and also random phase for each frequency bin, so I don’t think anything is missed here.
ssfrr··on My dead dad’s journal
Most people don’t killed by bears. It’s not because they are somehow strong enough to beat a bear in a fight, it’s because they don’t get attacked by bears.
ssfrr··on Elk OS – Audio Operating System
I stand corrected - thanks for the clarification.
ssfrr··on Elk OS – Audio Operating System
rule of thumb is that sound travels roughly 1ft per ms, so 5ms is the same as standing 5 extra feet from the speaker. Most musicians don't have much trouble up to around 10-20ms.

Jitter is killer though - if the latency is randomly changing it's really annoying.

ssfrr··on Elk OS – Audio Operating System
Reminds me a lot of the Bela project [1]. The idea is that they expose the raw audio device interrupt handler so applications can do DSP processing without the kernel being involved at all. Wonder if this is doing something similar?

[1] https://bela.io/

ssfrr··on Show HN: I reverse engineered my cable modem and turned it into an SDR
Super cool hack and great write up. It’s nice to see this go all the way from poking at hardware to decompiling binaries and then some signal processing. Kudos.

You mentioned you were getting distortion/noise when downsampling below 928kHz. Are you lowpass-filtering before you decimate (but after you demodulate)? Otherwise you will get all kinds of aliasing.

Looks like FM radio stations have a bandwidth of 200kHz so you should be able to lowpass with a cutoff of around 50kHz then decimate to 232kHz.

ssfrr··on Sine-wave speech audio encoding
I love this demo. It’s a good example of how much our perception is affected by our priors.

This is a other great example, where speech is synthesized with an acoustic piano (though the keys are controlled digitally, the sound is just from the hammers and strings). Without the subtitles you probably couldn’t understand, but it sounds pretty clear when you know what it’s saying already.

https://youtu.be/muCPjK4nGY4

ssfrr··on Show HN: Sound visualisation, better than FFT (iOS)
Really nice visualizations - they feel really snappy. I really like in the linear visualization how you can see the kick drum hits move down the spectrum!
ssfrr··on Show HN: Sound visualisation, better than FFT (iOS)
I'd definitely love to hear more about your technique once you're willing to say more about it. I'm really interested in time-frequency representations in general.

One way to get high frequency resolution from the STFT or Wavelet transform is to use the phase derivative within each frequency band, which is usually called "instantaneous frequency", and is closely-related to the phase-vocoder (different from the daft-punk-famous vocoder).

The main issue with this kind of instantaneous phase estimate is that it assumes there's only one dominant frequency within each band - does your method improve on that?

ssfrr··on Show HN: Sound visualisation, better than FFT (iOS)
When folks say spectrogram they usually mean the magnitudes or power of the STFT, so as you say, it throws away the phase.

I would say that the spectrogram is a visualization of the STFT magnitudes, in the same way that a line plot is a visualization of the FFT magnitudes. The STFT and FFT are both invertible though.

ssfrr··on Show HN: Sound visualisation, better than FFT (iOS)
The difficulty he's describing also applies to wavelet transforms: higher frequency bands have wider bandwidth, so they need to be sampled more often. This means the resolution is different in different frequency bands. With the short-time fourier transform (STFT), which is widely used in Music Information Retrieval, each frequency band has the same bandwidth and is sampled at the same rate, so the output of the transform is a rectangular matrix. With a wavelet transform the output is sort of a trapezoid, because you have more samples in higher frequencies.

In both cases though it's possible to losslessly round-trip the audio within numerical precision (neither the STFT nor the Wavelet transform lose information).

ssfrr··on K Language (2011)
Another thing about that code that I think irks some folks but is also reminds me of reading math is that it's much easier if you are aware of some common conventions and notation. For instance, the lines:

    #define V1(f) A f(w)A w;
    #define V2(f) A f(a,w)A a,w;
Are much more quickly recognizable if you know that in APL the left and right arguments to a function are alpha (α) and omega (ω), so you'd immediately recognize these macros as for defining 1-argument and 2-argument functions.

For folks in the know, conventions like this allow quicker communication and expression, but they also raise the barrier somewhat to the uninitiated.

Side note for folks used to "modern" (post 1989) C code - this is old K&R style function definition. This SO post (https://stackoverflow.com/a/3092074) shows a comparison.

ssfrr··on K Language (2011)
This should apply to any high-level glue language that's wrapping primitives implemented in a "fast" language, right? I'm thinking in particular something like python with numpy. As long as most of the work is done within the primitives I would think they'd be pretty comparable.

Is there something about the primitives that APL-derivitives provide that mean that more of your program can happen inside the primitives so the interpreter is doing less work?

I'm also curious how the performance compares against something like Julia, which is JIT compiled so you avoid the distinction between the high-level and low-level code. Seems like a rather different region of the high-performance design space.

edit: also how does this relate to the "the whole interpreter fits in the cache" explanation that's also widely-invoked to explain K's speed? It seems like if you're spending most of your time in the primitives than the interpreter time doesn't matter. Maybe it's a combination of both - K and friends encourage you to organize your program in ways that support burning through data quickly, and additionally when the interpreter is operating it's a particularly fast interpreter?

ssfrr··on K Language (2011)
> What interpreters such as GNU APL does is to first evaluate b+c, resulting in a new array, and then add that result to a.

Is this really what most implementations would do? I'd assume it would parse the expression `a+b+c` into a tree like

     +
    / \
   a   +
      / \
     b   c
But then run a pass on the tree to identify expressions like this that could be fused together without creating intermediate results. I know that most APL implementations have more efficient implementations of certain idioms (commonly-used sequences of operators/functions), so I figured they must be doing something like this to be able to identify those idioms.

This is just conjecture though, I'd love to know more about how this actually works in practice.

ssfrr··on Ask HN: Are books worth it?
A lot of useful ideas are pretty timeless, and for learning fundamental technical content, a _good_ book is worlds better than a collection of blog posts and wikipedia pages. I remember when I was learning about quaternion math, I spent a few days googling around, but often different authors would use different notational conventions, or have different assumptions (e.g. whether the coordinate system is right or left-handed), so the math would be subtly different. Not to mention the ones that were just flat-out wrong.

So I went to the library, browsed through several books to find one that seemed most relevant, and ended up checking out "Quaternions and Rotation Sequences" from J Kuipers. Having a single well-thought-out book that walked from the basic background all the way through, with consistent notation, was way easier to follow than the scattershot collection I'd found online.

So in general I'd say if you're optimizing for the most up-to-date information on a subject that's changing quickly, looking online is probably your best bet. If you want to learn something more foundational and can find a good book about it, I'd definitely go for that.

ssfrr··on Apple's New Privacy Page
I think the issue is that an Apple ID is used for multiple things (iCloud backup, the app store, etc.), and also that the seamlessness of SMS/iMessage (usually a good thing) causes them to be conflated.

This person doesn't use their Apple ID for communication, because they have an Android phone. They probably purchased an iPhone for their child and set up the Apple ID using their email address. So to clarify, they weren't using their Apple ID with multiple devices, they just set up their child's Apple ID using their email address.

I'm not trying to slam Apple here, it's a complicated issue. I'm just saying that through a sequence of pretty reasonable steps we ended up in a situation where I was texting a colleague's daughter. Fortunately they were about parking my car, but it was pretty weird regardless.

edit: I guess they may use their Apple ID on their laptop as well, so it is on multiple devices. I just don't think they use it for iMessage.

ssfrr··on Apple's New Privacy Page
This was last week. It seems like the same mechanism though, if the phone is still tied to their Apple ID.
ssfrr··on Apple's New Privacy Page
My intended recipient doesn't actually have an iPhone (but I didn't know that at the time). In my contacts I have both their phone number and their email address, and I'm assuming that email is what's associated with their Apple ID.

I normally don't pay much attention to whether a message is being sent out over iMessage or SMS, and less technical folks probably pay even less, so it's a bad situation when those two methods end up going to different people.

That said, I'm actually not sure what the best behavior for iOS would be here - I get that they want to use the "best" transport and send over iMessage rather than SMS if it's available. Ideally there would be some kind of warning if the phone number I have in my contacts doesn't match the one on the device that's going to receive the message, but that seems finicky as well (what if I only have their land-line?).

ssfrr··on Apple's New Privacy Page
"Messages are only seen by who you send them to." - Unless that person shares an Apple ID with someone else.

I recently sent an iMessage and got a "who is this?" response. Turns out the message went to one of their family members.

I guess they shouldn't be sharing an Apple ID, but I don't think it's a super crazy thing to do among family members (e.g. a parent who provides a phone for their child), and having private text messages go to the wrong person seems like a pretty bad failure mode.

← PreviousPage 3 of 5Next →