def __init__(self, rt60_opt, absc_opt, room_dim): """ rt60_opt: "" or "a,b", higher priority than absc_opt absc_opt: tuple like (a,b) room_dim: str like "a,b;c,d;e,d" """ self.rt60_opt = rt60_opt if not rt60_opt: self.absc = UniformSampler(*absc_opt) else: rt60_r = str_to_float_tuple(rt60_opt) self.rt60 = UniformSampler(*rt60_r) dim_range = [str_to_float_tuple(t) for t in room_dim.split(";")] if len(dim_range) != 3: raise RuntimeError( "Wrong format with --room-dim={}".format(room_dim)) self.dim_sampler = [UniformSampler(*c) for c in dim_range]
def __init__(self, args): # make dump dir make_dir(args.dump_dir) self.rirs_cfg = [] self.room_generator = RoomGenerator(args.rt60, args.abs_range, args.room_dim) self.mx, self.my = args.array_relx, args.array_rely self.array_topo = [ str_to_float_tuple(t) for t in args.array_topo.split(";") ] self.args = args
def parse_config(args): args_dict = dict() # process absorption coefficient args_dict["abs_min"], args_dict["abs_max"] = args.abs_range # process source-distance args_dict["dst_min"], args_dict["dst_max"] = args.src_dist # process array-topo args_dict["topo"] = args.array_topo # process room-dim assert args.room_dim, "--room-dim could not be None" tokens = args.room_dim.split(";") if len(tokens) != 3: raise ValueError( "--room-dim must be set for length/width/height respectively") for index, name in enumerate(["Rx", "Ry", "Rz"]): min_, max_ = str_to_float_tuple(tokens[index]) args_dict["{}_min".format(name)] = min_ args_dict["{}_max".format(name)] = max_ # process --array-height args_dict["Mz_min"], args_dict["Mz_max"] = args.array_height # process --array-area assert args.array_area, "--array-area could not be None" tokens = args.array_area.split(";") if len(tokens) != 2: raise ValueError( "--array-area should be set for length/width respectively") for index, name in enumerate(["Mx", "My"]): min_, max_ = str_to_float_tuple(tokens[index]) args_dict["{}_min".format( name)] = min_ * args_dict["Rx_min" if index == 0 else "Ry_min"] args_dict["{}_max".format( name)] = max_ * args_dict["Rx_max" if index == 0 else "Ry_max"] # process --speaker-height args_dict["Sz_min"], args_dict["Sz_max"] = args.speaker_height # process --array-topo args_dict["topo"] = args.array_topo return args_dict