- 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?"
¿Como remuestrear?
5 次查看(过去 30 天)
显示 更早的评论
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:
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
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multirate Signal Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!