Search Unity

Audio GetSpectrumData update rate problem on Android

Discussion in 'Audio & Video' started by Rafael-cmk, Sep 16, 2018.

  1. Rafael-cmk

    Rafael-cmk

    Joined:
    Jun 28, 2016
    Posts:
    56
    Hi everyone, first excuse my english.
    I'm currently having this problem with unity 2018.2.6f1(used to work properly on 2017.4.1) where the method myAudioSource.GetSpectrumData isn't updating at the rate I want, in unity editor it still returns different values each frame or amost but in android the values repeat for some, it's a rate about 15 - 20. I checked the sample and it's 48000 for editor and 24000(close to it, I don't remember) for android, already tried changing "System Sample Rate" and "DSP Buffer Size" in Audio Settings through editor but no sucess.
    It is the core of my project and I don't want to dowgrade back to 2017.4.1, please help me >.<
     
  2. Rafael-cmk

    Rafael-cmk

    Joined:
    Jun 28, 2016
    Posts:
    56
    [Solved] I was setting the "System Sample Rate" to be the same I saw in windows(48000) but I found that for android phones the limit usually is 44100.
     
  3. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    1,305
    why are you setting system sample rate manually ? it is usually correctly detected per given platform
    (it is different still on iOS, for example)
     
  4. Rafael-cmk

    Rafael-cmk

    Joined:
    Jun 28, 2016
    Posts:
    56
    Letting it automatically select the sample rate is messing with the result I expect from GetSpectrumData, I don't see another solution.
     
  5. r618

    r618

    Joined:
    Jan 19, 2009
    Posts:
    1,305
    ok, interesting (seems like you access spectrum buffer with user framerate and audio is then resampled for given device output)
    I think you should get more consistent results if you lock your framerate too
     
  6. Last8Exile

    Last8Exile

    Joined:
    Mar 23, 2017
    Posts:
    5
    Have the same problem on android. Spectrum updating like 15 fps. Actual framerate is solid 60 fps.
    Setting best latency and System Sample Rate to 44100 or 48000 don't help.

    Also on TOP TIER android device - spectrum works normal.