from WaveLoader import WaveLoader
import torch

# sox convert
# sox input.wav -r 8000 -c 1 output.wav

sample = './pemex8k.wav'
wl = WaveLoader(sample)  # type WaveLoader
data, label = wl.get_sample()

print(data.shape, label.shape)

# Write junk
t = torch.rand((5, 8000))
t = torch.mul(t, 65535)
t = torch.sub(t, 65535/2)

wl.write_wave(t, './output.wav', 1, 2, 8000)


#write pemex
buff = [data.tolist()]
for x in range(25):
    data, label = wl.get_sample()
    buff.append(data.tolist())

pemex = torch.tensor(buff)
wl.write_wave(pemex, './output-pemex.wav', 1, 2, 8000)

wl.play_sample_tensor(pemex, 1, 2, 8000)
9bc20eaf425b0523e12ec7c00757bfda732de049
<mask token>

<mask token>
print(data.shape, label.shape)
<mask token>
wl.write_wave(t, './output.wav', 1, 2, 8000)
<mask token>
for x in range(25):
    data, label = wl.get_sample()
    buff.append(data.tolist())
<mask token>
wl.write_wave(pemex, './output-pemex.wav', 1, 2, 8000)
wl.play_sample_tensor(pemex, 1, 2, 8000)

<mask token>
sample = './pemex8k.wav'
wl = WaveLoader(sample)
data, label = wl.get_sample()
print(data.shape, label.shape)
t = torch.rand((5, 8000))
t = torch.mul(t, 65535)
t = torch.sub(t, 65535 / 2)
wl.write_wave(t, './output.wav', 1, 2, 8000)
buff = [data.tolist()]
for x in range(25):
    data, label = wl.get_sample()
    buff.append(data.tolist())
pemex = torch.tensor(buff)
wl.write_wave(pemex, './output-pemex.wav', 1, 2, 8000)
wl.play_sample_tensor(pemex, 1, 2, 8000)

from WaveLoader import WaveLoader
import torch
sample = './pemex8k.wav'
wl = WaveLoader(sample)
data, label = wl.get_sample()
print(data.shape, label.shape)
t = torch.rand((5, 8000))
t = torch.mul(t, 65535)
t = torch.sub(t, 65535 / 2)
wl.write_wave(t, './output.wav', 1, 2, 8000)
buff = [data.tolist()]
for x in range(25):
    data, label = wl.get_sample()
    buff.append(data.tolist())
pemex = torch.tensor(buff)
wl.write_wave(pemex, './output-pemex.wav', 1, 2, 8000)
wl.play_sample_tensor(pemex, 1, 2, 8000)

from WaveLoader import WaveLoader
import torch

# sox convert
# sox input.wav -r 8000 -c 1 output.wav

sample = './pemex8k.wav'
wl = WaveLoader(sample)  # type WaveLoader
data, label = wl.get_sample()

print(data.shape, label.shape)

# Write junk
t = torch.rand((5, 8000))
t = torch.mul(t, 65535)
t = torch.sub(t, 65535/2)

wl.write_wave(t, './output.wav', 1, 2, 8000)


#write pemex
buff = [data.tolist()]
for x in range(25):
    data, label = wl.get_sample()
    buff.append(data.tolist())

pemex = torch.tensor(buff)
wl.write_wave(pemex, './output-pemex.wav', 1, 2, 8000)

wl.play_sample_tensor(pemex, 1, 2, 8000)