File audio flac error

1 view (last 30 days)
Ferz14
Ferz14 on 22 Jan 2016
Commented: Ferz14 on 25 Jan 2016
How to create file audio in flac format? I have used audiowrite but it hasn't worked. The error is described as "Warning: Data clipped when writing file. > In audiowrite>clipInputData (line 396) In audiowrite (line 176) " Can you solve this problem please? Thank you!
  2 Comments
Geoff Hayes
Geoff Hayes on 22 Jan 2016
Ferz14 - you are observing a warning and not an error or is there a problem with the audio file?
See Walter's answer at http://www.mathworks.com/matlabcentral/answers/257223-audiowrite-clipping-warning-issue for an explanation of the warning.
Ferz14
Ferz14 on 22 Jan 2016
Thank you! I need to create a sine wave with amplitude=5 but I can't do it. I've tried in wav format but in this way amplitude values are clipped to the range –1.0 <= y < +1.0. Could you explain me how to do?

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 23 Jan 2016
You could write out an audio file with amplitude 5, but it would have to be integer 5, representing 5/255 of maximum amplitude (uint8) or 5/32767 of maximum amplitude (int16) or 5/(2^31-1) of maximum amplitude (int32)
If you are writing a floating point value, then the value always represents fraction of the maximum; if you were able to represent a value 5 times the maximum then the clearly the maximum would be high enough to encompass that 5 times value, so by way of contradiction the value cannot exceed 1.0 in floating point.
  24 Comments
Walter Roberson
Walter Roberson on 25 Jan 2016
Why do you think you need a trigger? What document are you looking at?
Ferz14
Ferz14 on 25 Jan 2016
Because my work is to sample an analog input at the rising edge of the digital trigger. I send a file audio (a sine wave) and my DAQ samples the signal when receives the trigger. What am I doing wrong? Thanks.

Sign in to comment.

Categories

Find more on Audio I/O and Waveform Generation in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!