¿Como remuestrear?
이전 댓글 표시
help I'm new to programming, I need to resample the audio signal from 44100hz to a higher one but I don't know how to do it, I need to resample to later use FFT() and that the fourier transform is more accurate.
_________sonido_______________________________________________________
[s,fs]=audioread('frase 3-1.wav');
s=s/max(abs(s));
t=size(s,1)/fs; %tiempo total
tiempo=0:1/(fs):t;
[P,Q]=rat(48e3/fs);
snew=resample(s,P,Q);
sound(snew*0.5,fs)
figure
plot(tiempo(2:end),snew)
__________transformada_______________________________________________________
the goal is to do this transform but with greater precision.
[s,fs]=audioread('Frase 3-1.wav', );
sound(0.5*s,fs);
%Ahora normalizamos el vector de audio
s=s/max(abs(s));
%reproducimos el audio cargado
%-----------------------------------------
%--------transformada rapida de fourier----
trans=abs(fft(s));
L=length(trans);
%ya que fft es bilateral, solo nos interesa la mitad del espectro
espectro=trans(1:L/2);
%normalizamos el espesctro
espectro=espectro/max(espectro);
frec=fs*(1:(L/2))/L;
%graficas:
t=size(s,1)/fs; %tiempo total
tiempo=0:1/(fs):t;
figure %invocamos una figura
Grafica1=subplot(2,1,1);
plot(tiempo(2:end),s), %xlim([0.55 0.8])
title('Dominio del tiempo')
xlabel('s')
ylabel('db')
Grafica2=subplot(2,1,2);
plot(frec,espectro), %xlim([0 1500])
title('Dominio de la frecuencia')
xlabel('Hz')
ylabel('db')
%agregamos componentes esteticos
grid(Grafica2)
댓글 수: 2
Jan
2022년 8월 14일
Some hints:
- This is not twitter - no # before the tags. Thanks.
- User the tool to format code as code to improve the readability.
- The standard language of this forum is English. More users will understand "How to resample?"
Applying an interpolation will not increase the accuracy of a an FFT.
Walter Roberson
2022년 8월 15일
Questions may be asked in any language that the user is comfortable with. There is no "standard language". However, questions asked in English are more likely to get a response.
답변 (1개)
Walter Roberson
2022년 8월 15일
편집: Walter Roberson
2022년 8월 15일
1 개 추천
There are multiple ways to resample data, including using resample(), which uses upfirdn() to perform a polyphase interpolation; a Kaiser window is involved for anti-aliasing.
Another way to resample is to call fft() to find the frequencies, then ifft() to reconstruct from the frequencies with the desired new number of points.
Resampling to a higher frequency can never increase the amount of information in a single, so no matter what resampling algorithm you use, you cannot make the higher-frequency fft() "more accurate", only less accurate.
카테고리
도움말 센터 및 File Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!