Gast
#2398892
Hallo zusammen,
ich hoffe ich bin hier richtig und finde hier antworten.
Ich versuche ein Programm zu schreiben, mit dem ich Sprache aufnehmen
kann (z.B. das Wort "Maus") und dann davon ein Spektrogramm und ein
Spektrum zu erstellen und dann, das ist die eignetliche Aufgabe, die
Grundfreuquenz von der Sprache zu ermitteln.
Ich habe in Matlab nun das Gui erstellt und kann nun auch aufnehmen und
das Spektrogramm und Spektrum erzeugen. Hoffe bis hierhin ist das
richtig.
Aber nun komm ich leider nicht weiter. Ich weiß nicht wie ich an die
Grundfrequenz rangehen soll um diese zu ermitteln.
Kann mir da jmd helfen. Was Matlab anbelangt bin ich noch recht
unerfahren...!
Unten mal mein Code, den ich bisher habe. Allerdings bin ich mir noch
nicht mal sicher ob ich die richtige Spektrum Funktion gewählt habe.
Vielen, vielen Dank für Lösungsansätze, Tips und Hinweise.
MFG
Anhang[]
% Speicher und Fensterinhalt löschen
clear all
clc
% Oberfläche
figure (1)
set(gcf,'menubar','none','units','normalized')
uimenu ('label','&Fenster schließen','callback','close')
% Buttons
Button1 = uicontrol (gcf,...
'Style','Push',...
'Position', [10 350 70 30],...
'String', 'Record',...
'Callback','Record');
Button2 = uicontrol (gcf,...
'Style','Push',...
'Position', [10 315 70 30],...
'String','Play',...
'Callback','Play');
Button3 = uicontrol(gcf,...
'Style','Push',...
'Position', [10 210 110 30],...
'String', 'Draw spectogram',...
'Callback', 'Spectrogramm');
Button4 = uicontrol(gcf,...
'Style','Push',...
'Position', [10 175 90 30],...
'String', 'Draw Spectrum',...
'Callback', 'SpeKctrum');
Button5 = uicontrol(gcf,...
'Style','Push',...
'Position', [10 140 135 30],...
'String', 'Calculate Grundfrequenz',...
'Callback', 'pksGF');
% Grafik erstellen
set (gca,...
'Position',[.4 .1 .5 .8])
% Grafikbeschriftung figure (1)
% axis ([1 10 -5 5])
title ('Amplituden-Zeit-Diagramm')
ylabel ('Amplitude')
xlabel ('Zeit [s]')
------------------------------------------------------------------------
-
%Deklaration
Fs = 44100; %Fs = Abtastrate
nbits = 16; %Bits per sample
nChannels = 1; %The number of channels: 1 (mono) or 2 (stereo).
length = 3; %Length of record
%Aufnahme
RecordObj = audiorecorder(Fs, nbits, nChannels);
get(RecordObj);
% Record your voice for 3 seconds.
RecordObj = audiorecorder;
disp('Start speaking...')
recordblocking(RecordObj, length);
%recordblocking = Does not return control until recording completes.
disp('End of Recording!');
% Store data in double-precision (doppelte Genauigkeit) array.
% Scheint wohl der Vektor zu sein
myRecording = getaudiodata(RecordObj);
% Plot the waveform. Linien = -/--/:/-.
% Punkte = ./+/*/o/x
% Farbe = r/b/y/g
set (gca,'Position',[.4 .1 .5 .8])
plot(myRecording,'r');
% axis ([1 10 -5 5])
% Grafikbeschriftung
title ('Amplituden-Zeit-Diagramm')
ylabel ('Amplitude')
xlabel ('Zeit [s]')
------------------------------------------------------------------------
--
% Play back the recording.
play(RecordObj);
% "playblocking" = Play, and do not return control until playback
% completes.
------------------------------------------------------------------------
--
%Deklaration
x = myRecording;
% Spectrogram
figure(2)
spectrogram (x,128,120,128,1E3);
title ('Spectrogram')
view(270,90);
------------------------------------------------------------------------
-
%Deklaration
x = myRecording;
%Spectrum --> spectrum.periodogram
figure(3)
Hs = spectrum.periodogram;
psd(Hs,x,'Fs',Fs)
title ('Spectrum.periodogram')