9
$\begingroup$

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

$\endgroup$
5
  • $\begingroup$ Do you want to Record it with Mathematica or are you fine with importing the sound? $\endgroup$ Commented Sep 7, 2016 at 7:48
  • 6
    $\begingroup$ There are no hidden messages in Beatles records $\endgroup$ Commented Sep 7, 2016 at 9:45
  • $\begingroup$ importing is fine $\endgroup$ Commented Sep 8, 2016 at 8:20
  • $\begingroup$ This post have discuss the first question about how to record. $\endgroup$
    – yode
    Commented Oct 2, 2016 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$ Commented Oct 3, 2016 at 6:25

2 Answers 2

5
$\begingroup$

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

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

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.

$\endgroup$
2
  • $\begingroup$ the link to the audio file is broken! $\endgroup$
    – glS
    Commented Jun 15, 2017 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$ Commented Jul 26, 2017 at 4:51
13
$\begingroup$

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[
   SampledSoundList[
    Reverse /@ {soundsLists},
    r
    ]
   ];

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

playInReverse[SystemDialogInput["RecordSound"]]

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).

$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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