Skip to content

The encoder doesn't support frequencies aside from 44100 #30

Open
@laythra

Description

@laythra

Bug Report

Overview

The encoder only supports encoding an AudioClip with a frequency of 44100 Hz. When using a different frequency, the resulting audio file's length will be proportionally affected based on the ratio of 44100 to the selected frequency. For example, if the chosen frequency is 16000 Hz and the original recorded audio is 30 seconds long, the encoded OGG file will have an approximate duration of 82 seconds (44100 / 16000 * 30).

To Reproduce

Steps to reproduce the behavior:

  • Record an audio using the unity's Microphone api and set the frequency parameter to 16000
  • Convert the captured audio to bytes using the EncodeToOggVorbis method
  • Write the bytes to disk and view the length of the recording File.WriteAllBytes(Application.persistentDataPath + "/test_audio.ogg", oggData); and check the audio length and quality

Expected behavior

Resulting audio should be equal in size to the orignal recorded audio without sounding "slowed down" or distorted

Screenshots

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions