www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/SpecifyBitsPerSampleandMetadataExample.m

    %% Specify Bits Per Sample and Metadata  

%% 
% Create a FLAC file from the example file |handel.mat| and specify the
% number of output bits per sample and a comment. 
load handel.mat

filename = 'handel.flac';
audiowrite(filename,y,Fs,'BitsPerSample',24,...
'Comment','This is my new audio file.');
clear y Fs  

%% 
% View information about the new FLAC file by using the |audioinfo|
% function
info = audioinfo(filename) ; 

%%
% The |info| structure contains the following information fields:
% |Filename|, |CompressionMethod|, |NumChannels|, |SampleRate|,
% |TotalSamples|, |Duration|, |Title|, |Comment|, |Artist|, and
% |BitsPerSample|.