# What mathematical function could be used to simulate this sound effect?

I have this sound effect which by the way if anyone could give me its name, I would really appreciate it. And after loading it into matlab/octave (don't worry this isn't a programming question) using the following commands:

[x, fs] = audioread("Path To File");
plot(length(x(:,1)),x)
sound(x,fs) % To hear the sound


I get the following: Could anyone tell me what mathematical function I could use to simulate this?

• So you have a recording of a sound, you don't know what it is called or how to model it, but you want to do some simulation with it? I'm not following this – Engineer Jan 24 at 19:35
• I think you should be clearer about what you mean when you ask how to simulate it. Do you wish to generate the same sound? a similar sound? If it is the same sound just take this one. If you want a similar sound you have to specify how similar. you can only define how similar if can define the sound. If you do not know how it is called or what it is, how can you generate something similar? – havakok Jan 25 at 6:38
• @havakok I want to generate one as similar to this one as possible. I got it off free from the internet but I want to be able to know how to generate one as similar as possible. It's a mere curiosity. – david david Feb 18 at 13:26
• @daviddavid this is not a sound. this is a drawing of a function that could be a sound. It could also be any other signal. You do not know what is the sound, all you know is that you have it. Generating a sound could be a complex task involving understanding that sound's features which you don't. No one can help you if you don't know what you want to generate. – havakok Feb 19 at 5:59
• @havakok I want to find a mathematical function that closely simulates the drawing of the sound. I do not plan on using regression of whatever sort or similar. I can then play the sound using the function using a similar version of the program mentioned above. I plan on recreating it synthetically not in real life – david david Feb 21 at 21:11

I guess you want to synthesize that sound, i.e. create a synthetic signal to be as close as possible to the original sound. Potentially, you can do this by creating a superposition of sine waves with varying amplitudes and phases. So you have to know the parameters for those sine functions.

From what I can see and hear, the sound has two signals, which are very similar (both visually and to ear). Moreover, if you look at the frequency spectrum, you will see, that they are quite similar as well. However, the spectrum seems quite populated with different frequencies, which will make it difficult to reproduce as a synthetic function. At least if using only the provided original sound file.

Here is the spectrum plot:

And here is a python code to make those observations. (The file with sound is downloaded to the folder of the python script.)

import matplotlib.pyplot as plt
import soundfile as sf
import sounddevice as sd

# get file
filename = "SoundEffect.wav"
x1 = x[:,0]     # the first signal
x2 = x[:,1]     # the second signal

# play and show the original sound in time domain
sd.play(x, f)
status = sd.wait()
plt.plot(x)
plt.show()

# play the first signal
sd.play(x1, f)
status = sd.wait()
# play the second signal
sd.play(x2, f)
status = sd.wait()

# show the signals in frequency domain
plt.magnitude_spectrum(x1, Fs = f)
plt.magnitude_spectrum(x2, Fs = f)
plt.show()


Bear in mind, I am not familiar with how sound effects are done. Most probably, this sound effect is a more simple superposition of certain signal shapes. However, unless they are already known, it is hard to "reverse-engineer" them from the sampled version of the signal.

• Not a superposition of sine function though, but the sum. – megasplash Jan 29 at 11:12
• If you check out the sound plot from the question you will see two very similar functions. I was actually trying to find a mathematical function that can generate something like this as closely as possible. I don't mind adding a few random numbers into the function if necessary. – david david Feb 18 at 13:29