Browse Source

Gefilterte Musikdatei erstellen update

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
seyffejn 3 years ago
parent
commit
a3c3c34936

+ 26
- 22
TinnitusAnalyse/.idea/workspace.xml View File

<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="5b3f2136-e422-4072-84be-e86e40fa2d55" name="Default Changelist" comment=""> <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$/.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> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/TinnitusAnalyse_GUI.py"> <entry file="file://$PROJECT_DIR$/TinnitusAnalyse_GUI.py">
<provider selected="true" editor-type-id="text-editor"> <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> <folding>
<element signature="e#0#117#0" expanded="true" />
<element signature="e#0#30#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
<file pinned="false" current-in-tab="false"> <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"> <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"> <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" /> <caret line="2211" column="41" selection-start-line="2211" selection-start-column="41" selection-end-line="2211" selection-end-column="41" />
</state> </state>
</provider> </provider>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/SoundGenerator.py"> <entry file="file://$PROJECT_DIR$/SoundGenerator.py">
<provider selected="true" editor-type-id="text-editor"> <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> <folding>
<element signature="e#0#42#0" expanded="true" /> <element signature="e#0#42#0" expanded="true" />
</folding> </folding>
<find>500</find> <find>500</find>
<find>Text</find> <find>Text</find>
<find>name</find> <find>name</find>
<find>unten_button_play_press</find>
<find>StringVar</find>
<find>Speichern</find>
</findStrings> </findStrings>
<dirStrings> <dirStrings>
<dir>C:\Users\Julian\PycharmProjects\TinnitusAnalyse</dir> <dir>C:\Users\Julian\PycharmProjects\TinnitusAnalyse</dir>
</option> </option>
</component> </component>
<component name="ProjectFrameBounds" extendedState="7"> <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="width" value="1113" />
<option name="height" value="769" /> <option name="height" value="769" />
</component> </component>
<window_info id="Favorites" order="2" side_tool="true" /> <window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" /> <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="Debug" order="3" weight="0.3990647" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
</state> </state>
</provider> </provider>
</entry> </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"> <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python35/Lib/tkinter/__init__.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17034"> <state relative-caret-position="17034">
</state> </state>
</provider> </provider>
</entry> </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"> <entry file="file://$PROJECT_DIR$/SoundGenerator.py">
<provider selected="true" editor-type-id="text-editor"> <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> <folding>
<element signature="e#0#42#0" expanded="true" /> <element signature="e#0#42#0" expanded="true" />
</folding> </folding>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/TinnitusAnalyse_GUI.py"> <entry file="file://$PROJECT_DIR$/TinnitusAnalyse_GUI.py">
<provider selected="true" editor-type-id="text-editor"> <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> <folding>
<element signature="e#0#117#0" expanded="true" />
<element signature="e#0#30#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>

BIN
TinnitusAnalyse/BeispielMusikDateien/Antonio Vivaldi Herbst 1. Satz _ HD (128 kbps).mp3 View File


BIN
TinnitusAnalyse/BeispielMusikDateien/Antonio Vivaldi Herbst 1. Satz _ HD (128 kbps).wav View File


BIN
TinnitusAnalyse/BeispielMusikDateien/Foo Fighters - The Pretender (128 kbps).mp3 View File


BIN
TinnitusAnalyse/BeispielMusikDateien/Foo Fighters - The Pretender (128 kbps).wav View File


BIN
TinnitusAnalyse/BeispielMusikDateien/MEUTE - You & Me (Flume Remix) (128 kbps).mp3 View File


BIN
TinnitusAnalyse/BeispielMusikDateien/MEUTE - You & Me (Flume Remix) (128 kbps).wav View File


+ 68
- 0
TinnitusAnalyse/TinnitusAnalyse_GUI.py View File

from tkinter import filedialog
from tkinter.ttk import Frame, Label, Button, LabelFrame, Combobox, Style, Checkbutton, Entry, Panedwindow, Separator from tkinter.ttk import Frame, Label, Button, LabelFrame, Combobox, Style, Checkbutton, Entry, Panedwindow, Separator
from tkinter import * from tkinter import *
from SoundGenerator import * from SoundGenerator import *
root.update() #Damit der Text sofort ausgegeben wird, auch wenn das Programm erst noch was anderes macht 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 """ """ Initialisierungen """
tinnitus = Tinnitus() # siehe SoundGenerator.py tinnitus = Tinnitus() # siehe SoundGenerator.py
sound = Sound(tinnitus) # siehe SoundGenerator.py sound = Sound(tinnitus) # siehe SoundGenerator.py
# lets me place the widget in the middle of the frame # 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() root.mainloop()

BIN
TinnitusAnalyse/output/MeinTinnitus.wav View File


Loading…
Cancel
Save