keypad - % keypad.m - DTMF keypad % 440:127 - Fall 2011 -...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % keypad.m - DTMF keypad % 440:127 - Fall 2011 - S. J. Orfanidis clear all K = ['1' '2' '3' '4' '5' '6' '7' '8' '9' '*' '0' '#']; % equivalently, K = ['123'; '456'; '789'; '*0#']; fL = [697, 770, 852, 941]; fH = [1209, 1336, 1477]; [FL,FH] = ndgrid(fL,fH); s = input('enter number to dial (keypad chars only, no spaces): ', 's'); fs = 8192; T = 1/fs; % sampling rate and sampling interval Td = 1/4; % playing duration of each key Tb = 1/10; % blanking time between keys Nb = floor(Tb*fs) + 1; % number of blanking samples yb = zeros(1,Nb); % blanking signal samples t = 0:T:Td; % time vector for each key y = ; % initialize overall signal for k=1:length(s) % for each pressed key, do the following [i,j] = find(K==s(k)); % find its location in K-matrix x = sin(2*pi* FL(i,j) * t) + sin(2*pi * FH(i,j) * t); % and map it to (fL,fH) and generate signal y = [y, x, yb]; % append signal and blanking signal to y end sound(y,fs); % play the overall signal y % -----------------------------------------------------------------...
View Full Document

Page1 / 3

keypad - % keypad.m - DTMF keypad % 440:127 - Fall 2011 -...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online