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

infofromfile(room)
function room_stuff = infofromfile(room)

fid = fopen(room, 'r');

room_stuff{1} = room;
%check the identifier
id = fread(fid, 4, 'char');
if strcmp(char(id)', 'KenS')==0
    errordlg('Invalid File');
    return
end

numwalls = fread(fid, 1, 'int');
for i=1:numwalls
    wall_coor(i, :) = fread(fid, 2, 'float');
    wall_id(i, :) = fread(fid, 2, 'int');
end
room_stuff{2} = wall_coor;
room_stuff{3} = wall_id;
ceil(1) = fread(fid, 1, 'float')*-1;
floor(1) = fread(fid, 1, 'float')*-1;
ceil(2) = fread(fid, 1, 'int');
floor(2) = fread(fid, 1, 'int');
room_stuff{4} = ceil;
room_stuff{5} = floor;

numpts = fread(fid, 1, 'long');
s=0; m=0;
for i=1:numpts
    dum = fread(fid, 3, 'float');
    dum(2:3) = flipud(dum(2:3));
    dum(2) = -dum(2);
    type = fread(fid, 1, 'long');
    if type==0
        s=s+1;
        src(s, :) = dum;
    elseif type==1
        m=m+1;
        mic(m, :) = dum;
    else
        errordlg('something wrong with the file')
        return
    end
end
room_stuff{6} = src;
room_stuff{7} = mic;

for i=1:s
    az{i} = fread(fid, 1, 'float');
    el{i} = fread(fid, 1, 'float');
end

room_stuff{8} = az;
room_stuff{9} = el;

Contact us at files@mathworks.com