How to decrease total samples of audio?

조회 수: 6 (최근 30일)
Nasuhcan TÜRKER
Nasuhcan TÜRKER 2020년 4월 14일
답변: Walter Roberson 2020년 4월 14일
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