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

1 Ansicht (letzte 30 Tage)
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!

Akzeptierte Antwort

Star Strider
Star Strider am 14 Nov. 2023
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 Kommentare
Star Strider
Star Strider am 27 Nov. 2023
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by