News for hackers. Stuff that matters.

cochlear

Funny, I guess this idea is in the air (har har).

I've made a couple things along these lines over the past year. One is a fun, Halloween-themed toy:

https://blog.cochlea.xyz/theremin.html

The other is a (slightly) more serious exploration of multivariate time signals as a control signal for an instrument. In the latter case, the instrument is learned/inferred from a segment of input audio:

https://blog.cochlea.xyz/resonancemodel.html

This is a really neat idea! Like others here, I'm not a huge fan of the hyper-dense and dripping-with-ai UI, though.

Show HN: Theremin with MediaPipe and WebAudio

https://blog.cochlea.xyz/theremin.html

As a fun, Halloween-y exercise, I've taken a break from some of the other hand-tracking-based WebAudio instruments I'm working on to make something simple and easy: A MediaPipe + WebAudio theremin-like instrument you can play with in your browser.What's a Theremin?https://en.wikipedia.org/wiki/ThereminMediaPipe Hand-Tracking...

( Read More... | no comments | on HN )

Show HN: RNN Musical Instrument

https://blog.cochlea.xyz/rnn-instrument.html

In this small demo, I first overfit a single-layer RNN, decomposing a short segment of classical music into two "factors":- a sparse "control signal", something like a score, representing the injection of energy into the system or instrument(s) - an RNN which models the resonances of the instrument(s) being playedFinally, hand-tracking landmarks (thanks to MediaPipe) are mapped onto the RNN's...

( Read More... | no comments | on HN )
Re:Show HN: Web Audio Spring-Mass Synthesis on Saturday March 15, 2025 @06:15AM (#43371463)
You're the author of Glicol, right? I've definitely had my eye on trying it out for a while. The karplus-stress-tester is great; I'm currently using message ports, because they seemed most accessible at first, but I'm happy to know there are other, and better options. I have done quite a bit of hand-optimizing of the code here, and while I think there's probably juice left to squeeze, it has become apparent to me that wasm is probably my next stop.

I've written one other AudioWorklet at this point, which just runs "inference" on a single-layer RNN given a pre-trained set of weights: https://blog.cochlea.xyz/rnn.html. It has similarly mediocre performance.

Thanks for all the great tips, and for your work on Glicol!

Re:Show HN: Web Audio Spring-Mass Synthesis on Saturday March 15, 2025 @05:58AM (#43371388)
How funny, I actually corresponded with one of the authors of the "Spiking Music..." paper when it first showed up on arxiv. I'll definitely give the amp-modeling paper a read, looks to be right up my alley!

Now that I understand the basics of how this works, I'd like to use a (much) more efficient version of the simulation as an infinite-dataset generator and try to learn a neural operator, or NERF like model that, given a spring mesh configuration, a sparse control signal, and a time, can produce an approximation of the simulation in a parallel and sample-rate-independent manner. This also (maybe) opens the door to spatial audio, such that you could approximate sound-pressure levels at a particular point in time _and_ space. At this point, I'm just dreaming out-loud a bit.

Re:Show HN: Web Audio Spring-Mass Synthesis on Saturday March 15, 2025 @05:40AM (#43371313)
Thanks for the bug report, I'll look into this and see if I can make it better! There's definitely more optimization juice to be squeezed, I think, and it'd probably be smart to allow the number of nodes in the simulation to be adjusted.

Working with AudioWorklets (https://developer.mozilla.org/en-US/docs/Web/API/AudioWorkle...) has been really cool, and I've been surprised at what's possible, but I _haven't_ yet figured out how to get good feedback about when the custom processor node is "falling behind" in terms of not delivering the next buffer quickly enough.

Re:Show HN: Web Audio Spring-Mass Synthesis on Saturday March 15, 2025 @05:34AM (#43371292)
Same here! Not a physics engine per se, but I've been eyeing Taichi Lang (https://github.com/taichi-dev/taichi) as a potential next stop for running this on a much larger scale.

My assumption has been that any physics engine that does soft-body physics would work in this regard, just at a much higher sampling rate than one would normally use in a gaming scenario. This simulation is actually only running at 22050hz, rather than today's standard 44100hz sampling rate.

Re:Show HN: Web Audio Spring-Mass Synthesis on Saturday March 15, 2025 @05:28AM (#43371264)
Thanks for the bug report, I definitely do see now that things fall apart at certain extreme values. I'll look into it and see if I can fix. My assumption is that it's some sort of numeric overflow or underflow resulting in NaN values, and that I'll probably just need to set the slider boundaries more carefully. Thanks again!

Show HN: Web Audio Spring-Mass Synthesis

https://blog.cochlea.xyz/string.html

Hi, I'm the author of this little Web Audio toy which does physical modeling synthesis using a simple spring-mass system.My current area of research is in sparse, event-based encodings of musical audio (https://blog.cochlea.xyz/sparse-interpretable-audio-codec-pa...). I'm very interested in decomposing audio signals into a description of the "system" (e.g., room, instrument, vocal tract, etc.)...

( Read More... | 17 comments | 7 points | on HN )
Re:Toward a Sparse Interpretable Audio Codec on Monday February 03, 2025 @08:27AM (#42917983)
These are both great points and I'll use them to refine my writing on the subject, I appreciate the feedback!

Apologies if it isn't clear, but the animated gifs are meant as an illustration of the iterative encoding process, where the encoder decomposes the signal step-by-step, as in matching pursuit. I'll be sure to clarify that point.

I'll add a paragraph on compression rates/ratios, although that isn't necessarily the main focus here; codecs may compress a signal, but they might also transform it into a more useful, easy-to-understand and easy-to-manipulate representation.

I couldn't agree more. I feel that the block-coding and rasterized approaches that are ubiquitous in audio codecs (even the modern "neural" ones) are a dead-end for the fine-grained control that musicians will want. They're just fine for text-to-music interfaces of course.

I'm working on a sparse audio codec that's mostly focused on "natural" sounds at the moment, and uses some (very roughly) physics-based assumptions to promote a sparse representation.

https://blog.cochlea.xyz/sparse-interpretable-audio-codec-pa...

Show HN: Musical Events Scatterplot

https://blog.cochlea.xyz/scatter.html

In the process of working on models that decompose audio into sparse representations, I've found that it can be fun to explore the space of possible musical events that the learned decoders can produce. Most modern "neural" codecs encode fixed-size "frames" of audio. This work models sound as a sparse set of events and physical resonances, which could yield benefits for compression,...

( Read More... | no comments | on HN )
Re:Long Convolutions via Polynomial Multiplication on Tuesday December 10, 2024 @10:35AM (#42377804)
I think I'm beginning to wrap my head around the way modern, "deep" state-space models (e.g Mamba, S4, etc.) leverage polynomial multiplication to speed up very long convolutions.

I'm curious if there are other methods for approximating long convolutions that are well-known or widely-used, outside of overlap-add and overlap-save? I'm in the audio field and interested in learning long _FIR_ filters to describe the resonances of physical objects, like instruments, or rooms. Block-coding, or fixed-frame size approaches reign supreme, of course, but have their own issues in terms of windowing artifacts, etc.

I'm definitely aware that multiplication in the (complex) frequency domain is equivalent to convolution in the time domain and that, because of the fast-fourier transform, this can yield increased efficiency. However, this still results in storing a lot of gradient information that my intuition tells me (possibly incorrectly) is full of redundancy and waste.

Stateful, IIR, or auto-regressive approaches are _one_ obvious answer, but this changes the game in terms of training and inference parallelization.

A couple ideas I've considered, but have not yet tried, or looked too deeply into:

- First performing PCA in the complex frequency domain, reducing the point-wise multiplication that must occur. Without some additional normalization up-front, it's likely this would be equivalent to downsampling/low-pass filtering and performing the convolution there. The learnable filter bank would live in the PCA space, reducing the overall number of learned parameters.

- A Compressed Sensing inspired approach, where we perform a sparse, sub-sampled random set of points from both signals and recover the full result based on the assumption that both convolver and convolvee? are sparse in the fourier domain. This one is pretty half-baked.

I'd love to hear about papers you've read, or thoughts you've had about this problem.

Re: on Saturday December 07, 2024 @10:01AM (#42350207)
I'm working on building models that extract sparse and easy-to-interpret representations of musical audio. The work in this post encodes short segments of music from the MusicNet dataset as a set of events with a time-of-occurrence and a low-dimensional vector representing attack envelopes and resonances of both the instrument being played and the room in which the performance occurred. I think this representation could prove superior to current block-coding (fixed-frame sizes) and text-based generation models, at least for musicians who need fine-grained control of generated audio.