from scipy.signal import find_peaks import bitarray from embedded import Embedded from scipy.signal import find_peaks file = "44 Pianisten 01-Promenade.wav" inp = "export" path = os.path.join(inp, file) pathtxt = os.path.join(inp, file + "_key.txt") #path = 'export/44 Pianisten 01-Promenade.wav' #pathtxt = 'export/44 Pianisten 01-Promenade.wav_key.txt' cs = Embedded(path, None, None, 100, 8, pathtxt) #print(cs.msg) test = cs.ceps[4] peaks, _ = find_peaks(test[0:44]) ceps_mean = np.mean(test[peaks]) #print(ceps_mean) peaks, pros = find_peaks(test[0:44], height=ceps_mean, width=1) #print(peaks) #print(pros)
import librosa as lro, matplotlib.pyplot as plt, math, librosa.display, numpy as np, bitarray, datetime, os import random as rn from audio import Audio from message import Message from scipy.signal import find_peaks import bitarray from embedded import Embedded path = '/media/sf_X_DRIVE/Documents/repros/fromwmtostego/export/doku/decay/1_01/' fig, axs = plt.subplots(3) file = '44 Pianisten 01-Promenade.wav' inp = inp = os.path.join(path, file) pathtxt = os.path.join(path + "txt/", file + "_key.txt") cs0 = Embedded(inp, None, None, 100, 8, pathtxt) axs[0].plot(cs0.Ceps(cs0.y)[0:44], label='Echo Signal', color='red') axs[0].set_title(file) axs[0].set(ylabel='Magnitude') axs[0].set_ylim(-0.2, 0.5) file = '44 Pianisten 03-Promenade 2.wav' inp = inp = os.path.join(path, file) pathtxt = os.path.join(path + "txt/", file + "_key.txt") cs1 = Embedded(inp, None, None, 100, 8, pathtxt) axs[1].plot(cs1.Ceps(cs1.y)[0:44], label='Echo Signal', color='orange') axs[1].set_title(file) axs[1].set(ylabel='Magnitude') axs[1].set_ylim(-0.2, 0.5)
import librosa as lro, matplotlib.pyplot as plt, math, librosa.display, numpy as np, bitarray, datetime, os, scipy as sc import random as rn from audio import Audio from message import Message from scipy.signal import find_peaks import bitarray from embedded import Embedded path = 'export/44 Pianisten 01-Promenade.wav' pathtxt = 'export/44 Pianisten 01-Promenade.wav_key.txt' cs = Embedded(path, None, None) text_file = open(pathtxt, 'r') keyseedtxt = text_file.read().split(';') msglen = 8 keyseed = np.zeros(len(keyseedtxt), dtype=int) for i in range(0, len(keyseedtxt)): keyseed[i] = keyseedtxt[i] segsize = int(math.floor(cs.size / msglen)) seedlen = 100 sym = math.floor(segsize / seedlen) hann = np.hanning(seedlen) keysig = np.zeros(seedlen * sym) id_p = np.where(keyseed == 1)
from scipy.signal import find_peaks import bitarray from embedded import Embedded from scipy.signal import find_peaks file = "44 Pianisten 01-Promenade.wav" inp = "export" path = os.path.join(inp, file) pathtxt = os.path.join(inp, file+"_key.txt") #path = 'export/44 Pianisten 01-Promenade.wav' #pathtxt = 'export/44 Pianisten 01-Promenade.wav_key.txt' cs = Embedded(path, None, None, 100, 8, pathtxt) #print(cs.msg) i = 0 peaks = np.zeros(0) for row in cs.ceps: peak, _ = find_peaks(row[10:44]) ceps_mean = np.mean(row[peak+10])
from scipy.signal import find_peaks import bitarray from embedded import Embedded from scipy.signal import find_peaks file = "44 Pianisten 01-Promenade.wav" inp = "/media/sf_X_DRIVE/Documents/repros/fromwmtostego/export/test_data_03/01010101/" path = os.path.join(inp, file) pathtxt = os.path.join(inp, file+"_key.txt") #path = 'export/44 Pianisten 01-Promenade.wav' #pathtxt = 'export/44 Pianisten 01-Promenade.wav_key.txt' cs = Embedded(path, None, None, 100, 8, pathtxt) text_file = open(pathtxt, 'r') keyseedtxt = text_file.read().split(';') msglen = 8 keyseed = np.zeros(len(keyseedtxt), dtype=int) for i in range(0, len(keyseedtxt)): keyseed[i] = keyseedtxt[i] segsize = int(math.floor(cs.size/msglen)) seedlen = 100
import librosa as lro, matplotlib.pyplot as plt, math, librosa.display, numpy as np, bitarray, datetime, os, scipy as sc, random import random as rn from audio import Audio from message import Message from scipy.signal import find_peaks import bitarray from embedded import Embedded from scipy.signal import find_peaks #file = "44 Pianisten 01-Promenade.wav" ipath = '/media/sf_X_DRIVE/Documents/repros/fromwmtostego/export/doku/moving_window_newalgo/data/' #path = 'export/44 Pianisten 01-Promenade.wav' #pathtxt = 'export/44 Pianisten 01-Promenade.wav_key.txt' text = '' for file in os.listdir(ipath): print(file) inp = os.path.join(ipath, file) pathtxt = os.path.join(ipath + "txt/", file + "_key.txt") cs = Embedded(inp, None, None, 100, 8, pathtxt) print(cs.peaks) print(cs.msg) print('-------------------------------')
from message import Message from scipy.signal import find_peaks import bitarray from embedded import Embedded file = "44 Pianisten 01-Promenade.wav" inp = "export" path = os.path.join(inp, file) pathtxt = os.path.join(inp, file + "_key.txt") #path = 'export/44 Pianisten 01-Promenade.wav' #pathtxt = 'export/44 Pianisten 01-Promenade.wav_key.txt' cs = Embedded(path, None, None, 100, 8, pathtxt) text_file = open(pathtxt, 'r') keyseedtxt = text_file.read().split(';') msglen = 8 keyseed = np.zeros(len(keyseedtxt), dtype=int) for i in range(0, len(keyseedtxt)): keyseed[i] = keyseedtxt[i] segsize = int(math.floor(cs.size / msglen)) seedlen = 100 sym = math.floor(segsize / seedlen)
import librosa as lro, matplotlib.pyplot as plt, math,librosa.display, numpy as np, bitarray, datetime, os import random as rn from audio import Audio from message import Message from scipy.signal import find_peaks import bitarray from embedded import Embedded path = 'export/44 Pianisten 01-Promenade.wav' cs = Embedded(path, None, None) randomList = [] leng = 50 han = np.hanning(leng) for i in range(0, 100): # any random numbers from 0 to 1000 ran = rn.randint(0+i, cs.size-i) randomList.append(ran) print(randomList) arr = [] for i in randomList: win = cs.y[i:i+leng]*han arr = np.append(arr, win)
import librosa as lro, matplotlib.pyplot as plt, math, librosa.display, numpy as np, bitarray, datetime, os import random as rn from audio import Audio from message import Message from scipy.signal import find_peaks import bitarray from embedded import Embedded file = '44 Pianisten 01-Promenade.wav' inp = 'export' path = os.path.join(inp, file) pathtxt = os.path.join(inp, file + "_key.txt") cs = Embedded(path, None, None, 100, 8, pathtxt) win = 2000 start = 165375 step = 50 j = 0 #arr = np.empty([100,int(start/step)], dtype=float) arr = np.empty([int(start / step), win], dtype=float) #print(arr[0,:]) for i in range(start, start + 1000, step): ceps = cs.Ceps(cs.y[i:i + win]) print(ceps.size) arr[j, :] = ceps j = j + 1 ip = False
import librosa as lro, matplotlib.pyplot as plt, math, librosa.display, numpy as np, bitarray, datetime, os import random as rn from audio import Audio from message import Message from scipy.signal import find_peaks import bitarray from embedded import Embedded file = '44 Pianisten 01-Promenade.wav' inp = 'export' path = os.path.join(inp, file) pathtxt = os.path.join(inp, file + "_key.txt") cs = Embedded(path, 5, 30, 100, 8, pathtxt) leng = 100 han = np.hanning(leng) for j in range(0, 100): randomList = [] for i in range(0, 1000): # any random numbers from 0 to 1000 ran = rn.randint(1, cs.size - leng) randomList.append(ran) randomList = np.sort(randomList) #print(randomList) arr = []