1
0

Initial commit

This commit is contained in:
github-classroom[bot]
2023-09-27 06:23:10 +00:00
committed by GitHub
commit bb7f798573
38 changed files with 640 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,73 @@
function commbluetoothvoice_cb
%COMMBLUETOOTHVOICE_CB Sets up the Model Mask Parameters in the
% Bluetooth Voice Transmission example (commbluetoothvoice.slx) and saves
% it to the workspace
% Copyright 1996-2011 The MathWorks, Inc.
% Retrieves user information and assigns packet type
systemParams = [bdroot(gcb) '/Model Parameters'];
h=get_param(systemParams,'MaskValues');
if(h{1,1}=='HV1')
set_param(systemParams,'MaskVisibilities',{'on','off','off'});
HV_Type=1;
assignin('base','HV_Type',1);
assignin('base','Slot_Pair',1);
elseif(h{1,1}=='HV2')
HV_Type=2;
assignin('base','HV_Type',2);
set_param(systemParams,'MaskVisibilities',{'on','on','off'});
if(h{2,1}== '1&2')
Slot_Pair=1;
assignin('base','Slot_Pair',1);
else
Slot_Pair=2;
assignin('base','Slot_Pair',2);
end
else
set_param(systemParams,'MaskVisibilities',{'on','off','on'});
HV_Type=3;
assignin('base','HV_Type',3)
if(h{3,1}=='1&2')
Slot_Pair=1;
assignin('base','Slot_Pair',1);
elseif(h{3,1}=='3&4')
Slot_Pair=2;
assignin('base','Slot_Pair',2);
else
Slot_Pair=3;
assignin('base','Slot_Pair',3);
end
end
% Define Slot_Ts and other variables depending on packet type
Slot_Ts=(1/1600);
assignin('base','Slot_Ts', (1/1600));
switch HV_Type
case 1
assignin('base','Tx_Ts',Slot_Ts*2);
assignin('base','Num_Slots_Rate',2);
assignin('base','Num_Payload_Bits',80);
assignin('base','Slot_Enable_Phase',0); % Slot Pair
case 2
assignin('base','Tx_Ts',Slot_Ts*4);
assignin('base','Num_Slots_Rate',4);
assignin('base','Num_Payload_Bits',160);
if Slot_Pair == 3
error(message('comm:commbluetoothvoice_cb:InvalidSlot'));
end;
assignin('base','Slot_Enable_Phase',Slot_Pair*2-2); % Slot Pair
case 3
assignin('base','Tx_Ts',Slot_Ts*6);
assignin('base','Num_Slots_Rate',6);
assignin('base','Num_Payload_Bits',240);
assignin('base','Slot_Enable_Phase',Slot_Pair*2-2); % Slot Pair
end

View File

@ -0,0 +1,41 @@
%COMMBLUETOOTHVOICE_INIT Initializes variables for Bluetooth Voice Transmission
% example (commbluetoothvoice.slx)
% Copyright 1996-2012 The MathWorks, Inc.
% Set input wave sample rate to be 8kHz
Input_Fs=8000;
sigin = audioread('commbluetoothvoice_input.wav');
% Coefficients for speech interpolation
[y,interp_coeffs]=interp(ones(1,10),8);
% Header Information
% Header_Info=[Slave_Address;Packet_Type;Flow_Control;ARQ;Sequence];
Slave_Address= [1 0 1]';
Packet_Type= [1 0 1 0]';
Flow_Control= [1];
ARQ=[1];
Sequence=[1];
Access_Code=zeros(72,1); Access_Code(1:2:72)=1;
% Initialize 1,0,1,0, sequence
One_Zero_Payload=zeros(240,1);
One_Zero_Payload(1:2:240)=1;
% Set Seeds
hop_seed=randseed(1);
awgn_channel_seed=randseed(2);
awgn_802_seed=randseed(3);
rate_802_seed=randseed(4);
data_seed=randseed(5);
% Hop frequency if fixed
fixed_hop_freq=20;
% Assign payload bits
Num_Payload_Bits=80;

Binary file not shown.