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

1 visualización (últimos 30 días)
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!

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by