Given an audio file, how can I construct a histogram of all bipolar pulses?

1 次查看(过去 30 天)
Hi! I'm looking to take an audio file (.flac) and append each instance of a bipolar pulse to a histogram vector. Is there a version of the "findpeaks" function that only looks for bipolar signals (ie: looks for peaks that are adjacent to a negative peak)? If not, how would I go about constructing a signal template and processing through my file to search for signals of a similar shape? I'm not sure what key words I should be Googling (maybe wavelet or templating?) so any help is appreciated. Thanks!

采纳的回答

Star Strider
Star Strider 2023-11-14
The findpeaks function can easily detect negative peaks.
Simply negate the original signal to get them —
t = linspace(0, 50, 125);
s = tan(2*pi*t);
[pks,plocs] = findpeaks(s, 'MinPeakProminence',10); % Peaks
[vys,vlocs] = findpeaks(-s, 'MinPeakProminence',10); % Valleys
Pulse = plocs(plocs-vlocs <= 10)+[-5; 10]; % Pulses
figure
plot(t, s)
hold on
plot(t(plocs), pks, '^r')
plot(t(vlocs), -vys, 'vg')
plot(t(Pulse), [10; 10], '-k', 'LineWidth',2)
hold off
grid
axis('padded')
I do not understand the histogram reference.
Make appropriate changes to get the result you want.
.
  11 个评论

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by