No BSD License  

Highlights from
Brown Acoustic Simulator

image thumbnail
from Brown Acoustic Simulator by Avram Levi
Creates a source to microphone impulse response in complex room enviroments

miginfofromfile.m
% filename = 'deneme.mig';

fid = fopen(filename, 'r');
id = fread(fid, 4, 'char');
if char(id)'~='KenS'
    'unidentified file'
end
num_walls = fread(fid, 1, 'int');


for i=1:num_walls
    wallcoor(:, i) = fread(fid, 2, 'float');
    wall_ind(:, i) = fread(fid, 2, 'int');
end

ceilcoor = -fread(fid, 1, 'float');
floorcoor = fread(fid, 1, 'float');
ceil_ind = fread(fid, 1, 'int');
floor_ind = fread(fid, 1, 'int');

wall_list = wall_ind(2, :);
wall_list(length(wall_list)+1) = ceil_ind;
wall_list(length(wall_list)+1) = floor_ind;
wall_list = sort(wall_list);
j=0;
for m=min(wall_list):max(wall_list)
    [row,col,v] = find(wall_list==m);
    if length(row)>=1 || length(col)>=1
        j=j+1;
        real_list(j) = m;
        m=m+1;
    end
end
%wall part is taken care of at this point

num_pts = fread(fid, 1, 'long');
for i=1:num_pts
    coor(:, i) = fread(fid, 3, 'float');
    type(i) = fread(fid, 1, 'long');
end

s=0;
m=0;
for i=1:num_pts
    if type(i)==0
        s=s+1;
        src(s, :) = coor(:, i);
    elseif type(i)==1
        m=m+1;
        mic(m, :) = coor(:, i);
    else
        'serious problems'
    end
end

fclose(fid);

Contact us at files@mathworks.com