Change Sample Rate Audio
51 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ibnu Darajat
el 14 de Nov. de 2022
Comentada: Star Strider
el 14 de Nov. de 2022
Here's Matlab Audioread I try:
filename = "test.wav";
[y,fs] = audioread(filename);
%Play the audio.
sound(y,fs);
info = audioinfo("test.wav")
And here is the info from that audio:
CompressionMethod: 'Uncompressed'
NumChannels: 2
SampleRate: 44100
TotalSamples: 487424
Duration: 11.0527
Title: []
Comment: []
Artist: []
BitsPerSample: 16
My question is, How do I play the audio at a sample rate of 8000?
0 comentarios
Respuesta aceptada
Star Strider
el 14 de Nov. de 2022
filename = "test.wav";
[y,fs] = audioread(filename);
L = size(y,1);
t = linspace(0, L-1, L)/fs; % Time Vector
fs_new = 8000;
[yr,tr] = resample(y, t(:), fs_new); % Resample To New Sampling Frequency
There are several compatible resample syntaxes that will do what you want. I prefer the one I posted here.
Alternatively, the interp1 funciton can be uesd, however resample includes an anti-aliasing filter, so it is best for any sort of signal processing.
.
6 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Audio and Video Data en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!