Adjusting Parameters in Transcranial Doppler Audio Processing: Seeking Guidance on Gain, SWEEP, and Audio Playback
4 views (last 30 days)
Show older comments
Hello there.
I'm working with an audio file, which is the output from Transcranial Doppler. The idea is to accomplish the following:
Here is the file data:
'###block_size::64
'###block_numbers::24
'###offset_binary::1984
'###session_date::20-10-2019
'###session_time::21-32-22
'###time::12-31-49-26
'###gates::2
'###prf::3003
'###samples::15726344
'###transmitting_freq1::2 MHz
'###label1::MCA_L
'###spec_gate_sv1::8
'###spec_gate_depth1::54
'###spec_gate_gain1::44
'###spec_gate_filter1::100
'###transmitting_freq2::2 MHz
Here is my code:
clc
clearvars
%% GETTING THE FLOW VELOCITY
%PRF is 3003
% Open the binary file for reading
fid = fopen('12-31-42-34.bin');
% Read block size and block number from file header
block_size = strread(fgetl(fid),'###block_size::%d');
block_number = strread(fgetl(fid),'###block_numbers::%d');
% Skip 8 lines of header information
for k=1:8
fgetl(fid)
end
% Read the pulse repetition frequency (PRF) from the file header
prf = strread(fgetl(fid),'###prf::%d');
% Calculate the byte offset for the desired data block
offset = block_size * block_number;
fseek(fid,offset,'bof');
% Read the data from the binary file into a matrix 'a'
a = fread(fid, [4,inf],'float32')';
% Set the desire duration
duration = 5;
% Number of points for the desire duration
num_points = duration * prf;
% Set the duration of a (5 sec)
% Sample rate for the data (PRF)
Fs=prf
% Number of points for the FFT (Fast Fourier Transform)
NFFT = 128;
% Individual channels
% Get the flow velocity for each channel (assuming data format is REAL, IM, RE, IM...)
b1 = complex(a(1:num_points,2), a(1:num_points,1)); % Channel 1
b2 = complex(a(1:num_points,4), a(1:num_points,3)); % Channel 2
% Frequency vector representing the time axis
f_vec = [-floor(NFFT/2) : ceil(NFFT/2)-1] * Fs/NFFT;
% Plots
spectrogram(b1,hamming(128),64,f_vec,Fs,'yaxis');
caxis([0 20])
And I'm getting this:
I would like to replicate the same color scheme and parameters as seen in the previous image. Upon closer inspection, it appears that the gain is set to 0dB instead of 44dB, and the SWEEP is 250 fft/s. How can I incorporate these settings into my code? Additionally, I need to be able to listen to the audio output.
Thank you.
Patrícia
0 Comments
Accepted Answer
William Rose
on 19 Jan 2024
For colors, you can specify a colormap that gives colors more like what you want. See here, and scroll down to see all the buil;t-in colormaps. Right now you are using parula, the default. Maybe colormap winter; will be more like what you want.
As for gain seting: Don't change the gain. The original screenshot you provided does not show units. The peaks in the original are around y=+40, and your peaks are at about +1 kHz. I suspect the y-axis units on the original screenshot are are cm/s, not kHz. A systolic velocity of 40 cm/s in the MCA is a bit below average, but not super unusual, in my experience doing TCD on adults. Just convert from kHz to cm/s.
21 Comments
More Answers (0)
See Also
Categories
Find more on Blue in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!