Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Need help playing .aac file from live audio stream

Discussion in 'Audio & Video' started by Fire_Mage_Matt, Nov 2, 2023.

  1. Fire_Mage_Matt

    Fire_Mage_Matt

    Joined:
    Mar 20, 2020
    Posts:
    2
    Okay, long story short, I am experimenting with playing audio steams from the internet in Unity. Specifically, I am interested in using public radio web broadcasts.

    I managed to send a UnityWebRequestMultimedia (with AudioType AUDIOQUEUE) and get back the .aac audio file. However, this audio cannot be played in an AudioSource object. The error I am getting says that it is not a supported audio format.

    So, I started looking into ways to convert this file to WAV or MP3 or something I know Unity can handle. There are a few Codecs from Windows that can convert it, but I honestly have no clue how to bring them into Unity.


    Anyone got an idea on where I can go with this? I have the audio file, but no clue how to play it.
     
  2. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    435
    I think your best shot for a simple integration is using NAudio (https://github.com/naudio/NAudio) to convert the file or directly access its samples. It's a great C# audio library.