Encoding the signal with 14 bits

6 ビュー (過去 30 日間)
Pat
Pat 2012 年 9 月 14 日
[f1,Fs1] = wavread('bird.wav');
sound(f1, Fs1);
i tried using
D=int14(f1* 8192)
I get error
Undefined function 'int14' for input arguments of type 'double'.
please help
  1 件のコメント
Walter Roberson
Walter Roberson 2012 年 9 月 14 日
You should be considering the Fixed Point Toolbox.

サインインしてコメントする。

回答 (1 件)

Star Strider
Star Strider 2012 年 9 月 14 日
編集済み: Star Strider 2012 年 9 月 14 日
I cannot find any reference to int14 in the online MATLAB documentation. If you want to truncate to 14 bit precision, there are two ways to do it with f1 being defined as a column vector. In my experience, .wav files are read as a [N x 2] matrix (one column for each stereo channel), so you will have to encode each column of f1 as 14-bit integers as separate operations. For column 1:
D = dec2bin( (f1(:,1) * 8192), 14);
or if D results a binary string longer than 14 bits, and since binary numbers are defined as strings:
D = dec2bin(f1(:,1) * 8192);
D = D(:,1:14);
then if you want to:
D = int16(bin2dec(D));
They will all be stored as 16-bit signed integers, but truncated in precision to 14 bits.
  27 件のコメント
Walter Roberson
Walter Roberson 2012 年 9 月 24 日
In 16 bit you do not need those manipulations as datatype int16() or uint16() are already the correct size for that purpose.
Pat
Pat 2012 年 9 月 28 日
ok walter thank u

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDiscrete Multiresolution Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by