0
$\begingroup$

enter image description hereGenerate a pulse train with -2dBFS pulses of 20 sample duration every 8 seconds. I have referred here to generate a pulse train but not able to repeat it. How can I repeat this audio signal every 8 second and between aforementioned signal there has to be silence?

from scipy import signal
import matplotlib.pyplot as plt
import numpy as np

sampling_rate = 16000
time_seconds = 1 
number_of_pulses = 20
pulse_frequency = 1/(time_seconds/(number_of_pulses/2))
t = np.linspace(0, time_seconds, sampling_rate, endpoint=False)
signal_dbfs = 0.8 #-1dBFS
plt.plot(t, signal.square(2 * np.pi * pulse_frequency * t) * signal_dbfs)
plt.ylim(-2, 2)
plt.show()
$\endgroup$
  • 2
    $\begingroup$ Hi, @user3053970, and welcome to DSP.SE. To make it easier for people here to help with your problem it is usually beneficial to clearly state your question, and, if possible, to describe what you have tried and where exactly you're stuck. For example, this question lacks a clear title (actually, the title is not formulated as a question here). Also, the question asked, i.e., "How can I repeat this audio signal [...]" refers to some audio signal, but it is not clear which audio signal you mean. In many cases, trying to describe the question as clearly as possible may lead you to the answer. $\endgroup$ – applesoup Dec 26 '19 at 8:44
  • $\begingroup$ Is the train 20 sample duration? (In which case, what is the pulse frequency?) Or are the pulses 20 sample duration? (Meaning half-wavelength? How many pulses?) Since this is for audio, do you want the pulses bandlimited? $\endgroup$ – endolith Jan 28 at 19:40
  • $\begingroup$ 0.8 #-1dBFS is not correct. -2 dBFS is an amplitude of 0.794328 $\endgroup$ – endolith Jan 28 at 19:42
  • $\begingroup$ @endolith: how did you get that number? $\endgroup$ – user3053970 Jan 30 at 3:39
  • $\begingroup$ 1.0 = 0 dBFS, and dB is 20*log10(number), so inverse is 10^(number/20) $\endgroup$ – endolith Jan 30 at 17:36
0
$\begingroup$

Actually, as mention by @applesoup your question is not clear but as far as I understood you can repeat the signal using

numpy.matlib.repmat(a, m, n)
Repeat a 0-D to a 2-D array or matrix MxN times.
Parameters: 
    a : array_like
    The array or matrix to be repeated.
    m, n : int
    The number of times a is repeated along the first and second axes.
Returns:    
   out : ndarray
   The result of repeating a.

For further better understanding, you can look this link

$\endgroup$
  • $\begingroup$ I don't think this is what I am looking for. I have updated the question. $\endgroup$ – user3053970 Dec 29 '19 at 5:34

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.