How to decrease total samples of audio?

7 次查看(过去 30 天)
Hello,
I want to decrease total samples of my audio. My SampleRate: 10000 and total samples is 329000 but I want decrease to 44100. I try that downsample method but ı cant succesful. after that ı try to audiowrite(newfile, y, fs2); like this way audiowrite('myaudio.wav',44100,10000) but I got the this error message;
Warning: Data clipped when writing file.
> In audiowrite>clipInputData (line 407)
In audiowrite (line 187)
I would be grateful if someone help me.
  2 个评论
Geoff Hayes
Geoff Hayes 2020-4-14
编辑:Geoff Hayes 2020-4-14
Nasuhcan - from your comment SampleRate: 10000 but I want decrease to 44100, are you really trying to reduce the total number of samples, or are you changing the sampling rate? Why 44100? If you are reducing the number of samples from 329000 to 44100 (~13.4% reduction), will you keep the same sampling rate of 10000?
Nasuhcan TÜRKER
Nasuhcan TÜRKER 2020-4-14
Hello firstly thanks you for your comment. I want decrease my total samples to 44100 because I am trying to write a deep learning algorithm that performs sound analysis and my needs are 44100 but some audio is old a record and are total samples is 329000 also my new code working on 44100 so ı must to decrease to my total samples and sampling rate is haven't be 10000. So I try to decrease old record's total samples.

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2020-4-14
audiowrite does not resample. The data you pass as the second parameter to it is the samples, so you are passing a single sample with value 44100. Notice how you did not pass your signal y to audiowrite. And NO, you cannot audiowrite a signal and then call audiowrite again with the same file name with the intention that audiowrite would somehow know that your intention was for it to read the file and resample it and write it back.
You should be using resample() to create a modified signal that you audiowrite

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by