Faust script that makes music sound like it’s being played in another room

, updated , updated , updated

Demo

Drag a file or URL* here.

*Help with URLs

URLs work only if the remote server allows cross-origin resource sharing (CORS) with an Access-Control-Allow-Origin header. Audio files (e.g. .mp3 and .ogg) from archive.org can be used directly. Click the “SHOW ALL” link on an archive.org details page and find a link that contains “/download/”, like this for example:

https://archive.org/download/DistortedNocturne/distorted%20nocturne.ogg

Video files (e.g. .mp4 and .ogv) from archive.org don't work directly. You have to transform the “/download/” URL into a “/cors/” URL. If you have a download URL like this:

https://archive.org/download/THE_BEATLES_Help_1965/THE_BEATLES_Help_1965.ogv

You have to change the bolded parts, then it will work:

https://cors.archive.org/cors/THE_BEATLES_Help_1965/THE_BEATLES_Help_1965.ogv

The audio processing is being done totally in JavaScript on the client side. Local files aren’t being uploaded anywhere; your browser is just accessing them and processing them locally. This is possible because Faust supports compiling to asm.js. Click “Toggle effect” to turn the effect on and off.

Premade samples

Meghan Trainor “Me Too” played in another room.

New Order “Blue Monday” played in another room.

M the Myth “One Night” played in another room.

The Killers “Mr. Brightside” but every 20 seconds it gets a room farther away, Alvin Lucier style. (Headphones recommended.)

Background

I read a nice article by Samantha Cole, “Songs Edited To Sound Like They’re Playing In Another Room Are Inexplicably Emotional.” The article links to a tutorial [dead link as of ] by bella on Tumblr that shows settings for Adobe Audition to create the “another room” effect.

Of course, I wouldn’t be caught dead using anything from Adobe. I'm sure you could create the same effect using free software like Audacity or Ardour. But coincidentally around the same time I was reading about Alex Chechile’s Ear Tone Toolbox which is written in Faust, a programming language I had never heard of.

Faust is made for signal processing and has a bunch of built-in audio filters. It’s a good candidate for implementing a filter like this.

The script

Download: anotherroom.dsp
git clone https://www.bamsoftware.com/git/faust-anotherroom.git

This is basically my “hello world” for Faust. It’s probably not good style. I just tried to include all the effects from bella’s tutorial: highpass/lowpass/equalizer, chorus/delay, reverb. I wasn’t sure what order to put all the filters in, but the results sound pretty good. However, you get some pretty pronounced artifacts when you run the filter repeatedly, which you can hear in the Mr. Brightside sample above.

import("stdfaust.lib");

// https://altmusicfromanotherroom.tumblr.com/post/164128319817/how-do-you-make-these
chorus = +~(de.fdelay1(0.0125 : ba.sec2samp : int, 0.0125 : ba.sec2samp)*0.028);
equalizer = fi.highpass(4, 49) : fi.lowpass(4, 849)
	: fi.low_shelf(6.1, 269) : fi.high_shelf(0, 19592)
	: fi.peak_eq_cq(0.5, 86, 2)
	: fi.peak_eq_cq(1.0, 130, 2)
	: fi.peak_eq_cq(3.5, 437, 2)
	: fi.peak_eq_cq(-22.2, 8990, 2)
	: fi.peak_eq_cq(0.0, 19592, 2);
reverber = re.mono_freeverb(0.5, 0.5, 0.5, int(ba.sec2samp(0.01)));
limiter = co.compressor_mono(10, -7.6, 0.0078, 0.086) : *(0.33);

process = *(0.5),*(0.5) : + : chorus : equalizer : reverber : limiter;

Faust can compile to many formats, including JavaScript, which is how the live demo works. I used faust2webaudioasm and manually extracted the Web Audio parts. This is what it looks like compiled: anotherroom.asm.js.