Warning: Data clipped during write to file-Guitar tuner code

4 views (last 30 days)
Trying to create a wave file Matlab returns this error, I normalized the amplitude but the problem remained. Moreover the wavwrite function doesn't manage to create and save the file. For other lower main frequencies such as 110 (guitar A note) the problem doesn't show.
  6 Comments
Star Strider
Star Strider on 30 Apr 2014
The audioplayer function seems to be new as of R2014a. The information on the various Recording and Playback functions in R2014a are available in the online documentation. (I no longer have access to the documentation on wavwrite and wavread.)
cace
cace on 30 Apr 2014
You are right, audioplayer function exists and play too on Matlab 2011 but I actually cannot find audiowrite and audioread fun.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 29 Apr 2014
Your a(1) is 5, so your outputs could be as large as 5. wavwrite() requires that the data be in the range -1 to +1 if you are using floating point numbers.
  4 Comments
Star Strider
Star Strider on 29 Apr 2014
I might not have noticed it either, except that I typed the code in so I could run it, and I had to read every line. (I also made some changes, since one of my pet peeves are ‘i’ and ‘j’ as anything other than imaginary operators.) I have audioplayer so I can’t experiment with wavwrite any more, and it’s even gone from the online documentation. The new audiowrite seems to be much more tolerant of bad scaling than its predecessors.
cace
cace on 30 Apr 2014
Thanks for answers, I attached the m file created with your suggestion about scaling. However the code still can't write wav file, maybe the only solution is using audioplayer fun. Thanks everybody.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!