Digital Signal Processing Reference
In-Depth Information
function y = adsr_profile(tA,tD,tS,ED,ES,x)
tR = length(x);
% number of samples (tone duration)
y = zeros(1,tR);
% allocate memory for output signal
% Attack phase
NA = floor(tA*tR)+1;
% number of samples in attack phase
A =1/(NA-1);
% envelope increment
E = 0;
% envelope
for k=2:NA
E = E+A;
y(k) = E*x(k);
end
% Delay phase
ND = floor((tD-tA)*tR);
% number of samples in delay phase
D = (1-ED)/ND;
% envelope decrement
for k=NA+1:NA+ND
E = E-D;
y(k) = E*x(k);
end
% Sustain phase
NS = floor((tS-tD)*tR);
% number of samples in sustain phase
S = (ED-ES)/NS;
% envelope decrement
for k=NA+ND+1:NA+ND+NS
E = E-S;
y(k) = E*x(k);
end
% Release phase
NR = tR-k;
% number of samples in release phase
R = E/NR;
% envelope decrement
for k=NA+ND+NS+1:tR
E = E-R;
y(k) = E*x(k);
end
return
M2.4
Stellen Sie das Audiosignal nach der Hüllkurvenbewertung grafisch dar.
Hinweis: Ergänzen Sie dazu das Programm beispielsweise mit den Grafikbefehlen
% graphics
t=0:length(music)-1; t=t/fs; % time scale
FIG1 = figure('Name','dsplab2_3 : Audio signal with ADSR',
'NumberTitle', 'off');
plot(t,music)
grid, xlabel('t in s \rightarrow'), ylabel('x(t)
\rightarrow')
M2.5
Suchen Sie sich eine WAVE-Datei auf Ihrem PC und laden Sie sie mit dem
MATLAB-Befehl wavread . Bestimmen Sie die Abtastfrequenz und die Wortlänge
und geben Sie das Signal grafisch aus. Beschriften Sie dabei die Zeitachse richtig.
Hinweise: (i) MATLAB liefert als Beispiel die Datei handel mit, siehe help
sound . Diese finden Sie auch auf der Webseite zum Buch als handel.wav . (ii)
Zum Import von Daten in stellt MATLAB den Import Wizard zur Verfügung.
Gestartet wird er beispielsweise durch Anklicken (Doppelklick) einer WAV-Datei
Search WWH ::




Custom Search