资源简介
音频处理matlab代码,配合mp3.pdf中介绍使用,共有6个代码,这是其一
代码片段和文件信息
%% Chapter 3 - How is sound processed in an MP3 player?
% This is a companion file to the book “Applied Signal Processing“
% by T.Dutoit and F. Marques Springer 2008.
%
% It is supposed to be run cell-by-cell using the cell mode of
% MATLAB 6 and later versions. Search for “what are cells“ in the
% product help of MATLAB to know how to use them.
%
% This file uses the SIGNAL_PROCESSING toolbox of MATLAB.
%%
% In this script we will see how the limitations of the human auditory
% process have been taken into account for the design of perceptual audio
% coders with special emphasis on the principles underlying the MPEG-1
% layer-I audio coding norm. We start by examining a two-channel filter bank
% using conventional filters (Section 1) and QMF filters (Section 2). We
% then extend our study to a 32-channel PQMF filter bank (Section 3) and
% show how it can be efficiently implemented using block-based lapped
% transforms (Section 4). We conclude by providing our filter bank with
% a perceptual quantizer for sub-band signals (Section 5).
%
% Copyright N. Moreau T. Dutoit (2007)
clear all;
set(0‘defaultFigureColor‘‘w‘);
%% 1. Two-channel filter bank
% The MPEG 1 layer I coder is based on quantifying the sub-band signals of
% an analysis-synthesis filter bank (as we will see later this can also be
% interpreted in terms of block-transform-based processing).
% The analysis filter-bank at the encoder splits the signal into (ideally
% non-overlapping) frequency bands. The resulting narrow-band signals are
% then decimated and quantized. The decoder upsamples each sub-band signal
% and performs band-pass-filtering so as to eliminate the aliasing images
% due to upsampling.
%
% Before examining a complete M-channel filter bank we first discuss
% the 2-channel case and the effect of a decimation and interpolation in
% each branch.
%
% Let us first generate a 4-seconds chirp signal (from 0 to 4 kHz) with a
% sampling rate of 8 kHz which we will use as a reference throughout
% this Section.
Fs=8000;
input_signal=chirp((0:4*Fs)/Fs044000);
clf;
soundsc(input_signalFs);
%%
specgram(input_signal1024Fs256);
%%
% Applying direct downsampling-upsampling by 2 results in replacing every
% other sample by zero. The result is that an artifact signal is added
% whose spectrum is the quadrature mirror image of that of the chirp. Two
% sinusoids can be heard at any time. (Notice we multiply the signal by 2
% when upsampling so that the power of the signal remains unchanged.)
downsampled=input_signal(1:2:end);
upsampled(1:2:2*length(downsampled))=2*downsampled;
clf;
specgram(upsampled1024Fs 256);
soundsc(upsampledFs);
%%
% Adding a quarter-band filter after upsampling eliminates the image
% distortion making sure that only one
% sinusoid appears at any time. During the first half of the chirp that
% sinusoid is the chirp itself; during the second h
- 上一篇:MATLAB常用函数大全
- 下一篇:计算机视觉、图像处理、硬币识别
评论
共有 条评论