Skip to content

Krom audio plays with the wrong pitch if the system's sample rate isn't 44100hz #3038

@moisesjpelaez

Description

@moisesjpelaez

I started this issue here but I found out it was a separate problem.

I have been testing the audio with Krom builds and after reading this in the forums I realized the audio has been playing well with some devices (a bluetooth speaker) but hasn't play well with others (a headphone and laptop's speaker).

Description
Krom builds plays the audio with a different pitch when the system's sound device doesn't match 44100hz, this is because that value is hardcoded in Krom's audio backend. When I manually put my system's audio sample rate on lines 13 and 14 the audio plays with the correct pitch.

This issue could be solved by getting the system's sample rate from the Krom's backend and assign that value when initializing, but I have no idea on how to do that.

To Reproduce
On Windows:

  1. Open 'Sound Settings' from the taskbar
  2. Select current audio device from 'Output'
  3. Verify the frequency
    • if it's 44100hz the audio will reproduce well
    • if it isn't 44100hz the audio will reproduce with a different pitch (in my case most of my audio devices are 48000hz and they play at a higher pitch)

Expected behavior
To play audio with the correct pitch if the system's sample rate is different from 44100hz.

System
Blender: 3.6.11 LTS
Armory: from this commit
OS: Windows 11 Pro (x64)
Graphics card: NVIDIA GeForce RTX 3050 Ti Laptop

Test File
Can be tested with the sound example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue describes a bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions