- Home /
AudioSettings.outputSampleRate cannot be changed in Mac OS X
Dear Everyone,
I am developing a project in which some audio data need to be playback in Unity. The sample rate of input data is 24000 Hz (24kHz), and normally the default sample rate of speaker in system is 44100 (44.1kHz). In Windows, I can use AudioSettings.outputSampleRate = 24000; to change this device sample rate with no problem. But I found it impossible in Mac OS. Even after I changed it, if I print the value, I still got 44100. Sometime I even got an error message:
Trying to reload asset from disk that is not stored on disk
So I suspect that Mac OS forbids user to change this value in user's application.
According to the description here: http://docs.unity3d.com/Documentation/ScriptReference/AudioSource.Play.html
I tried to set the delay value in AudioSource.Play to solve it. Since 44100/24000*24000 = 44100, what I did is:
myClip = AudioClip.Create("MySinoid", 24000, 1, 24000, false, false);
audio.loop = true;
audio.clip = myClip;
audio.Play(44100);
But no luck with it, almost half of the audio data is not played.
Have someone met the same problem as me? And what is your solution? And which way do you playback, OnAudioFilterRead? or FixedUpdate + SetData?
Thank you very much!!
Your answer
![](https://koobas.hobune.stream/wayback/20220613093149im_/https://answers.unity.com/themes/thub/images/avi.jpg)