⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 birdcall.m

📁 非常好的数字处理教程
💻 M
📖 第 1 页 / 共 2 页
字号:
function birdcall(birdname)% BIRDCALL('birdname')%-------------------------------------------------------%	MATLAB code created for MAT201a: Signals and Systems%		Bob L. Sturm and Dr. Jerry Gibson%	Copyright University of California, Santa Barbara%-------------------------------------------------------%	birdcall.m%	This code is a demonstration of additive synthesis%	to make bird calls.%%	Possible birds:%	'Yellow_Warbler', 'Western_Meadowlark', 'Orchard_Oriole',%	'Chipping_Sparrow', 'Scissor_Tailed_Flycatcher',%	'Black_Throated_Gray_Warbler', 'Cassins_Kingbird',%	'Black_Necked_Stilt', 'Chestnut_Sided_Warbler',%	'Great_Horned_Owl', 'Grasshopper_Sparrow', 'Swamp_Sparrow',%	'Golden_Crowned_Sparrow', 'Indigo_Bunting', 'Robin',%	'Nashville_Warbler', 'Rufous_Sided_Towhee', 'Random_Bird'%%	Author: Bob L. Sturm	20030722%-------------------------------------------------------%%%%%%%%% To-Do: (students)%	hooded-warbler, american-widgeon, louisiana-waterthrush,%	solitary-vireo, pigeon-hawk, cerulean-warbler, eastern-phoebe,%	painted-bunting, western-flycatcher, bachmans-sparrow,%	cedar-waxwing, bairds-sparrow, kentucky-warbler,%	prothonotary-warbler, audubons-warbler, lark-bunting,%	eastern-bluebird, chuck-wills-widow, blue-gray-gnatcatcher,%	black-throated-sparrow, black-chinned-sparrow, %if (nargin < 1)	birdname = 'all';endFs = 44100;% General purpose envelopesamp = [.00 .00 .25 1.00 .60 .70 .75 1.00 1.00 .0];tap = [.00 .00 .01 1.00 .99 1.00 1.00 .0];bird_amp = [.00 .00 .25 1.00 .75 1.00 1.00 .0];partial = [1 1];if (max(strcmp(birdname,{'all', 'Yellow_Warbler'})))	% MATLAB code for yellow-warbler	% These are the frequency and amplitude envelopes	% Time is ratio of segment duration, 1 = duration.	% Format is : [time1 val1 time2 val2 ...]	%fprintf('Yellow_Warbler\n');	yellow_up 	= [.00 .00 .60 1.00 1.0 0.5];	yellow_swirl= [.00 1.00 .05 1.00 .60 .00 .80 .30 1.0 0.1];	yellow_down = [.00 1.00 1.00 0];	yellow_last = [.00 .00 .30 .20 .80 .70 1.0 1.0];	swirl_amp 	= [.00 .00 .90 1.00 1.00 .0];	% Score for the Yellow Warbler	% Format is: {begin dur freq freq_skew amp freq_env amp_env <partials>}	num_notes = 9;	pscore = cell(num_notes,8);	pscore(1,:) = {0 .05 5600 400 .05 yellow_up amp partial};	pscore(2,:) = {.23 .12 5000 1500 .15 yellow_swirl swirl_amp partial};	pscore(3,:) = {.45 .13 5000 1700 .17 yellow_swirl swirl_amp partial};	pscore(4,:) = {.62 .16 5000 2000 .20 yellow_swirl swirl_amp partial};	pscore(5,:) = {.85 .15 5000 2000 .20 yellow_swirl swirl_amp partial};	pscore(6,:) = {1.05 .075 3700 1000 .20 yellow_down amp partial};	pscore(7,:) = {1.15 .075 3700 800 .15 yellow_down amp partial};	pscore(8,:) = {1.25 .075 3700 800 .15 yellow_down amp partial};	pscore(9,:) = {1.4 .2 3700 2000 .2 yellow_last swirl_amp partial};endif (max(strcmp(birdname,{'all', 'Western_Meadowlark'})))	%fprintf('Western_Meadowlark\n');	no_skw = [.00 .00 1.00 .0];	down_skw = [.00 1.00 .40 .40 1.00 .0];	fas_down = [.00 1.00 1.00 .0];	amp 	= [.00 .00 .25 1.00 .60 .70 .75 1.00 1.00 .0];	partials = [1 1 2 .04];	num_notes = 8;	pscore = cell(num_notes,8);	pscore(1,:) = {.800 .1 2010.000 0.000 .100 no_skw amp partials};	pscore(2,:) = {1.100 .15 3000.000 100.000 .110 down_skw amp partials};	pscore(3,:) = {1.300 .25 2000.000 150.000 .200 down_skw amp partials};	pscore(4,:) = {1.650 .15 3010.000 250.000 .110 down_skw amp partials};	pscore(5,:) = {1.850 .10 2200.000 150.000 .110 down_skw amp partials};	pscore(6,:) = {2.000 .10 3200.000 1400.000 .110 fas_down amp partials};	pscore(7,:) = {2.200 .05 2000.000 200.000 .110 fas_down amp partials};	pscore(8,:) = {2.300 .10 1600.000 0.000 .110 fas_down amp partials};end%%%%%%%%if (max(strcmp(birdname,{'all', 'Orchard_Oriole'})))	%fprintf('Orchard_Oriole\n');	oriup = [.00 .00 1.00 1.0];	oridwn = [.00 1.00 1.00 .0];	oriupdwna = [.00 .00 .60 1.00 1.00 .60 ];	oriupdwnb = [.00 .50 .30 1.00 1.00 .0];	oribiga = [.00 .90 .15 1.00 .40 .30 .60 .60 .85 .00 1.00 .0];	orimid = [.00 1.00 .05 .50 .10 1.00 .25 .00 .85 .50 1.00 .0];	oridwnup = [.00 .30 .25 .00 1.00 1.0];	oriamp = [.00 .00 .10 1.00 1.00 .0];	num_notes = 16;	pscore = cell(num_notes,8);	pscore(1,:) = {.38 .03 3700 100 .05 oridwn amp [1 1]};	pscore(2,:) = {.41 .05 2500 1000 .1 oriup amp [1 1]};	pscore(3,:) = {.5 .1 2000 800 .2 oriupdwna amp [1 1 2 .02 3 .05]};	pscore(4,:) = {.65 .03 3900 1200 .1 oridwn amp [1 1]};	pscore(5,:) = {.7 .21 2000 1200 .15 oribiga amp [1 1 2 .05]};	pscore(6,:) = {1.0 .05 4200 1000 .1 oridwn amp [1 1]};	pscore(7,:) = {1.1 .1 2000 1000 .25 orimid amp [1 1 2 .05]};	pscore(8,:) = {1.3 .1 2000 1000 .25 orimid amp [1 1 2 .05]};	pscore(9,:) = {1.48 .1 2300 3200 .1 oriupdwnb oriamp [1 1]};	pscore(10,:) = {1.65 .03 1800 300 .05 oriup amp [1 1]};	pscore(11,:) = {1.7 .03 2200 100 .04 oridwn amp [1 1]};	pscore(12,:) = {1.8 .07 2500 2000 .15 oriupdwnb oriamp [1 1]};	pscore(13,:) = {1.92 .2 2400 1200 .25 oridwnup amp [1 1 2 .04]};	pscore(14,:) = {2.2 .02 2200 3000 .04 oriup amp [1 1]};	pscore(15,:) = {2.28 .02 2200 3000 .04 oriup amp [1 1]};	pscore(16,:) = {2.4 .17 2000 1000 .2 oriupdwna oriamp [1 1 2 .04]};end	%%%%%%%%if (max(strcmp(birdname,{'all', 'Chipping_Sparrow'})))	%fprintf('Chipping_Sparrow\n');	chip_up = [.00 .80 .15 1.00 .75 .30 1.00 .0];	num_notes = 17;	pscore = cell(num_notes,8);	pscore(1,:) = {0 .05 4000 2400 .2 chip_up amp [1 1]};	pscore(2,:) = {.06 .05 4000 2400 .2 chip_up amp [1 1]};	pscore(3,:) = {.12 .05 4000 2400 .2 chip_up amp [1 1]};	pscore(4,:) = {.18 .05 4000 2400 .2 chip_up amp [1 1]};	pscore(5,:) = {.24 .05 4000 2400 .2 chip_up amp [1 1]};	pscore(6,:) = {.30 .05 4000 2400 .2 chip_up amp [1 1]};	pscore(7,:) = {.36 .05 4000 2400 .2 chip_up amp [1 1]};	pscore(8,:) = {.42 .05 4000 2400 .2 chip_up amp [1 1]};	pscore(9,:) = {.48 .05 4000 2400 .2 chip_up amp [1 1]};	pscore(10,:) = {.54 .05 4000 2400 .2 chip_up amp [1 1]};	pscore(11,:) = {.60 .05 4000 2400 .2 chip_up amp [1 1]};	pscore(12,:) = {.66 .05 4000 2400 .2 chip_up amp [1 1]};	pscore(13,:) = {.72 .05 4000 2400 .2 chip_up amp [1 1]};	pscore(14,:) = {.78 .05 4000 2400 .2 chip_up amp [1 1]};	pscore(15,:) = {.84 .05 4000 2400 .2 chip_up amp [1 1]};	pscore(16,:) = {.90 .05 4000 2400 .2 chip_up amp [1 1]};	pscore(17,:) = {.96 .05 4000 2400 .2 chip_up amp [1 1]};end	%%%%%%%%if (max(strcmp(birdname,{'all', 'Scissor_Tailed_Flycatcher'})))	%fprintf('Scissor_Tailed_Flycatcher\n');	scissor = [.00 .00 .40 1.00 .60 1.00 1.00 .0];	num_notes = 3;	pscore = cell(num_notes,8);	pscore(1,:) = {0 .05 1800 1800 .2 scissor amp [1 .5 2 1 3 .5 4 .1 5 .01]};	pscore(2,:) = {0.5 .05 1800 1800 .2 scissor amp [1 .5 2 1 3 .5 4 .1 5 .01]};	pscore(3,:) = {1.0 .05 1800 1800 .2 scissor amp [1 .5 2 1 3 .5 4 .1 5 .01]};end	%%%%%%%%if (max(strcmp(birdname,{'all', 'Black_Throated_Gray_Warbler'})))	%fprintf('Black_Throated_Gray_Warbler\n');	grayone = [.00 .50 .02 .60 .04 .45 .06 .62 .08 .40 .10 .65 .12 .35 .14 ...			.70 .18 .30 .20 .70 .22 .30 .24 .70 .25 .20 .30 .80 .35 .10 ... 			.40 .90 .45 .00 .50 1.00 .55 .00 .60 1.00 .65 .00 .70 1.00 ...			.75 .00 .80 1.00 .85 .00 .90 1.00 .95 .00 1.00 .50];	graytwo = [.00 .00 .01 .40 .02 .00 .03 .40 .04 .00 .05 .40 .06 .00 .07...			.40 .08 .00 .09 .40 .10 .00 .25 .80 .40 .30 .55 1.00 .70 .00 ...			.85 .80 1.00 .40];	graythree = [.00 1.00 .01 .60 .02 1.00 .03 .60 .04 1.00 .05 .60 .06...			1.00 .07 .60 .08 1.00 .09 .60 .10 1.00 .11 .60 .12 1.00 .13...			.60 .14 1.00 .15 .60 .16 1.00 .17 .60 .18 1.00 .19 .60 .20...			1.00 .21 .55 .22 1.00 .23 .50 .24 1.00 .25 .50 .26 1.00 .27...			.50 .28 1.00 .29 .50 .30 1.00 .31 .50 .32 1.00 .33 .50 .34...			1.00 .35 .50 .36 1.00 .37 .50 .38 1.00 .39 .50 .40 1.00 .41...			.50 .42 1.00 .43 .50 .44 1.00 .45 .50 .46 1.00 .47 .50 .48...			1.00 .49 .50 .50 1.00 .51 .50 .52 1.00 .53 .50 .54 1.00 .55...			.50 .56 1.00 .57 .50 .58 1.00 .59 .50 .60 1.00 1.00 .0];	grayfour = [.00 .00 1.00 1.0];	num_notes = 11;	pscore = cell(num_notes,8);	pscore(1,:) = {0 .12 3700 600 .05 grayone amp [1 1]};	pscore(2,:) = {.18 .08 3000 800 .07 graytwo amp [1 1]};	pscore(3,:) = {.28 .12 3700 600 .12 grayone amp [1 1]};	pscore(4,:) = {.44 .08 3000 800 .15 graytwo amp [1 1]};	pscore(5,:) = {.54 .12 3700 600 .20 grayone amp [1 1]};	pscore(6,:) = {.72 .08 3000 800 .25 graytwo amp [1 1]};	pscore(7,:) = {.82 .12 3700 600 .25 grayone amp [1 1]};	pscore(8,:) = {.96 .2 3000 2000 .2 graythree amp [1 1]};	pscore(9,:) = {1.2 .02 4500 500 .05 grayfour amp [1 1]};	pscore(10,:) = {1.25 .02 4200 800 .05 grayfour amp [1 1]};	pscore(11,:) = {1.3 .02 4000 900 .05 grayfour amp [1 1]};end	%%%%%%%%if (max(strcmp(birdname,{'all', 'Cassins_Kingbird'})))	%fprintf('Cassins_Kingbird\n');	kingfirst = [.00 .30 .45 1.00 .90 .10 1.00 .0];	kingsecond = [.00 .00 .02 .50 .04 .00 .06 .55 .08 .05 .10 .60 .12...			.05 .14 .65 .16 .10 .18 .70 .20 .10 .22 .75 .24 .15 .26...			.80 .28 .20 .30 .85 .32 .25 .34 .90 .36 .30 .38 .95 .40...			.40 .42 1.00 .44 .50 .46 1.00 .48 .45 .50 1.00 .52 .50...			.54 1.00 .56 .40 .58 .95 .60 .40 .62 .90 .64 .40 .66 .85...			.68 .35 .70 .80 .72 .30 .74 .75 .76 .25 .78 .70 .80 .20...			.82 .65 .84 .10 .86 .60 .88 .00 .90 .55 .92 .00 .94 .50...			.96 .00 1.00 .40];	num_notes = 2;	pscore = cell(num_notes,8);	pscore(1,:) = {.03 .04 1700 1200 .15 kingfirst amp [1 1 2 .5 3 0 4 .2]};	pscore(2,:) = {.12 .18 1700 900 .25 kingsecond amp [1 1 2 .01 3 0 4 .1]};end	%%%%%%%%if (max(strcmp(birdname,{'all', 'Black_Necked_Stilt'})))	%fprintf('Black_Necked_Stilt\n');	upamp = [.00 .00 .90 1.00 1.00 .0];	rampup = [.00 .00 .50 1.00 1.00 .20];	num_notes = 3;	pscore = cell(num_notes,8);	pscore(1,:) = {0 .1 900 100 .2 rampup upamp [1 .5  2 1 3 .75 4 .5  5 .1]};	pscore(2,:) = {.30 .1 900 200 .2 rampup upamp [1 .5  2 1 3 .75 4 .5  5 .1]};	pscore(3,:) = {.60 .1 900 250 .2 rampup upamp [1 .5  2 1 3 .75 4 .5  5 .1]};end	%%%%%%%%if (max(strcmp(birdname,{'all', 'Chestnut_Sided_Warbler'})))	%fprintf('Chestnut_Sided_Warbler\n');	ycurve = [.00 1.00 .30 .50 .60 1.00 .80 .20 1.00 .0];	vcurve = [.00 .20 .50 1.00 1.00 .0];	wcurve = [.00 .50 .15 .00 .45 .10 .60 1.00 .70 .90 1.00 .90];	upcurve = [.00 .00 .95 1.00 1.00 1.0];	downcurve = [.00 1.00 .25 .30 .60 .15 1.00 .0];	louder = [.00 .00 .90 1.00 1.00 .0];	wamp = [.00 .00 .10 1.00 .40 .10 .50 .90 .60 .10 .70 1.00 1.00 .0];	partials = [1 1 2 .1];	num_notes = 13;	pscore = cell(num_notes,8);	pscore(1,:) = {.1 .1 4050 1200 .05 ycurve amp partials};	pscore(2,:) = {.25 .03 3900 300 .075 vcurve amp partials};	pscore(3,:) = {.3 .1 4050 1200 .15 ycurve louder partials};	pscore(4,:) = {.42 .03 3800 500 .1 vcurve amp partials};	pscore(5,:) = {.5 .1 4000 1200 .2 ycurve tap partials};	pscore(6,:) = {.65 .03 3800 500 .15 vcurve amp partials};	pscore(7,:) = {.72 .1 4000 1200 .2 ycurve tap partials};	pscore(8,:) = {.85 .03 3800 500 .15 vcurve amp partials};	pscore(9,:) = {.91 .1 4000 1200 .2 ycurve tap partials};	pscore(10,:) = {1.05 .12 3800 2200 .15 wcurve wamp partials};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -