Frequency at specific time of interest in WAV file [HELP]

2 views (last 30 days)
Hello all, This is my first post here because I ran into a very specific trouble. I am generating a BFSK signal which outputs to the speakers of my laptop (this I have done so far). After the BFSK signal is outputted, another laptop records the signal and saves it as a WAV file (also completed). Now, my trouble is analyzing the audio file by making some sort of loop that reads a portion of that audio file and saves the frequency at that time of instance. My goal is to see the Bit Error Rate (BER) of the transmitted signal versus the received signal. Its been very hard trying to create some function to analyze my captured audio file. The function that generates my BFSK signal is as follows:
function [ x, nbits ] = bfsk_mod(b,fc,T)
% A BFSK Modulator Function..
% x is the BFSK Output, fc is the carrier
% frequency, and T is the symbol (bit) duration,
% nbits is the number of bits, and
% b is the Output bit stream.
d=2*b-1; % Convert unipolar to bipolar
Eb=T/2;
% This will result in unit amplitude waveforms
nbits=length(b);
% t=linspace(0,nbits,nbits*200);
t=linspace(0,T,100);
Lt=length(t);
wm1=sqrt(2*Eb/T)*cos(.8*pi*fc*t);
wm0=sqrt(2*Eb/T)*cos(1.2*pi*fc*t);
% f1=4;f0=1;
x=[]; bw=[];dw=[];
for k=1:nbits
if b(k)==1
x=[x,wm1];
bw=[bw,b(k)*ones(1,Lt)];
sound(wm1);
else
x=[x,wm0];
bw=[bw,b(k)*zeros(1,Lt)];
sound(wm0);
end
dw=[dw,d(k)*ones(1,Lt)];
pause(.1);
end;
end
% end of bfsk_mod.m
The code that drives this function and outputs the signal to my laptop speaker is:
clc;
clear all;
R = [0 1 0 0 1 0 0 0 0];
bfsk_mod(R, 2000, .01);
I am not sure where to go from here to analyze the audio file. I know that if someone showed me a way to create some sort of loop that can analyze a small time frame, I can be able to create a function within that loop to do the processing I need. Thank you for your time and effort. Please let me know if something is unclear!
-Nasir

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!