# Counter design for audio signals

I am designing a schematic in which a Counter is to be increased whenever a particular band of frequencies is received at the Audio input. We are receiving the audio input as electrical Signal and I have already designed the bandpass filter with the required passband. How can I design the Counter for the same purpose?

def doppler(x):
"""
Parameters
----------
x : array-like
Domain of x is in (0,1]

"""
if not np.all((x >= 0) & (x <= 1)):
raise ValueError("Domain of doppler is x in (0,1]")
return np.sqrt(x*(1-x))*np.sin((2.1*np.pi)/(x+.05))

def blocks(x):
"""
Piecewise constant function with jumps at t.

Constant scaler is not present in Donoho and Johnstone.
"""
K = lambda x : (1 + np.sign(x))/2.
t = np.array([[.1, .13, .15, .23, .25, .4, .44, .65, .76, .78, .81]]).T
h = np.array([[4, -5, 3, -4, 5, -4.2, 2.1, 4.3, -3.1, 2.1, -4.2]]).T
return 3.655606 * np.sum(h*K(x-t), axis=0)

def bumps(x):
"""
A sum of bumps with locations t at the same places as jumps in blocks.
The heights h and widths s vary and the individual bumps are of the
form K(t) = 1/(1+|x|)**4
"""
K = lambda x : (1. + np.abs(x)) ** -4.
t = np.array([[.1, .13, .15, .23, .25, .4, .44, .65, .76, .78, .81]]).T
h = np.array([[4, 5, 3, 4, 5, 4.2, 2.1, 4.3, 3.1, 2.1, 4.2]]).T
w = np.array([[.005, .005, .006, .01, .01, .03, .01, .01, .005, .008, .005]]).T
return np.sum(h*K((x-t)/w), axis=0)

def heavisine(x):
"""
Sinusoid of period 1 with two jumps at t = .3 and .72
"""
return 4 * np.sin(4*np.pi*x) - np.sign(x - .3) - np.sign(.72 - x)
In [5]:
x = np.linspace(0,1,2**11)
dop = doppler(x)
blk = blocks(x)
bmp = bumps(x)
hsin = heavisine(x)
In [6]:
fig, axes = plt.subplots(2, 2, figsize=(10,10))
ax1 = axes[0,0]
ax2 = axes[0,1]
ax3 = axes[1,0]
ax4 = axes[1,1]

ax1.plot(x,dop)
ax1.set_title("Doppler")

ax2.plot(x,blk)
ax2.set_title("Blocks")

ax3.plot(x,bmp)
ax3.set_title("Bumps")

ax4.set_title("HeaviSine")
ax4.plot(x,hsin)

for ax in fig.axes:
ax.tick_params(labelbottom=False, labelleft=False, bottom=False,
top=False, left=False, right=False)

fig.tight_layout();

• Kindly explain, will you? – shreelock Jun 25 '14 at 12:05
• @thani: Next time please use the code formatting block. – jojek Jun 25 '14 at 14:58