Microphon dosen't record after build (windows 10)

Hi, I am trying to use the Microphone class in unity to record voices. When I run the game in unity editor it works fine, but after I build the project the microphone doesn’t work anymore.
I am working with a USB microphone, so I can see when it’s starting to record. When the code:

Microphone.Start(deviceName, false, seconds, sampleRate);

the microphone light turn on. When I run the built project, the light doesn’t turns on anymore.
I would love to receive help on this subject, thank you very much in advance.
(p.s. Sorry about my English)

I finally found the solution. I’m posting it here in case someone else has the same issue.
I’m not sure why, but the problem was that the sample rate didn’t match the “System Sample Rate” in Unity settings (which are 48k by default).

The solution I’ve found was to add these lines of code to the Awake function:

AudioConfiguration audioConfiguration = AudioSettings.GetConfiguration();
sampleRate = audioConfiguration.sampleRate; 

Now all I needed to do was to configure my desired sample rate in ProjectSettings->Audio->Sample Rate.