Ladestatus beim Datei-Erstellen wird auf der Kommandozeile ausgegeben
This commit is contained in:
parent
299f82da2f
commit
dda42f6bc4
@ -203,12 +203,13 @@ class Sound:
|
||||
w0 = float(lf/(self.music_samplerate/2)) # Frequency to remove from a signal. If fs is specified, this is in the same units as fs. By default, it is a normalized scalar that must satisfy 0 < w0 < 1, with w0 = 1 corresponding to half of the sampling frequency.
|
||||
Q = 30.0 # Quality factor. Dimensionless parameter that characterizes notch filter -3 dB bandwidth bw relative to its center frequency, Q = w0/bw.
|
||||
|
||||
self.music_data = self.music_data/32767 # convert array from int16 to float
|
||||
self.music_data = self.music_data/32767 * 0.8 # convert array from int16 to float
|
||||
|
||||
b, a = signal.iirnotch(lf, Q, fs=self.music_samplerate)
|
||||
if ll != 0.0:
|
||||
print(self.music_data[20000:20010])
|
||||
print("Links wird gefiltert...")
|
||||
musicLinks = signal.lfilter(b, a , self.music_data[:, 0]) # links
|
||||
print("Filtern beendet")
|
||||
else:
|
||||
musicLinks = self.music_data[:, 0] # ungefiltert, wenn kein Tinnitus angegeben wurde
|
||||
|
||||
@ -232,7 +233,9 @@ class Sound:
|
||||
|
||||
b, a = signal.iirnotch(rf, Q, fs=self.music_samplerate)
|
||||
if rl != 0.0:
|
||||
print("Rechts wird gefiltert...")
|
||||
musicRechts = signal.lfilter(b, a, self.music_data[:, 1]) # rechts
|
||||
print("Filtern beendet")
|
||||
else:
|
||||
musicRechts = self.music_data[:, 1] # ungefiltert, wenn kein Tinnitus angegeben wurde
|
||||
|
||||
@ -248,10 +251,14 @@ class Sound:
|
||||
|
||||
|
||||
# Die Audiosamples schreiben
|
||||
for x in range(self.music_samplerate*5): #Kann mit nframes ersetzt werden, für den ganzen Song
|
||||
print("Musikdatei wird erstellt...")
|
||||
for x in range(self.music_samplerate * 20): #Kann mit nframes ersetzt werden, für den ganzen Song
|
||||
# Die Audiodaten müssen von float in einen passenden int-Wert umgerechnet werden
|
||||
wav_obj.writeframes(struct.pack('h', int(musicLinks[x] * 32767.0))) # Werte für links und rechts werden bei
|
||||
wav_obj.writeframes(struct.pack('h', int(musicRechts[x] * 32767.0))) # wav abwechselnd eingetragen
|
||||
if x % 10000 == 0:
|
||||
fortschritt = x/(self.music_samplerate*20)*100
|
||||
print(" ", round(fortschritt, 1), "%")
|
||||
|
||||
wav_obj.close()
|
||||
print("Speichern beendet.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user