create_all_songs.m

create_all_songs.m - load_waves(bun) for...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 function create_all_songs %$Revision: 1.2 $ $Author: mmccann $ $Date: 2004/05/09 23:27:37 $ % create_all_songs - Creates a list of all songs. global Gdir Gnum_scans Gall_waves S = load(sprintf('%s/song_struct.mat',Gdir)) song_struct = S.song_struct num_bundles = length(song_struct) cur_song = 1 bun_str(1).first = 1 bun_str(1).last = 1 end for i=2:num_bundles-1 if (song_struct(i-1) < song_struct(i)) cur_song = cur_song+1 bun_str(cur_song).first = i end if (song_struct(i) < song_struct(i+1)) bun_str(cur_song).last = i end end cur_song = cur_song+1 bun_str(cur_song).first = num_bundles end bun_str(cur_song).last = num_bundles % throw out songs with bad bundles valid_count = 0 for i=1:length(bun_str) valid = 1 for bun = bun_str(i).first:bun_str(i).last
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: load_waves(bun) for sector=1:Gnum_scans valid = size(Gall_waves(sector).waves,1) >= 40 end end if valid valid_count = valid_count+1 valid_bun_str(valid_count) = bun_str(i) else disp(sprintf('there are problems in song %d. skipping. ..',i)) end end for i=1:size(valid_bun_str,2) format = 'creating song %d from bundles %d to %d. ..\n' disp(sprintf(format, i, valid_bun_str(i).first, valid_bun_str(i).last)) create_song(valid_bun_str(i).first, valid_bun_str(i).last) save_audio(sprintf('song%d',i),rate_from_align(valid_bun_str(i).first)) Sheet1 Page 2 end function save_audio(name, rate) global Gdir Gmaster filename = sprintf('%s/%s.wav',Gdir,name) wavwrite(Gmaster,rate,filename) disp(sprintf('\nwrote %s with sample rate %d\n', filename, rate)) Sheet1 Page 3 % a new song beginning % the end of a song Sheet1 Page 4...
View Full Document

This note was uploaded on 04/20/2008 for the course ENGR 190 taught by Professor Staff during the Spring '08 term at Santa Clara.

Page1 / 4

create_all_songs.m - load_waves(bun) for...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online