Microphone.start(), need lengthsec unfixed value, is possible?


Unity advise me microphone.start use like this audio.clip = Microphone.Start(null, false, 7, 44100);

But I don’t want to fixed value, I have two button, start recording and stop recording.

So i want detect user click the button for stop recording.(<- this is ok.)

how can i use unfixed_value at microphone.(Microphone.Start(null, false, unfixed_value, 44100); )

I don’t know total recording times. Please help me. give me any advise plz.

I had similar issues -
as you mentioned, having a “stop” button that executes
will stop the recording.

so what you need to od, IMO, is set the lengthSec in Microphone.Start to be very long (180 would mean 3 minutes for instance). Any length that would be larger than what user would need (1800 would give you 30 minutes, 18000 = 300 minutes or whatever you think is enough)
Note that when user play the stop butoon - the clip length would be from Microphone.Start to Microphone.End (stop button clicked) and not the initial value you entered.

I am asusming Unity decided you must enter a length in order to avoid performance, file-size and (maybe) privacy issues - so there will never be a recording that lasts forever.
(Note that legthSec is an INT. If it was a float - you could set it to MathF.Infinity)

Just set legthSec to something bigger than what user will ever need - and all your clips legth would be set to when the stop button is clicked. This should give you what you need.

hope that helps.