Do you know about Doctor Who and its screwdriver?

Well, I'm trying to understand how to replicate this sound but the spectral analysis is too way complicated, just see its spectrogram.

I was trying to figure out what kind of sine waves or partials it is made of, but probably I have no good experience in this.

I'm writing it in python but for know I have nothing than a signal with two sine waves just to make tests.

How can I understand how this sound is made? There is a frequency modulation component which I would not consider right now, because it is probably a steady state sound which was modulated later.

import matplotlib.pyplot as plt
import numpy as np
import sys
from scipy.signal import get_window
import sounddevice as sd
import soundfile as sf

timeLength = 1.0                       # seconds
fs = 44100
t = np.arange(0, timeLength, 1.0/fs)
ww = get_window("hann", t.size)
A = .01
phi = np.pi # phase, radiants.

T = 1.0/fs
df = 20
t_circ = 0.1
t_mid = 0.2
f_mid = 3700
f_circ = df*(1.0 - ((t_circ - t_mid)/t_mid)**2.0)**0.5 
phase1 = np.cumsum((f_mid + f_circ)*T*np.ones(t.size))
phase2 = np.cumsum((f_mid - f_circ)*T*np.ones(t.size))
circ = np.sin(2.0*np.pi*phase1) + np.sin(2.0*np.pi*phase2)

ss = []
#brown_noise = np.random.wald(1, 0.002, len(t))
for i in range(10):
    f = f_mid + 20*i
    s = A * np.cos(2 * np.pi * f * t + circ) 
ss = sum(ss)
ss = ss/max(ss)

sf.write('out.wav', ss, fs)
  • $\begingroup$ that's a nasty sound. other than as a sonic weapon, what do you want to do with it? $\endgroup$ – robert bristow-johnson Jun 18 '19 at 1:13
  • $\begingroup$ Just reproduce the sound and have a baseline to use for transformations (angle and pitch shift) like in the episodes $\endgroup$ – BADWOLF Jun 18 '19 at 6:01
  • $\begingroup$ i dunno python. but MATLAB can read .mp3 files. can python do that? if not, can python read .wav files? if so, email me and i'll send you the wave. it's about 140K samples. $\endgroup$ – robert bristow-johnson Jun 18 '19 at 7:34
  • $\begingroup$ I have already read and analyzed the spectrum. Problem is, how to understand the composition of this sound. Just open it with sonic visualizer for example :) $\endgroup$ – BADWOLF Jun 18 '19 at 14:09

An approximation

Actually, the signal is not that complicated in my opinion. However, I am not a sounds guy... Just playing around with it a bit.

Interestingly, I have a very similar signal that I have produced (see attached sound file and spectrograms. Spectrogram above is my signal (somewhat tuned to your signal's parameters) and below is the sonic screw-driver (of which Doctor by the way? ;) )

I cannot post the code here, since as I said the parameters are a bit tuned to your signal. What I basically did is to create a signal that is...

  1. A sum of 10 signals. Center frequency f_mid = 3.7 kHz + 20Hz*N, N = 0, 1, ..., 9, just to have some kind of a wobbly jitter in there
  2. The center frequency is modulated by a "circle" (df: maximum change of the center frequency, t_circ: duration of a circle, t_mid: starting point of the circle in time) with df = 20 Hz, t_circ = 0.1s. The phase of the signal is generated from the constant frequency plus the dynamic modulation and a very simple numerical integration (phase multiplied by an increasing dt-vector and cumsuming over it). To get to a signal's frequency, you would differentiate its phase wrt to time - so this is the inverse process. T = 1.0/44100.0 f_circ = df*(1.0 - ((t_circ - t_mid)/t_mid)**2.0)**0.5 phase1 = np.cumsum((f_mid + f_circ)Tnp.ones(t_circ.shape)) phase2 = np.cumsum((f_mid - f_circ)Tnp.ones(t_circ.shape)) circ = np.sin(2.0*pi*phase1) + np.sin(2.0*pi*phase2)

  3. Added some somewhat "Brownian" Noise, however it is much below the noise in your signal.

Things to explore

  • The "duration" of the "circles" seems so vary slightly. Probably sinusoidal variation is also fine, so the period could be jittered.

  • Apparently, there is additionally a very broad noise-band. Maybe try some uniform noise with a time-varying windowing?

  • Subtract a bunch of short-term, constant frequency signals from your signal. There is a nearly some kind of a grid visible in the spectrogram.

Some code samples

I am sorry, in my previous description, I apparently have missed some details. Please find here a code snipped that should be able to produce a basic signal that exhibits the basic "circular" frequency change:

import matplotlib
import matplotlib.pyplot as pp
import numpy as np
import scipy.io.wavfile
import scipy.signal

# Export function for convenience 
def export_wave2(t, signal_l, signal_r, name = "test_sp.wav"):
    sample_rate = 44100
    data = np.stack((signal_l, signal_r))
    data = np.transpose(data)
    scipy.io.wavfile.write(name, sample_rate, data.astype("float32"))

# Sampling frequency
fs = 44100
T = 1.0/fs

# Circle parameters
t_circ_max = 0.2 # duration of one "circle"
t_circ     = np.arange(0, t_circ_max, 1.0/fs)
t_mid      = t_circ.max()/2.0
f_mid      = 3700 # middle frequency of the sound signal 
df         = 400     # amplitude of the frequency modulation, ie frequency will vary between f_mid - fd and f_mid + fd

# Create ONE circle
f_circ = df*(1.0 - ((t_circ - t_mid)/t_mid)**2.0)**0.5 

phase1 = np.cumsum((f_mid + f_circ)*T*np.ones(t_circ.size))
phase2 = np.cumsum((f_mid - f_circ)*T*np.ones(t_circ.size))
circ = np.sin(2.0*np.pi*phase1) + np.sin(2.0*np.pi*phase2)

# Repeate the circle N times, ie the signal will be N*t_circ_max long
N = 10
circs = np.hstack([circ for k in range(0,N)])
circs = circs / np.abs(circs).max()
circs_time = np.arange(0, N*t_circ_max, 1/fs)

pp.plot(circs_time, circs)

export_wave2(circs_time, circs, circs, name = "test_sp.wav")

The frequency behaviour is of course not visible directly in the plots, but when a spectrogram is calculated from circs. I have loaded the test_sp.wav into Audacity for this.

Sound example


  • $\begingroup$ Thank you for editing my question (I'm not English) and for your answer. Actually It was strange to see that actually there was such solution in order to generate a similar sound. I noticed the modulated sines before but the signal had too much noise and the spectral analysis was difficult. I produced something following your istructions, but in this moment I am stuck on the frequency modulation part. But I think that this is because I need to sleep ( it was such a busy day). Tomorrow I will try again. Then I will add here some results. $\endgroup$ – BADWOLF Jun 19 '19 at 0:15
  • $\begingroup$ Hey, actually I am a little bit confused on the modulation part (which I think it's my enemy in general). Please can you explain me more about it? I post a code but it's only to show something I tried but in a wrong way. $\endgroup$ – BADWOLF Jun 20 '19 at 0:31
  • $\begingroup$ I have added code regarding the phase. The phase of the signal is generated via an integration process. $\endgroup$ – M529 Jun 20 '19 at 9:26
  • $\begingroup$ I am so sorry to say this, but I am very not confident with modulation and first of all I would like to understand the formula, cause I can't figure out what are the parameters. Probably it's just my fault because I can't see obvious things. Thank you anyway for your time you dedicated to this.. I updated the code, but I can't understand the formula you use and what parameters like t_circle and t_mid are supposed to be set. See my code, I am doing all wrong? $\endgroup$ – BADWOLF Jun 20 '19 at 12:25
  • $\begingroup$ Sorry, won’t have much time at the moment. What I can see at the moment: Have a look at circ and not on s or ss. $\endgroup$ – M529 Jun 21 '19 at 16:29

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.