Die Tkinter Buttons hinzugefügt zur Auswahl der Musikdatei(.mp3 oder .wav bisher) und seiner eigenen Tinnitus.wav Datei. Bisher sind die Buttons noch leer also ohne viel Funktionalität hintendran. Einige Biespiel Musikdateien zum versuchen hinzugefügt (siehe Unterordner "BiespielMusikDateien")master
@@ -3,7 +3,8 @@ | |||
<component name="ChangeListManager"> | |||
<list default="true" id="5b3f2136-e422-4072-84be-e86e40fa2d55" name="Default Changelist" comment=""> | |||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/TinnitusDaten.csv" beforeDir="false" afterPath="$PROJECT_DIR$/TinnitusDaten.csv" afterDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/TinnitusAnalyse_GUI.py" beforeDir="false" afterPath="$PROJECT_DIR$/TinnitusAnalyse_GUI.py" afterDir="false" /> | |||
<change beforePath="$PROJECT_DIR$/output/MeinTinnitus.wav" beforeDir="false" afterPath="$PROJECT_DIR$/output/MeinTinnitus.wav" afterDir="false" /> | |||
</list> | |||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> | |||
<option name="SHOW_DIALOG" value="false" /> | |||
@@ -16,10 +17,10 @@ | |||
<file pinned="false" current-in-tab="true"> | |||
<entry file="file://$PROJECT_DIR$/TinnitusAnalyse_GUI.py"> | |||
<provider selected="true" editor-type-id="text-editor"> | |||
<state relative-caret-position="301"> | |||
<caret line="95" column="46" selection-start-line="95" selection-start-column="46" selection-end-line="95" selection-end-column="46" /> | |||
<state relative-caret-position="321"> | |||
<caret line="198" column="81" lean-forward="true" selection-start-line="198" selection-start-column="81" selection-end-line="198" selection-end-column="81" /> | |||
<folding> | |||
<element signature="e#0#117#0" expanded="true" /> | |||
<element signature="e#0#30#0" expanded="true" /> | |||
</folding> | |||
</state> | |||
</provider> | |||
@@ -28,7 +29,7 @@ | |||
<file pinned="false" current-in-tab="false"> | |||
<entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python35/Lib/site-packages/scipy/signal/filter_design.py"> | |||
<provider selected="true" editor-type-id="text-editor"> | |||
<state relative-caret-position="37298"> | |||
<state relative-caret-position="884"> | |||
<caret line="2211" column="41" selection-start-line="2211" selection-start-column="41" selection-end-line="2211" selection-end-column="41" /> | |||
</state> | |||
</provider> | |||
@@ -46,8 +47,8 @@ | |||
<file pinned="false" current-in-tab="false"> | |||
<entry file="file://$PROJECT_DIR$/SoundGenerator.py"> | |||
<provider selected="true" editor-type-id="text-editor"> | |||
<state relative-caret-position="564"> | |||
<caret line="142" column="60" lean-forward="true" selection-start-line="142" selection-start-column="60" selection-end-line="142" selection-end-column="60" /> | |||
<state relative-caret-position="942"> | |||
<caret line="141" column="36" selection-start-line="141" selection-start-column="36" selection-end-line="141" selection-end-column="36" /> | |||
<folding> | |||
<element signature="e#0#42#0" expanded="true" /> | |||
</folding> | |||
@@ -93,6 +94,9 @@ | |||
<find>500</find> | |||
<find>Text</find> | |||
<find>name</find> | |||
<find>unten_button_play_press</find> | |||
<find>StringVar</find> | |||
<find>Speichern</find> | |||
</findStrings> | |||
<dirStrings> | |||
<dir>C:\Users\Julian\PycharmProjects\TinnitusAnalyse</dir> | |||
@@ -117,8 +121,8 @@ | |||
</option> | |||
</component> | |||
<component name="ProjectFrameBounds" extendedState="7"> | |||
<option name="x" value="970" /> | |||
<option name="y" value="-15" /> | |||
<option name="x" value="407" /> | |||
<option name="y" value="-8" /> | |||
<option name="width" value="1113" /> | |||
<option name="height" value="769" /> | |||
</component> | |||
@@ -310,7 +314,7 @@ | |||
<window_info id="Favorites" order="2" side_tool="true" /> | |||
<window_info anchor="bottom" id="Message" order="0" /> | |||
<window_info anchor="bottom" id="Find" order="1" /> | |||
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.2548714" /> | |||
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.24707717" /> | |||
<window_info anchor="bottom" id="Debug" order="3" weight="0.3990647" /> | |||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> | |||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> | |||
@@ -357,13 +361,6 @@ | |||
</state> | |||
</provider> | |||
</entry> | |||
<entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python35/Lib/site-packages/scipy/signal/filter_design.py"> | |||
<provider selected="true" editor-type-id="text-editor"> | |||
<state relative-caret-position="37298"> | |||
<caret line="2211" column="41" selection-start-line="2211" selection-start-column="41" selection-end-line="2211" selection-end-column="41" /> | |||
</state> | |||
</provider> | |||
</entry> | |||
<entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python35/Lib/tkinter/__init__.py"> | |||
<provider selected="true" editor-type-id="text-editor"> | |||
<state relative-caret-position="17034"> | |||
@@ -378,10 +375,17 @@ | |||
</state> | |||
</provider> | |||
</entry> | |||
<entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python35/Lib/site-packages/scipy/signal/filter_design.py"> | |||
<provider selected="true" editor-type-id="text-editor"> | |||
<state relative-caret-position="884"> | |||
<caret line="2211" column="41" selection-start-line="2211" selection-start-column="41" selection-end-line="2211" selection-end-column="41" /> | |||
</state> | |||
</provider> | |||
</entry> | |||
<entry file="file://$PROJECT_DIR$/SoundGenerator.py"> | |||
<provider selected="true" editor-type-id="text-editor"> | |||
<state relative-caret-position="564"> | |||
<caret line="142" column="60" lean-forward="true" selection-start-line="142" selection-start-column="60" selection-end-line="142" selection-end-column="60" /> | |||
<state relative-caret-position="942"> | |||
<caret line="141" column="36" selection-start-line="141" selection-start-column="36" selection-end-line="141" selection-end-column="36" /> | |||
<folding> | |||
<element signature="e#0#42#0" expanded="true" /> | |||
</folding> | |||
@@ -390,10 +394,10 @@ | |||
</entry> | |||
<entry file="file://$PROJECT_DIR$/TinnitusAnalyse_GUI.py"> | |||
<provider selected="true" editor-type-id="text-editor"> | |||
<state relative-caret-position="301"> | |||
<caret line="95" column="46" selection-start-line="95" selection-start-column="46" selection-end-line="95" selection-end-column="46" /> | |||
<state relative-caret-position="321"> | |||
<caret line="198" column="81" lean-forward="true" selection-start-line="198" selection-start-column="81" selection-end-line="198" selection-end-column="81" /> | |||
<folding> | |||
<element signature="e#0#117#0" expanded="true" /> | |||
<element signature="e#0#30#0" expanded="true" /> | |||
</folding> | |||
</state> | |||
</provider> |
@@ -1,3 +1,4 @@ | |||
from tkinter import filedialog | |||
from tkinter.ttk import Frame, Label, Button, LabelFrame, Combobox, Style, Checkbutton, Entry, Panedwindow, Separator | |||
from tkinter import * | |||
from SoundGenerator import * | |||
@@ -171,6 +172,45 @@ def feedback(text, fontcolor="black", backgroundcolor="lightsteelblue"): | |||
root.update() #Damit der Text sofort ausgegeben wird, auch wenn das Programm erst noch was anderes macht | |||
def unten_button_musikdatei_laden_press(): | |||
""" This function opends a window that lets you select .mp3 and .wav files. The user is supposed to select their | |||
music files here""" | |||
print("button musikdatei laden pressed") | |||
untererFrame.musikdatei = filedialog.askopenfilename(initialdir="/", title="Wähle die Musikdatei deiner Wahl aus (.mp3)", | |||
filetypes=(("wav Dateien", "*.wav"), ("mp3 Dateien", "*.mp3"))) | |||
print(untererFrame.musikdatei) | |||
untenTextMusikDatei.config(state=NORMAL) # activate text field (otherwise it is readonly) | |||
untenTextMusikDatei.delete(1.0, END) # delete everything from text widget | |||
untenTextMusikDatei.insert(INSERT, untererFrame.musikdatei) # insert selected file path to text widget | |||
untenTextMusikDatei.config(state=DISABLED) # activate text field (otherwise it is readonly) | |||
feedback("Musikdatei ausgewählt", fontcolor="black") # place text in feedback field, fontcololor, backgroundcolor | |||
def unten_button_tinnitusdatei_laden_press(): | |||
""" This function opends a window that lets you select .mp3 and .wav files. The user is supposed to select their | |||
tinnitus files here""" | |||
print("button tinnitusdatei laden pressed") | |||
untererFrame.tinnitusdatei = filedialog.askopenfilename(initialdir="/", | |||
title="Wähle die Musikdatei deiner Wahl aus (.mp3)", | |||
filetypes=(("wav Dateien", "*.wav"), ("mp3 Dateien", "*.mp3"))) | |||
print(untererFrame.tinnitusdatei) | |||
untenTextTinnitusDatei.config(state=NORMAL) # activate text field (otherwise it is readonly) | |||
untenTextTinnitusDatei.delete(1.0, END) # delete everything from text widget | |||
untenTextTinnitusDatei.insert(INSERT, untererFrame.musikdatei) # insert selected file path to text widget | |||
untenTextTinnitusDatei.config(state=DISABLED) # activate text field (otherwise it is readonly) | |||
feedback("Tinnitusdatei ausgewählt", fontcolor="black") # place text in feedback field, fontcololor, backgroundcolor | |||
def unten_button_filtere_tinnitus_aus_musik(): | |||
print("button filtere tinnitus aus musik pressed") | |||
try: | |||
feedback("Gefilterte Musikdatei erstellt", "blue") | |||
except: | |||
feedback("Fehlgeschlagener Filterversuch!", "red", "white") | |||
""" Initialisierungen """ | |||
tinnitus = Tinnitus() # siehe SoundGenerator.py | |||
sound = Sound(tinnitus) # siehe SoundGenerator.py | |||
@@ -356,5 +396,33 @@ untenFeedbackText.place(relx=.5, rely=.5, anchor="center") # the only time I us | |||
# lets me place the widget in the middle of the frame | |||
# -------------- LOAD MUSIC FILE-------------- | |||
untenTextMusikDatei = Text(untererFrame, height=1, width=50) | |||
untenTextMusikDatei.grid(column=0, row=7, sticky=(N+S+E+W), columnspan=6) | |||
untenTextMusikDatei.insert(INSERT, "Einen Song deiner Wahl hier auswählen") # insert selected file path to text widget | |||
untenTextMusikDatei.config(state=DISABLED) # activate text field (otherwise it is readonly) | |||
untenButtonMusikDateiLaden = Button(untererFrame, text="Musikdatei auswählen", | |||
command=unten_button_musikdatei_laden_press) | |||
untenButtonMusikDateiLaden.grid(column=7, row=7, sticky=(N+S+E+W)) | |||
# --------------- LOAD MEINTINNTISU.WAV FILE--------------------- | |||
untenTextTinnitusDatei = Text(untererFrame, height=1, width=50) | |||
untenTextTinnitusDatei.grid(column=0, row=8, sticky=(N+S+E+W), columnspan=6) | |||
untenTextTinnitusDatei.insert(INSERT, "Deine MeinTinnitus.wav Datei hier auswählen") # insert selected file path to text widget | |||
untenTextTinnitusDatei.config(state=DISABLED) # activate text field (otherwise it is readonly) | |||
untenButtonTinnitusDateiLaden = Button(untererFrame, text="Tinnitusdatei auswählen", | |||
command=unten_button_tinnitusdatei_laden_press) | |||
untenButtonTinnitusDateiLaden.grid(column=7, row=8, sticky=(N+S+E+W)) | |||
untenButtonFiltereTinnitusAusMusik = Button(untererFrame, text="Filtere Tinnitus Frequenzen aus Musik", | |||
command=unten_button_filtere_tinnitus_aus_musik, font="bold", | |||
relief="raised", bg="blue", fg="white",) | |||
untenButtonFiltereTinnitusAusMusik.grid(column=0, row=9, sticky=(N+S+E+W)) | |||
root.mainloop() |