Mercurial > hg > camir-aes2014
comparison toolboxes/bioakustik_tools/conversion/found_time_make_txt.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 %makes textfiles for already found wavs | |
2 | |
3 clear | |
4 global globalvars; | |
5 addpath('..\vogelst\k-band250905') | |
6 sourcedir='F:\Aufnahmen'; | |
7 %sourcedir='F:\Ample'; | |
8 %sourcedir='M:\PrograMathe\matlab\work\hiwi\vogelst\testmaterial\online2'; | |
9 | |
10 segmentsdir='F:\viele_einzelne_strophen\blaumeise\typ1'; | |
11 | |
12 %segmentsdir='F:\viele_einzelne_strophen\fringila_coelebs_buchfink\tst'; | |
13 %segmentsdir='M:\PrograMathe\matlab\work\hiwi\vogelst\testmaterial\online'; | |
14 | |
15 | |
16 | |
17 %---------------------------------------------z-------------zugehörige dateien suchen | |
18 allpaths=genpath(sourcedir); | |
19 data_names=dir(strcat(segmentsdir,'\*.wav')); | |
20 psourcedirs = explode(';',allpaths); | |
21 for i = 1:length(data_names) | |
22 ldata_names{i} = data_names(i).name; | |
23 end | |
24 | |
25 names_done = []; | |
26 relsource_files = {}; | |
27 for i = 1:length(psourcedirs) | |
28 actdir = dir(strcat(psourcedirs{i},'\*.wav')); | |
29 ldata_names = ldata_names(setdiff(1:length(ldata_names),names_done)); | |
30 for j = 1:length(ldata_names) | |
31 for k = 1:length(actdir) | |
32 if(strncmp(actdir(k).name,ldata_names{j},length(ldata_names{j})-(7+2*6+1+3))) && ... | |
33 strncmp(substr(ldata_names{j},-(7+4),1),'-',1) | |
34 names_done = [names_done j]; | |
35 relsource_files= cat(1,relsource_files,{[strcat(psourcedirs{i},'\',actdir(k).name)] [strcat(segmentsdir,'\',ldata_names{j})]}); | |
36 end | |
37 end | |
38 end | |
39 end | |
40 | |
41 | |
42 for i=1:size(relsource_files,1) | |
43 newfilename=char(relsource_files(i,2)); | |
44 position(i,2)= hhmmss_to_s(substr(newfilename,-(7+3),6)); | |
45 position(i,1)= hhmmss_to_s(substr(newfilename,-(7+3+7),6)); | |
46 | |
47 filetoopen=strcat(newfilename,'.txt'); | |
48 ftoex=dir(filetoopen); | |
49 if(length(ftoex)==0) | |
50 FID = fopen(filetoopen,'w'); | |
51 fprintf(FID,'%s','annotations for '); | |
52 fprintf(FID,'%s',newfilename); | |
53 fprintf(FID,'\n'); | |
54 fprintf(FID,'%s','sourcefile available at'); | |
55 fprintf(FID,'\n'); | |
56 fprintf(FID,'%s',char(relsource_files(i,1))); | |
57 fprintf(FID,'\n'); | |
58 fprintf(FID,'%s','time of occurrence in hhmmss format:'); | |
59 fprintf(FID,'\n'); | |
60 fprintf(FID,'%s',s_to_hhmmss(position(i,1))); | |
61 fprintf(FID,'%s','-'); | |
62 fprintf(FID,'%s',s_to_hhmmss(position(i,2))); | |
63 fprintf(FID,'\n'); | |
64 fprintf(FID,'%s','in seconds:'); | |
65 fprintf(FID,'\n'); | |
66 fprintf(FID,'%s',sprintf('%d',position(i,1))); | |
67 fprintf(FID,'\n'); | |
68 fprintf(FID,'%s',sprintf('%d',position(i,2))); | |
69 fprintf(FID,'\n'); | |
70 fprintf(FID,'%s','comments:'); | |
71 | |
72 fclose(FID); | |
73 end | |
74 end | |
75 |