Archived
29 lines
761 B
Python
29 lines
761 B
Python
from expe_build_conditions import expe_build_conditions
|
|
from expe_options import expe_options
|
|
import os
|
|
import soundfile as sf
|
|
import numpy as np
|
|
from naoqi import ALProxy
|
|
from tqdm import tqdm
|
|
import random
|
|
|
|
|
|
# aap = ALProxy("ALAudioPlayer", "", 9559)
|
|
|
|
|
|
options = expe_options()
|
|
expe_build_conditions(options)
|
|
|
|
files = os.listdir(options["tmp_path"] + "2")
|
|
y = np.array([])
|
|
for i in tqdm(range(len(files))):
|
|
r = random.randint(0, len(files)-1)
|
|
x, fs = sf.read(os.path.join(options["tmp_path"] + "2", str(files[r])))
|
|
x = x * np.power(10, -(options["attenuation_dB"]/20.0))
|
|
y = np.append(y, x)
|
|
|
|
sf.write("calibration.wav", np.concatenate(
|
|
(np.zeros((1024*3, 2)), np.tile(y, (2, 1)).T, np.zeros((1024*3, 2)))), fs)
|
|
|
|
# aap.ALAudioPlayer.play()
|