HackRF采集调频广播基带数据并使用Ocatve解调播放
使用hackrf_transfer工具在Linux系统上,采集当地的一个调频广播,使用的采样频率为8MHz。得到IQ交错存储的8位有符号基带数据,在Octave中,先进行50倍抽取,变换到160K采样率,解调后在进行10倍抽取,得到16K采样的单声道广播音频。
clc; clear all; pkg load signal; % Raw IQ data fd = fopen('FM93_8Msps.wav', 'r'); [data] = fread(fd, inf, 'int8'); fclose(fd); I = data(1: 2: end); Q = data(2: 2: end); % Move spectrum from center 93MHz to 95Mhz %S = I .+ Q*1i; %dt = 1/8e6; % Move 2MHz %for k = 1 : length(I) % S(k) = S(k) * exp(-1i*2e6*2*pi*dt*k); %end %I = real(S); %Q = imag(S); %R = zeros(1, 2*length(I)); %R(1: 2: end) = I; %R(2: 2: end) = Q; %fd = fopen('FM95_8Msps.wav', 'w'); %fwrite(fd, R, 'int8'); %fclose(fd); B = fir1(51, 0.02); A = [1]; I = filter(B, A, I); Q = filter(B, A, Q); I = I(1: 50: end); Q = Q(1: 50: end); % 160Ksps S = I .+ Q*1i; % Demod d = S(1: end - 1) .* conj(S(2: end)); s = atan2(imag(d), real(d))/pi; B = fir1(21, 0.1); A = [1]; s = filter(B, A, s); s = s(1: 10: end); % Replay loops = 10; % 16Ksps while loops-- sound(s, 16000); end
直接使用Gqrx播放: