5 milliseconds is a very short time period and you can't limit audio output to such duration.
you can use Handler
to execute a delayed function but it will not ensure execution at 5 milliseconds after scheduling.
a code for doing that:
Handler handler = new Handler();
handler.postDelayed(new Runnable(){
@Override
public void run(){
startRecord();
mp.stop();
mp.release();
}
}, 5);