How do I record a sound and then play its reversed version?

  • $\begingroup$ Do you want to Record it with Mathematica or are you fine with importing the sound? $\endgroup$ – Vahagn Tumanyan Sep 7 '16 at 7:48
  • 5
    $\begingroup$ There are no hidden messages in Beatles records $\endgroup$ – Mike Honeychurch Sep 7 '16 at 9:45
  • $\begingroup$ importing is fine $\endgroup$ – Reza Naderi Sep 8 '16 at 8:20
  • $\begingroup$ This post have discuss the first question about how to record. $\endgroup$ – yode Oct 2 '16 at 17:19
  • $\begingroup$ @Mikehoneychurch Actually there is at least one. If the runout track on one side of Sgt Pepper vinyl is played backwards it says "Paul McCartney is dead" I have the LP and have done this. $\endgroup$ – Julian Moore Oct 3 '16 at 6:25

In version 11, *.wav files are now imported as Audio[] objects. Thus, using glS's example:

s = Import["ExampleData/rule30.wav"];

click to hear

So that people who were hoping to hear actual backmasking would not be disappointed, let me give another example: the opening theme from the Disney animated series Gravity Falls. Using the last 5 seconds of the theme:

gf5 = Import["https://a.clyp.it/1mftdou4.mp3"];

As this is a stereo (two-channel) sound file, Reverse[] has to be mapped across the two channels:

Audio[Reverse /@ AudioData[gf5]];

click to listen

You should be hearing something like "three letters back" being whispered.

| improve this answer | |
  • $\begingroup$ the link to the audio file is broken! $\endgroup$ – glS Jun 15 '17 at 17:41
  • $\begingroup$ @glS, unfortunately Clyp seems to have changed its policies regarding anonymous uploads and the length of their validity. I'll ping you when I can find a more suitable host. $\endgroup$ – J. M.'s technical difficulties Jul 26 '17 at 4:51

Let's first try with a sound sample from MMA examples repository:

s = Import["ExampleData/rule30.wav"]

A FullForm of s reveals that this object has the structure Sound[SampledSoundList[{listOfSounds},samplesRate]]. From this it looks like to play the sound in reverse we just need to Reverse listOfSounds, which we can do for example like this:

s /. SampledSoundList[{soundsList_}, r_] :> SampledSoundList[{Reverse@soundsList}, r]

Let's wrap this up in a function:

playInReverse[Sound[SampledSoundList[{soundsList_}, r_]]] := Sound[
   SampledSoundList[{Reverse@soundsList}, r]
playInReverse[Sound[SampledSoundList[{soundsLists__}, r_]]] := Sound[
    Reverse /@ {soundsLists},

where I used a very specific pattern assignment because this method works only for that specific structure of a Sound object, and the second assignment rule is for tracks over more than one channel.

Here you can see how it works:

enter image description here

The exact same procedure works with sounds recorded from inside Mathematica. See for example this answer for some methods to record sound. A simple way is to use SystemDialogInput["RecordSound"], which brings up a dialog to record the sound. The generated object is exactly of the form mentioned above, so that you can use


to record a sound and have it directly reversed.

Just for the heck of it, I tried this with a Beatles song (Yesterday) in mp3 format, and it works (no hidden messages though).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.