%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % SMS - suggestions for 2nd laboratory: Digital Signals % October 9th, 2015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ----------------------------------------------------------- EXAMPLE 1: Sinusoidal signals a) Generate and display 20 ms sinusoidal signal with frequency of 440 Hz and sampling frequency of 8 kHz. b) Generate and display four periods of the signal at frequency of 440 Hz and a sampling frequency of 8 kHz. c) Generate 10 samples the signal at a frequency of 440 Hz and a sampling frequency of 8 kHz. ----------------------------------------------------------- EXAMPLE 2: Phone tones I http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf a) Dial tone: F = [425 0 425 0 ]; [Hz] T = [0.33 0.33 0.66 0.66 ]; [s] b) Ringing tone: F = [425 0]; [Hz] T = [1 3]; [s] c) Special information tone: F = [950 0 1400 0 1800 0 ]; [Hz] (Unobtainable tone) T = [0.33 0.03 0.33 0.03 0.33 1.25]; [s] d) Busy tone: F = [425 0]; [Hz] T = [0.33 0.42]; [s] ----------------------------------------------------------- EXAMPLE 3: Musical scale (tempered tuning) a) Write a function ton = note (key, time) that generates harmonic signal corresponding key on the keyboard. b) Generate a musical scale using the function 'note.m'. % function ton = note (key, duration) % The function generates a sinusoidal signal corresponding % to the position on the keyboard. % % input: key ... number key of corresponding notes % c1=40; d1=42; e1=44; f1=45; g1=47; a1=49; h1=51; c2=52 % duration ... signal duration [s] % output: tone ... output signal [Hz] fs = 8000; % may be a function parameter f = 440 * 2 ^ ((key-49)/12); t = 0:1/fs:duration-1/fs; ton = sin(2*pi*f*t); ----------------------------------------------------------- EXAMPLE 4: Two tones Multiplying two harmonic signals will arise new components ( additive and differential) and the original signal is suppressed. This method is often implemented with sound synthesizers. The phenomenon, which may sound like a chirp is heard best if one from very low frequencies (about 10 Hz) and the second around 1 kHz. Generate signals (4 sec) as the sum of two sinusoidal signals with a frequency f1 and f2. a) f1 = 220; f2 = 221; (=> fc = 220.5; fm = 0.5;) b) f1 = 220; f2 = 225; (=> fc = 222.5; fm = 2.5;) c) f1 = 220; f2 = 270; (=> fc = 255; fm = 25;) Signals to view and listen. ----------------------------------------------------------- EXAMPLE 5: Dual tone multifrequency – DTMF The pressing of the phone button generates a signal containing two frequencies listed in the table. f [Hz] 1209 1336 1477 697 1 2 3 770 4 5 6 852 7 8 9 941 * 0 # Frequencies listed in the table meet the conditions so that none of the frequencies are not: • multiples other frequencies (harmonics) • the difference between any two frequencies • the sum of any combination of frequencies. a) Write a function dial DTMF = (number), where 'number' represents input vector with numbers in range from 1 to 12 (11 = '*' and 12 = '#') and output vector 'dial' contains corresponding signal (fs = 8 kHz) with 0.1 seconds duration. b) Generate, view and play DTMF signals. ----------------------------------------------------------- EXAMPLE 6: Wavetable synthesis a) Consider one period sine wave of frequency f0 and transform it into one period of the frequency f1. b) Consider one period sine wave of frequency f0 and transform to arbitrarily long signal of frequency f1. c) Consider one period sine wave of frequency f0 and transform to arbitrarily long signal of frequency f1 using linear interpolation. ----------------------------------------------------------- EXAMPLE 7: Banjo We will syntesize sound of banjo using wavetable synthesis. ----------------------------------------------------------- EXAMPLE 8: Musical instrument We generate the sound of musical instruments using wavetable synthesis. For this task, you can use the sound of real musical instruments from the database on page: http://amber.feld.cvut.cz/vyu/zzs/zzs3/zzs3.htm