// WAV-3d-Analyse-40 /1.05.2022
// Nur mit Abtastfrequenz von 48000 
// Es werden FFT Frequenzen von 1 bis 500 Hz berechnet
// Das Signal kann von 1 bis 10 verstärkt werden
// Es kann zwischen Kanal 1 und Kanal 2 gewechselt werden
// Es wird im Textfeld Position Sek. die Laufzeit der WAV Datei angezeigt
// Die Start-Position des zu berechnenden Abschnittes wird mit dem Zähler eingestellt
// Es kann zwischen FFT Darstellung und Power Darstellung gewählt werden
// Die Grafik Anzeige kann auf den Frequenzbereich 500 Hz/250 Hz/125 Hz/60 Hz umgeschaltet werden 

// 
// Mit der Taste Save Grafik wird die angezeigte Grafik in einer gif Datei gespeichert
// Mit der Taste Start werden alle oben eingestellten Voreinstellungen aktiviert und neu berechnet

// mit der Playposition wird ein Startpunkt ausgewählt und eine Sequenz 
// von 10 Sekunden Länge wird von diesem Startpunkt an abgespielt

// Mit der Taste Neu wird eine neue WAV Datei ausgewählt
// Nit der Taste Exit wird die Sitzung beendet 
///////////////////////////////////////////////////////////////////////////// 
mclose('all');
clear;
close();
z=struct('pfad','','datei','','pfaddatei','','info','','laufzeit',0,'samplerate',0,'start1',0,'start2',0,'wa',0,'mono',0,'ff',0,'power',0,'aaff',0,'aapp',0,'spiel1',0,'a1',0,'a2',0,'a3',0,'b1',0,'b2',0,'b3',0,'h1',0,'graph1',0,'graph2',0,'f',0,'cm',0,'posi_1',0,'posi_2',0,'kan_l',1,'kan_2',1,'ver_1',1,'ver_2',0,'ueb_1',0,'ueb_2',0,'darst',0,'xa','','rot',[16.  -20.]);
/////////////////////////////////////////////////////////////////////////////
function [z]=sub_neu(z)
// NEUE DATEI AUFRUFEN
// WAV Datei auswählen  
[z.datei,z.pfad]=uigetfile('*.wav','D:\Mdaten');    //WAV Datei wählen
if isequal(z.datei,'');    //Ist eine Date gewählt?
    else
z.pfaddatei=z.pfad+'\'+z.datei;  //Vollständigen Pfad erstellen 
z.info = wavread(z.pfaddatei,'info');  //WAV Info`s laden
disp('//////////////////////////////////////////////////////////')
disp('WAV-Datei: '+z.pfaddatei); //Ausgabe vollständiger Pfad
disp('Kanäle: '+string(z.info(2)));   //Ausgabe Anzahl der Kanäle
disp('Samplerate: '+string(z.info(3)));   //Ausgabe Samplerate 
disp('Dateilänge : '+string(z.info(8)));    //Ausgabe Dateilänge
disp('Laufzeit : '+string(z.info(8)/z.info(3))+' Sekunden'); //Laufzeit in Sek.
disp('//////////////////////////////////////////////////////////')
z.pfaddat=strsplit(z.pfaddatei,'.')
z.laufzeit=floor(z.info(8)/z.info(3)); // lauzeit in sekunden
set(se_dat_a,'string',z.pfaddatei);
xtitle(strsplit(z.datei,'.')(1),'','',''); 
// FFT Window
z.w=window('hn',48000); // fft window
//VOREINSTELLUNGEN
z.aaff=0;
z.aapp=0;
//LAUFZEIT
z.laufzeit=floor(z.info(8)/z.info(3)); // lauzeit in sekunden
set(se_lau_b,'string',string(z.laufzeit));
//POSITION
z.posi_1=0;// vorwahl
z.posi_2=0;// zur berechnung
set(se_pos_c,'value',z.posi_2);// spinner wert
set(se_pos_c,'max',z.laufzeit);//  spinner max
set(se_pla_b,'max',z.laufzeit); //play position max
set(se_pla_b,'value',z.posi_2); // play position anpassen
//KANALWAHL
set(se_kan_b,'string',string(z.info(2)));//anzeige der kanäle
set(se_kan_d,'max',z.info(2)); //spinner max setzen
set(se_kan_d,'value',1); //spinner auf 1 setzen
set(se_kan_e,'string',string(1));//
z.kan_1=1; //vorwahl
z.kan_2=1;// zur berechnung
//VERSTÄRKUNG
z.ver_1=1;// vorwahl
z.ver_2=1; // berechnung
set(se_ver_c,'string',string(z.ver_2));// anzeig berechnung
set(se_ver_b,'value',z.ver_1);// spinner vorwahl
// ÜBERDECKUNG
z.ueb_1=0
z.ueb_2=0
set(se_ueb_g,'value',1);
z.ueb_2=48000;
//
[z]=sub_ein_1(z);//
[z]=sub_ein_2(z);//
//
[z]=rechenwerk1(z);
//
[z]=farbwerk(z)
//
[z]=malen0(z);
//
[z]=achsenx1(z)
end
endfunction
/////////////////////////////////////////////////////////////////////////////
//Einstellungen übernehmen und berechnen
function [z]=sub_ein(z)
// berechnen
if z.datei=='' then
else
[z]=sub_ein_1(z);//
[z]=sub_ein_2(z);//
//
[z]=rechenwerk1(z);
//
[z]=farbwerk(z)
//
[z]=malen0(z);
//
[z]=achsenx1(z)
end
endfunction
/////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// Rechenwerk1
function [z]=rechenwerk1(z)
//RECHENWERK1
// 480 BERECHNUNGEN DURCHFÜHREN 
winH=waitbar('Fast Fourier Transformation und Power Spektrum wird 480 mal berechnet.');
z.start1=(z.posi_2+1)*48000-47999;
z.start2=z.start1+47999;
i=1;
while i<481
    waitbar(i/480,winH);
    //testen
    if z.start1<z.info(8) & z.start2<z.info(8) then
        // normal einlesen
        z.wa=wavread(z.pfaddatei,[z.start1 z.start2]);
        z.mono=z.wa(z.kan_2,:);
        z.mono=z.mono.*z.ver_2
    end
//
    if z.start1<z.info(8) & z.start2>z.info(8) then
        // auffüllen
        z.wa=wavread(z.pfaddatei,[z.start1 z.info(8)]); 
        z.mono=z.wa(z.kan_2,:);
        z.mono=z.mono.*z.ver_2
        d=size(z.mono,2);
        z.mono(d+1:48000)=zeros(1:48000-d);
    end
//
    if z.start1>z.info(8) & z.start2>z.info(8) then
        // nullen 
        z.mono(1:48000)=zeros(1:48000);
    end
//
    [z]=rechenwerk2(z)
    z.aaff(i,1:500)=z.ff(1:500); // fft daten
    z.aapp(i,1:500)=z.power(1:500); // leistungsdaten
    z.start1=z.start1+z.ueb_2;
    z.start2=z.start1+47999;
    i=i+1
end
close(winH);
//
endfunction
/////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// Rechenwerk2
function [z]=rechenwerk2(z)
//RECHENWERK1
// FFT BERECHNEN POWER BERECHNEN
z.mono=z.mono.*z.w;//windows anwenden
z.ff=fft(z.mono,-1,'nonsymmetric'); //Die FFT wird berechnen
z.ff=z.ff/48000;
z.ff=abs(z.ff(2:48000));
// powerspektrum
z.power=abs(z.ff.* conj(z.ff));   //Powerspektrum der FFT berechnen
z.power=z.power(1:500);
z.ff=z.ff(1:500);
// normieren
z.ff=z.ff*4000;// normieren
z.power=z.power*4000;// normieren
endfunction
/////////////////////////////////////////////////////////////////////////////
function [z]=farbwerk(z)
// farbwerk aufbauen
fx=1:1:480;   //X-Achse zum ploten aufbauen 
fy=1:1:500;   //Y-Achse zum ploten aufbauen
//
[z.a1,z.a2,z.a3]=genfac3d(fx,fy,z.aaff(fx,fy));   //Plot fft
[z.b1,z.b2,z.b3]=genfac3d(fx,fy,z.aapp(fx,fy));   //Plot leistung    
//
endfunction
/////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////
// EINSTELLUNGEN VORWAHL
function [z]=sub_ein_1(z)
//EINSTELLUNGEN
//POSITION
z.posi_1=se_pos_c.value; //position voreinstellen
//KANALWAHL
z.kan_1=se_kan_d.value; // kanal voreinstellen
//VERSTÄRKUNG
z.ver_1=se_ver_c.value; // verstärkung voreinstellen
// ÜBERDECKUNG
select 1 //überdeckung voreinstellen
    case se_ueb_b.value then z.ueb_1=1500;
    case se_ueb_c.value then z.ueb_1=3000;
    case se_ueb_d.value then z.ueb_1=6000;
    case se_ueb_e.value then z.ueb_1=12000;
    case se_ueb_f.value then z.ueb_1=24000;
    case se_ueb_g.value then z.ueb_1=48000;
end
endfunction
////////////////////////////////////////////////////////////////////////////
// EINSTELLUNGEN ÜBERNEHMEN
function [z]=sub_ein_2(z)
//EINSTELLUNGEN ÜBERNEHMEN
z.posi_2=z.posi_1;//position
z.kan_2=z.kan_1;// kanal
z.ver_2=z.ver_1;// verstärkung
z.ueb_2=z.ueb_1; //überdeckung

//POSITION
set(se_pos_b,'string',string(z.posi_2));//position anzeige
z.start1=(48000*z.posi_2-1)+1;//position in start übernehmen
z.start2=z.start1+48000;
//KANAL
set(se_kan_e,'string',string(z.kan_2));
//VERSTÄRKUNG
set(se_ver_b,'string',string(z.ver_2));
//ÜBERDECKUNG
set(se_ueb_bb,'string','');
set(se_ueb_cc,'string','');
set(se_ueb_dd,'string','');
set(se_ueb_ee,'string','');
set(se_ueb_ff,'string','');
set(se_ueb_gg,'string','');

select z.ueb_2 
    case 1500 then set(se_ueb_bb,'string','X');
    case 3000 then set(se_ueb_cc,'string','X');
    case 6000 then set(se_ueb_dd,'string','X');
    case 12000 then set(se_ueb_ee,'string','X');
    case 24000 then set(se_ueb_ff,'string','X');
    case 48000 then set(se_ueb_gg,'string','X');
end
z.ueberdeckung=z.ueb_2;
endfunction
////////////////////////////////////////////////////////////////////////////
function [z]=malen0(z)
//
i1=z.aaff;
i2=z.aapp;
if z.aaff==0 | z.aapp==0 then
else
select z.darst
case 1
    [z]=malen1(z)
case 2
    [z]=malen2(z)
end
end

endfunction
/////////////////////////////////////////////////////////////////////////////
function [z]=malen1(z)
// graph 1
if z.graph1 ==0 then else delete(z.graph1);z.graph1=0; end;
z.h1.visible = "on";
sca(z.h1);
plot3d1(z.a1,z.a2,list(z.a3,z.a3),theta=-20,alpha=16,flag=[-1,2,3])
z.graph1=gce();  
z.h1.axes_visible = ["on","on","on"];
////////////////////////////////////////////////////////////////////////////
endfunction
/////////////////////////////////////////////////////////////////////////
function [z]=malen2(z)
// graph 1
if z.graph1 ==0 then else delete(z.graph1);z.graph1=0; end;
z.h1.visible = "on";
sca(z.h1);
plot3d1(z.b1,z.b2,list(z.b3,z.b3),theta=-20,alpha=16,flag=[-1,2,3])
z.graph1=gce();  
z.h1.axes_visible = ["on","on","on"];
////////////////////////////////////////////////////////////////////////////
endfunction
////////////////////////////////////////////////////////////////////////////
function[z]=savgif1(z)
//
if z.pfaddatei=='' then
else
zd=getdate();
zs=z.pfaddat(1)+'_Datum_'+string(zd(1))+'_'+string(zd(2))+'_'+string(zd(6))+'_'+string(zd(7))+'_'+string(zd(8))+'_'+string(zd(9))+'.gif';
xs2gif(gcf(),zs);
end
endfunction
////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
function [z]=abspielen(z)
//
if z.datei=='' then
else
st1=se_pla_b.value*48000-47999;
st2=st1+480000;
z.spiel1=wavread(z.pfaddatei,[st1 st2]);
z.spiel2=z.spiel1(z.kan_2,:);
z.spiel2=z.spiel2*z.ver_2;
playsnd(z.spiel2,48000);
end
endfunction
///////////////////////////////////////////////////////////////////////////
function [z]=achsenx1(z)
//
i=z.ueb_2;
select i
case 1500 //15
z.xa=[string(z.posi_2:1:15+z.posi_2)];
z.h1.x_ticks=tlist(['locations','labels'],[0:32:480],[z.xa]);
//////////
set(se_pla_b,'value',z.posi_2); // laufzeitwert value in formular play spinner

case 3000 //30
z.xa=[string(z.posi_2:1:30+z.posi_2)];
z.h1.x_ticks=tlist(['locations','labels'],[0:16:480],[z.xa]);
//////////
set(se_pla_b,'value',z.posi_2); // laufzeitwert value in formular play spinner

case 6000 //60
z.xa=[string(z.posi_2:1:60+z.posi_2)];
z.h1.x_ticks=tlist(['locations','labels'],[0:8:480],[z.xa]);
//////////
set(se_pla_b,'value',z.posi_2); // laufzeitwert value in formular play spinner

case 12000 //120
z.xa=[string(z.posi_2:10:120+z.posi_2)];
z.h1.x_ticks=tlist(['locations','labels'],[0:40:480],[z.xa]);
//////////
set(se_pla_b,'value',z.posi_2); // laufzeitwert value in formular play spinner

case 24000 //240
z.xa=[string(z.posi_2:10:240+z.posi_2)];
z.h1.x_ticks=tlist(['locations','labels'],[0:20:480],[z.xa]);
//////////
set(se_pla_b,'value',z.posi_2); // laufzeitwert value in formular play spinner

case 48000 //480
z.xa=[string(z.posi_2:15:480+z.posi_2)];
z.h1.x_ticks=tlist(['locations','labels'],[0:15:480],[z.xa]);
//////////
set(se_pla_b,'value',z.posi_2); // laufzeitwert value in formular play spinner
end
z.h1.x_label.text="Sekunden";
z.h1.y_label.text="Frequenz";
z.h1.z_label.text="Amplitude";
[z]=sub_was(z)
endfunction
////////////////////////////////////////////////////////////////////////
// WASSERFALL
function [z]=sub_was(z)
// WASSERFALL
if se_was_a.value==1 then
z.rot=z.h1.rotation_angles;
z.h1.rotation_angles=[0 270]
else
    z.h1.rotation_angles=z.rot;
end
endfunction

/////////////////////////////////////////////////////////////////////////
// FARBTABELLEN
function [z]=sub_far(z)
// Farbtabellen 
select 1
case se_far_a.value then [z]=farbmanager1(z)
case se_far_b.value then [z]=farbmanager2(z)    
case se_far_c.value then [z]=farbmanager3(z)    

end
   
endfunction
//FARBMASNAGEMENT
function [z]=farbmanager1(z)
// FARBE2 
f=jetcolormap(1000);
for i=1:1:1000
d(i)=floor(log(i)*144);
end
d(1)=1;
for i=1:1:1000
nf(i,:)=f(d(i),:);
end
z.cm=nf;
cmm=[0 0 0.2]
z.cm(100,:)=cmm;
z.cm(200,:)=cmm;
z.cm(300,:)=cmm;
z.cm(400,:)=cmm;
z.cm(500,:)=cmm;
z.cm(600,:)=cmm;
z.cm(700,:)=cmm;
z.cm(800,:)=cmm;
z.cm(900,:)=cmm;
//z.cm=jetcolormap(1000)
z.f.color_map = z.cm;
///////////////////////////////////////////
endfunction

//////////////////////////////////////////////////////////////////////////////
//FARBMASNAGEMENT
function [z]=farbmanager2(z)
// FARBE1 Das Original
for i=1:1200
    cm(i,:)=[0 0 0]
end
cm(1:150,:)=jetcolormap(150)
for i=130:1200 
    cm(i,:)=[1 0.2 0]
end
z.cm=cm(30:1030,:);
cmm=[0 0 0.2]
z.cm(100,:)=cmm;
z.cm(200,:)=cmm;
z.cm(300,:)=cmm;
z.cm(400,:)=cmm;
z.cm(500,:)=cmm;
z.cm(600,:)=cmm;
z.cm(700,:)=cmm;
z.cm(800,:)=cmm;
z.cm(900,:)=cmm;
//z.cm=jetcolormap(1000)
z.f.color_map = z.cm;
///////////////////////////////////////////
endfunction
//////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////
//FARBMASNAGEMENT
function [z]=farbmanager3(z)
// FARBE2 
for i=1:1200
    cm(i,:)=[0 0 0]
end
cm(1:200,:)=jetcolormap(200)
for i=200:1200 
    cm(i,:)=[1 0.2 0]
end
z.cm=cm(30:1030,:);
cmm=[0 0 0.2]
z.cm(100,:)=cmm;
z.cm(200,:)=cmm;
z.cm(300,:)=cmm;
z.cm(400,:)=cmm;
z.cm(500,:)=cmm;
z.cm(600,:)=cmm;
z.cm(700,:)=cmm;
z.cm(800,:)=cmm;
z.cm(900,:)=cmm;
//z.cm=jetcolormap(1000)
z.f.color_map = z.cm;
///////////////////////////////////////////
endfunction
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////     S T A R T      //////////////////////////////////////
///////////////////////////////////////////////////////////////////
// Formular erstellen
z.f=figure('position',[10,10,1400,900]);

//z.f.axes_size = [1800,874]
z.f.auto_resize = "on"
z.f.viewport = [0,0]
z.f.figure_name = "WAV-3D-Analyse"
//z.f.figure_id = 0
z.f.info_message = ""
//cm=load('D:\Scilab\cm.dat')
//z.cm=cm;
//z.f.color_map = z.cm;
z.f.pixel_drawing_mode = "copy"
z.f.anti_aliasing = "off"
z.f.immediate_drawing = "on"
z.f.background =  -2
z.f.visible = "on"
z.f.rotation_style = "unary"
//z.f.event_handler = ""
//z.f.event_handler_enable = "off"
z.f.user_data = []
z.f.resizefcn = ""
z.f.closerequestfcn = ""
z.f.resize = "on"
//z.f.toolbar_visible = "on"
z.f.dockable = "on"
//z.f.layout = "none"
//z.f.layout_options = "OptNoLayout"
z.f.default_axes = "on"
z.f.icon = ""
z.f.tag = ""


//'0 %          480s|50 %        240s|75 %        120s|87,5 %       60s|93,75 %     30s'

// controls in das Formular einbauen
////////////////////////////////////voreinstellungen
// LAUFZEIT
se_lau_a=uicontrol(z.f,"style","text",'HorizontalAlignment','center' ,'backgroundcolor',[1 0.8 0.8],'position', [1310 860 70 15],'string','Laufzeit Sek.');
se_lau_b=uicontrol(z.f,"style","text",'FontWeight','bold','HorizontalAlignment','center' ,'backgroundcolor',[1 0.8 0.8],'position', [1310 845 70 15],'string','0');
// KANALZAHL
se_kan_a=uicontrol(z.f,"style","text",'HorizontalAlignment','center' ,'backgroundcolor',[1 0.8 0.8],'position', [1310 820 70 15],'string','Kanalzahl');
se_kan_b=uicontrol(z.f,"style","text",'FontWeight','bold','HorizontalAlignment','center' ,'backgroundcolor',[1 0.8 0.8],'position', [1310 805 70 15],'string','1');


// POSITION 
se_pos_a=uicontrol(z.f,"style","text",'HorizontalAlignment','center' ,'backgroundcolor',[0.1 1 0.8],'position', [1310 780 70 15],'string','Position Sek.');
se_pos_b=uicontrol(z.f,"style","text",'FontWeight','bold','HorizontalAlignment','center' ,'backgroundcolor',[1 0.8 0.8],'position', [1310 765 70 15],'string','0'); // anzeige
se_pos_c=uicontrol(z.f,"style","spinner", 'position', [1310 745 70 20],'HorizontalAlignment','center','VerticalAlignment','middle','min',0,'max',0,'SliderStep',[1,10],'Title_position','top','callback','[z]=sub_ein_1(z)');// spinner
//z.posi=se_pos_c.value

// KANALWAHL
se_kan_c=uicontrol(z.f,"style","text",'HorizontalAlignment','center' ,'backgroundcolor',[0.1 1 0.8],'position', [1310 720 70 15],'string','Kanalwahl');
se_kan_d=uicontrol(z.f,"style","spinner", 'position', [1340 700 40 20],'HorizontalAlignment','center','VerticalAlignment','middle','min',1,'max',1,'SliderStep',[1,10],'Title_position','top','callback','[z]=sub_ein_1(z)');
se_kan_e=uicontrol(z.f,"style","text",'FontWeight','bold','HorizontalAlignment','center' ,'backgroundcolor',[1 0.8 0.8],'position', [1310 700 30 20],'string','1');

// VERSTÄRKUNG
se_ver_a=uicontrol(z.f,"style","text",'HorizontalAlignment','center' ,'backgroundcolor',[0.1 1 0.8],'position', [1310 675 70 15],'string','Verstärkung');
se_ver_b=uicontrol(z.f,"style","text",'FontWeight','bold','HorizontalAlignment','center' ,'backgroundcolor',[1 0.8 0.8],'position', [1310 655 30 20],'string','1');
se_ver_c=uicontrol(z.f,"style","spinner", 'position', [1340 655 40 20],'HorizontalAlignment','center','VerticalAlignment','middle','min',1,'max',10,'SliderStep',[1,10],'Title_position','top','callback','[z]=sub_ein_1(z)');

// ÜBERDECKUNG
//1500/15s 3000/30s 6000/60s 12000/120s 24000/240s 48000/240s'
se_ueb_a=uicontrol(z.f,"style","text",'HorizontalAlignment','center' ,'backgroundcolor',[0.1 1 0.8],'position', [1310 630 70 15],'string','Überdeckung');
se_ueb_b=uicontrol(z.f,"style","radiobutton",'groupname','ueb','HorizontalAlignment','left','TooltipString','Überdeckung 96,875%. Rechenschritt 1500 Samples. 15 Sekunden.','position', [1325 610 55 20],'string','46500','callback','[z]=sub_ein_1(z)');
se_ueb_bb=uicontrol(z.f,"style","text",'FontWeight','bold','HorizontalAlignment','center' ,'backgroundcolor',[1 0.8 0.8],'position', [1310 610 15 20],'string','');
se_ueb_c=uicontrol(z.f,"style","radiobutton",'groupname','ueb','HorizontalAlignment','left','TooltipString','Überdeckung 93,75%. Rechenschritt 3000 Samples. 30 Sekunden.','position', [1325 590 55 20],'string','45000','callback','[z]=sub_ein_1(z)');
se_ueb_cc=uicontrol(z.f,"style","text",'FontWeight','bold','HorizontalAlignment','center' ,'backgroundcolor',[1 0.8 0.8],'position', [1310 590 15 20],'string','');
se_ueb_d=uicontrol(z.f,"style","radiobutton",'groupname','ueb','HorizontalAlignment','left','TooltipString','Überdeckung 87,5%. Rechenschritt 6000 Samples. 60 Sekunden.','position', [1325 570 55 20],'string','42000','callback','[z]=sub_ein_1(z)');
se_ueb_dd=uicontrol(z.f,"style","text",'FontWeight','bold','HorizontalAlignment','center' ,'backgroundcolor',[1 0.8 0.8],'position', [1310 570 15 20],'string','');
se_ueb_e=uicontrol(z.f,"style","radiobutton",'groupname','ueb','HorizontalAlignment','left','TooltipString','Überdeckung 75%. Rechenschritt 12000 Samples. 120 Sekunden.','position', [1325 550 55 20],'string','36000','callback','[z]=sub_ein_1(z)');
se_ueb_ee=uicontrol(z.f,"style","text",'FontWeight','bold','HorizontalAlignment','center' ,'backgroundcolor',[1 0.8 0.8],'position', [1310 550 15 20],'string','');
se_ueb_f=uicontrol(z.f,"style","radiobutton",'groupname','ueb','HorizontalAlignment','left','TooltipString','Überdeckung 50%. Rechenschritt 24000 Samples. 240 Sekunden.','position', [1325 530 55 20],'string','24000','callback','[z]=sub_ein_1(z)');
se_ueb_ff=uicontrol(z.f,"style","text",'FontWeight','bold','HorizontalAlignment','center' ,'backgroundcolor',[1 0.8 0.8],'position', [1310 530 15 20],'string','');
se_ueb_g=uicontrol(z.f,"style","radiobutton",'groupname','ueb','HorizontalAlignment','left','TooltipString','Überdeckung 0%. Rechenschritt 48000 Samples. 480 Sekunden.','position', [1325 510 55 20],'string','0','callback','[z]=sub_ein_1(z)');
se_ueb_gg=uicontrol(z.f,"style","text",'FontWeight','bold','HorizontalAlignment','center' ,'backgroundcolor',[1 0.8 0.8],'position', [1310 510 15 20],'string','');
se_ueb_g.value=1;
se_ueb_gg.string='X';
// EINSTELLUNG
se_sta_a=uicontrol(z.f,"style","pushbutton","Relief", "raised",'HorizontalAlignment','center' ,'TooltipString','Mit den voreingestellten Werten wird eine neue Berechnung durchgeführt.','position', [1310 485 70 20],'string','Berechnen','callback','[z]=sub_ein(z)');

// NEU
se_neu_a=uicontrol(z.f,"style","pushbutton","Relief", "raised",'TooltipString','Es wird eine neue Datei ausgewählt','position', [1310 460 70 20],'string','Neu','callback','[z]=sub_neu(z)');

// EXIT
se_exi_a=uicontrol(z.f,"style","pushbutton","Relief", "raised",'TooltipString','Das Programm wird beendet.','position', [1310 435 70 20],'string','Exit','callback','close');

// FFT / POWER
se_ffpo_a=uicontrol(z.f,"style","text",'HorizontalAlignment','center' ,'backgroundcolor',[0.1 1 0.8],'position', [1310 410 70 15],'string','FFT / Power');

se_ffpo_b=uicontrol(z.f,"style","radiobutton",'groupname','dada','HorizontalAlignment','left','TooltipString','Es wird die Grafik der FFT angezeigt.','position', [1310 390 70 20],'string','FFT','callback','z.darst=1;[z]=malen0(z)');

se_ffpo_c=uicontrol(z.f,"style","radiobutton",'groupname','dada','HorizontalAlignment','left','TooltipString','Es wird die Grafik des Leistungsspektrums angezeigt.','position', [1310 370 70 20],'string','Power','callback','z.darst=2;[z]=malen0(z)');

se_ffpo_b.value=1;z.darst=1;

// ZOOM
se_zoo_a=uicontrol(z.f,"style","text",'HorizontalAlignment','center' ,'backgroundcolor',[0.1 1 0.8],'position', [1310 345 70 15],'string','X - Achse');
se_zoo_d=uicontrol(z.f,"style","radiobutton",'groupname','zoo','HorizontalAlignment','left','TooltipString','','value',1,'position', [1310 325 70 20],'string','500','callback','z.h1.zoom_box=[0,0,480,500]');
se_zoo_e=uicontrol(z.f,"style","radiobutton",'groupname','zoo','HorizontalAlignment','left','TooltipString','','position', [1310 305 70 20],'string','250','callback','z.h1.zoom_box=[0,0,480,250]');
se_zoo_f=uicontrol(z.f,"style","radiobutton",'groupname','zoo','HorizontalAlignment','left','TooltipString','','position', [1310 285 70 20],'string','125','callback','z.h1.zoom_box=[0,0,480,125]');
se_zoo_g=uicontrol(z.f,"style","radiobutton",'groupname','zoo','HorizontalAlignment','left','TooltipString','','position', [1310 265 70 20],'string','60','callback','z.h1.zoom_box=[0,0,480,60]');


/////////////////////////////////////////////////////////////////////////////////////////////////
// SAVEGRAFIK
se_sav_a=uicontrol(z.f,"style","pushbutton","Relief", "raised",'HorizontalAlignment','center' ,'TooltipString','Die Grafik wird als GIF Datei abgespeichert.','position', [1310 10 70 20],'string','Save Grafik','callback','[z]=savgif1(z)');

// POSITION PLAY
se_pla_a=uicontrol(z.f,"style","text",'HorizontalAlignment','center' ,'backgroundcolor',[0.1 1 0.8],'position', [1310 230 70 15],'string','Play Position');
se_pla_b=uicontrol(z.f,"style","spinner",'TooltipString','Die Position auswählen von der ab 10 Sekunden abgespielt werden.', 'position', [1310 210 70 20],'HorizontalAlignment','center','VerticalAlignment','middle','min',1,'max',1,'SliderStep',[1,10],'Title_position','top','callback','');
z.spiel1=se_pla_b.value
se_pla_c=uicontrol(z.f,"style","pushbutton","Relief", "raised",'TooltipString','Von der angezeigten Position an werden 10 Sekunden abgespielt.', 'position', [1310 180 70 20],'string','Play 10 Sek.','callback','[z]=abspielen(z)');
// FARBTABELLEN
se_far=uicontrol(z.f,"style","text",'HorizontalAlignment','center' ,'backgroundcolor',[0.1 1 0.8],'position', [1310 150 70 15],'string','Farbtabellen');
se_far_a=uicontrol(z.f,"style","radiobutton",'groupname','far','HorizontalAlignment','left','value',1,'position', [1310 130 70 20],'string','Farben 1','callback','[z]=sub_far(z)');
se_far_b=uicontrol(z.f,"style","radiobutton",'groupname','far','HorizontalAlignment','left','value',0,'position', [1310 110 70 20],'string','Farben 2','callback','[z]=sub_far(z)');
se_far_c=uicontrol(z.f,"style","radiobutton",'groupname','far','HorizontalAlignment','left','value',0,'position', [1310 90 70 20],'string','Farben 3','callback','[z]=sub_far(z)');

//////////////////////////////////////////////////////
//WASSERFALL
se_was=uicontrol(z.f,"style","text",'HorizontalAlignment','center' ,'backgroundcolor',[0.1 1 0.8],'position', [1310 60 70 15],'string','Wasserfall');
se_was_a=uicontrol(z.f,"style","radiobutton",'HorizontalAlignment','left','value',0,'position', [1310 40 70 20],'string','Ein / Aus','callback','[z]=sub_was(z)');


// DATEIANZEIGE
se_dat_a=uicontrol(z.f,"style","text",'FontWeight','bold','backgroundcolor',[1 0.95 0.85],'TooltipString','Die mit NEU ausgewählte Datei wird angezeigt','HorizontalAlignment','left' ,'position', [50 10 900 20],'string','Keine Datei ausgewählt.');
se_dat_b=uicontrol(z.f,"style","text",'FontWeight','bold','HorizontalAlignment','left' ,'position', [1000 10 280 20],'string','  Nur für Wav Dateien mit 48000 Hz Samplerate.');


// LINIEN NEBEN DEN SCHALTELEMENTEN
se_lin_a=uicontrol(z.f,"style","text",'backgroundcolor',[1 0.8 0.8],'position', [1380 805 5 70],'string','');
se_lin_b=uicontrol(z.f,"style","text",'backgroundcolor',[0.1 1 0.8],'position', [1380 485 5 310],'string','');
se_lin_d=uicontrol(z.f,"style","text",'backgroundcolor',[0.1 1 0.8],'position', [1380 180 5 65],'string','');

////////////////////////////////////////////////////////////
[z]=achsenx1(z)
//////////////////////////////////////garphicfenster einbauen
z.h1 = newaxes(); // 
z.h1.axes_bounds = [-0.05,-0.05,1.17,1.05];
///////////////////////////////////////////////beschriftung x achse
///////////////////////////////////////////////
sca(z.h1)
z.h1.visible = "on"
z.h1.axes_visible = ["on","on","on"]
z.h1.axes_reverse = ["on","off","off"]
z.h1.grid = [1,1,1]
z.h1.grid_position = "background"
z.h1.grid_thickness = [1,1,1]
z.h1.grid_style = [1,1,1]
z.h1.x_location = "bottom"
z.h1.y_location = "left"
z.h1.auto_ticks = ["off","off","off"]
z.h1.z_ticks=tlist(['locations','labels'],[0:100:1000],string([0:0.1:1]));
z.h1.y_ticks=tlist(['locations','labels'],[0:10:500],string([0:10:500]));
z.xa=[string(z.posi_2:15:z.posi_2+480)];
z.h1.x_ticks=tlist(['locations','labels'],[0:15:480],[z.xa]);
z.h1.ticks_format = ["","",""]
z.h1.ticks_st = [1,1,1;0,0,0]
z.h1.box = "back_half"
z.h1.filled = "on"
z.h1.sub_ticks = [9,9,9]
z.h1.font_style = 6
z.h1.font_size = 2
z.h1.font_color = -1
z.h1.fractional_font = "off"

z.h1.title.font_size=2;
//z.h1.title.text=z.pfaddatei;
z.h1.x_label.font_size=2;
z.h1.x_label.text="Sekunden";
z.h1.x_label.visible="on";
z.h1.y_label.font_size=2;
z.h1.y_label.text="Frequenz";
z.h1.y_label.visible="on";
z.h1.z_label.font_size=2;
z.h1.z_label.text="Amplitude";
z.h1.z_label.visible="on"; 
//z.h1.legend=z.pfaddatei; 
 
z.h1.isoview = "off"
z.h1.cube_scaling = "on"
z.h1.view = "3d"
z.h1.rotation_angles = [10,-10]
z.h1.log_flags = "nnn"
z.h1.tight_limits = ["on","on","on"]

z.h1.zoom_box = []
z.h1.auto_margins = "off"
z.h1.margins = [0.07,0.165,0.08,0.11]
z.h1.axes_bounds = [-0.05,-0.05,1.17,1.05]
z.h1.auto_clear = "off"
z.h1.auto_scale = "off"
z.h1.hidden_axis_color = 4
z.h1.hiddencolor = 4
z.h1.line_mode = "on"
z.h1.line_style = 1
z.h1.thickness = 1
z.h1.mark_mode = "off"
z.h1.mark_style = 0
z.h1.mark_size_unit = "tabulated"
z.h1.mark_size = 0
z.h1.mark_foreground = -1
z.h1.mark_background = -2
z.h1.foreground = -1
z.h1.background = -2
z.h1.arc_drawing_method = "lines"
z.h1.clip_state = "off"
//z.h1.clip_box = []
z.h1.user_data = []
z.h1.tag = ""
zh(1,3)=0;// Amplitude
zh(2,3)=1000;// Amplitude
zh(1,2)=0;// Frequenz
zh(2,2)=500;// Frequenz
zh(1,1)=0;// Zeit
zh(2,1)=480;//Zeit
z.h1.data_bounds =zh;

/////////////////////////////////////////////////////////////////////////
[z]=sub_far(z)
//////////////////////////////////////////////////////////////////////////
