(New page: %Steve Anderson %Homework 1 Problem 2 clear; clc; [data, srate, brate] = wavread('jpforward.wav'); %reads wav file and stores to array wavplay(data,srate); %play the song normally x = ...) |
(→sound files) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
− | + | == sound files == | |
− | + | ||
− | + | == matlab code == | |
− | + | ||
− | |||
− | jpreverse = zeros(x,1); | + | %Steve Anderson |
− | counter = 1; | + | %Homework 1 Problem 2 |
− | + | ||
− | for i = x:-1:1 %for loop from end of song to beginning | + | clear; |
− | + | clc; | |
− | + | ||
− | end | + | [data, srate, brate] = wavread('jpforward.wav'); %reads wav file and stores to array |
− | + | wavplay(data,srate); %play the song normally | |
− | %play reversed version of song | + | |
− | wavplay(jpreverse, srate); | + | x = length(data); %length of song array |
− | + | ||
− | wavwrite(jpreverse, srate, brate, 'jpreversed.wav'); | + | jpreverse = zeros(x,1); |
− | + | counter = 1; | |
− | %create and play song reversed but slower | + | |
− | wavplay(jpreverse, srate/1.75); | + | for i = x:-1:1 %for loop from end of song to beginning |
− | wavwrite(jpreverse, srate/1.75, brate, 'jprevslow.wav'); | + | jpreverse(counter) = data(x); %reverse song into jpreverse |
+ | counter = counter + 1; | ||
+ | end | ||
+ | |||
+ | %play reversed version of song | ||
+ | wavplay(jpreverse, srate); | ||
+ | |||
+ | wavwrite(jpreverse, srate, brate, 'jpreversed.wav'); | ||
+ | |||
+ | %create and play song reversed but slower | ||
+ | wavplay(jpreverse, srate/1.75); | ||
+ | wavwrite(jpreverse, srate/1.75, brate, 'jprevslow.wav'); |
Latest revision as of 06:49, 5 September 2008
sound files
matlab code
%Steve Anderson %Homework 1 Problem 2 clear; clc; [data, srate, brate] = wavread('jpforward.wav'); %reads wav file and stores to array wavplay(data,srate); %play the song normally x = length(data); %length of song array jpreverse = zeros(x,1); counter = 1; for i = x:-1:1 %for loop from end of song to beginning jpreverse(counter) = data(x); %reverse song into jpreverse counter = counter + 1; end %play reversed version of song wavplay(jpreverse, srate); wavwrite(jpreverse, srate, brate, 'jpreversed.wav'); %create and play song reversed but slower wavplay(jpreverse, srate/1.75); wavwrite(jpreverse, srate/1.75, brate, 'jprevslow.wav');