# ¿Como remuestrear?

3 views (last 30 days)
Juan on 13 Aug 2022
Edited: Walter Roberson on 15 Aug 2022
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=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)
the goal is to do this transform but with greater precision.
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 CommentsShowHide 1 older comment
Walter Roberson on 15 Aug 2022
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.

Walter Roberson on 15 Aug 2022
Edited: Walter Roberson on 15 Aug 2022
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.