-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsender.m
44 lines (29 loc) · 761 Bytes
/
sender.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
% fsk
% amplitude
A=1;
% sampling frequency
Fs = 44100;
% carrier frequency
b_f = 800;
% frequency offset
delta_f = b_f/4;
[fn1, fn2] = analyse_noise(Fs);
[f0, f1, f2, f3] = pick_freq3(fn1, fn2);
% word duration
w_duration = 240/1200;
% bound signal
bound = [1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1];
w_b = bin2sound2(bound, A, f0, f1,f2, f3, w_duration, Fs);
% serialize text
b = text2bin('jambon.txt');
% % emulated async
% sound_data = [zeros(1, 15000), w_b];
% sound_data = w_b;
sound_data = bin2sound2(b, A, f0, f1, f2, f3, w_duration, Fs);
% end bound signal
sound_data = [w_b, sound_data, w_b];
%plot(sound_data);
%sound_data = sound_data + (randn(size(sound_data)) * 11);
duration = length(sound_data)/Fs;
pause;
sound(sound_data, Fs);