I have a 24 bit, 96000 sps, single channel microphone. I can record it with
- Mic1 = audiorecorder(96000,24,1)
- recordblocking(Mic1,1)
- S1 = getaudiodata(Mic1,'int16')
but using record(Mic1,1) goes immediately to getaudiodata. It needs a delay or wait or schedule
- Mic1 = audiorecorder(96000,24,1)
- record(Mic1,1)
- play sound after 50 milliseconds (the recorder will probably be slow to start
- wait to almost one second so I can store results at exactly one sample per second. Yes it takes fiddling
- S1 = getaudiodata(Mic1,'int16')
I want to start the recorder and then at a precisely known moment generate a short pulse sound (tick or click or chirp or pulse) to the speaker. After one second total Stop the recorder and then look at the recorded signal and see if I can calibrate somehow.
Once I can get it to make one measurement, I want to just let it run continuously and store the raw data and summary data.
T = timer( some stuff )
T.StartFcn = MyStart;
T.StopFcn = MyStop;
T.start();
function MyStart()
Start recording with record(Mi1, 1)
-- I have a small room The distance is about 3 meters at 340 m/s so time = distance/speed = 8823.5 microSecs
-- in sample units I would expect the first bit of sound to come at (3/340)*96000 = 847 samples into the recording
Play the sound -- how do I build a 96000 Hz sound with 100 amplitudes?
end
function MyStop()
Process the recorded sound, mark down the exact times, save everything, and then do it again
T.Start(); -- this is not the current syntax but it is a good object practice to put the methods inside and just refer to one object name
end