Hi everyone,
I'm just expanding my processing experience to the audio world so I'm new to minim library but I have processing programming experience. Here is what I want to do and could veterans on this board help me by commenting on whether I will be able to accomplish what I want? Thank you!
Objective: play a sound periodically and record the playback at the same time. Bats use this way to fly in the dark without hitting obstacles.
Details: I have a sample I want to play. It has less than a millisecond of a high frequency sound (sine wave at 20KHz) followed by silence. The length of the sample is possibly at most 0.1 second long if not shorter. While I play the sample I want to record it on the mike. Theoretically, the mike will record the initial high frequency sound and then another sound, a reflection of the original sound wave from objects near the speaker, a wall, a cup etc. Think about talking in an empty room and you can hear your echo. I want to play a sound and record its echo. The time lag between the two short sounds can be used to find the distance of the objects to the speaker. I think this is how bats navigate in dark caves.
Question 0: Can I get some comment on my objective?
Question 1: I did some search online about recording and playback. It seems that recording has a variable and inevitable latency, which is between you request for recording and recording occurs. I'd like to know how much latency minim has if ever.
Question 2: I also read through several pages at this sound forum and found some people having lags on playback. How bad can that be if all I want is to repeat a sample?
Question 3: Is there a way to play repeatedly on a hardware level so that once I set the sample to play the sound card will play the sample until the sound card is told to stop?
Thank you for your time!!!