Questions tagged [audioclip]

AudioClip is a class in Unity which allows to store an audio clip, and can be attached to an AudioSource.

AudioClip is a class in which allows to store an audio clip, which can be assigned to an AudioSource. The class can be assigned an audio file asset in several formats, and then programmatically accessed in scripts.

AudioClip Documentation

Audio Clip reference within scripts

44 questions
6
votes
1 answer

Frequency and pitch relation for AudioClip - Unity3D

I am trying to recreate the full range of a guitar only using 6 audio clips. I was thinking there would be a way to set frequency of an audio clip but audio.frequency only returns the frequency of the audio based on compression format and not the…
Everts
  • 10,408
  • 2
  • 34
  • 45
4
votes
3 answers

Unity Android load local MP3 or WAV as AudioClip

I'm able to load audio using UnityWebRequestMultimedia.GetAudioClip in the Unity Editor with the following code but when I run it on Android I am unable to load any files from the user's device. void Start() { audio =…
Tim Troiano
  • 449
  • 1
  • 7
  • 25
3
votes
3 answers

How to play audioclips in unity from script?

So I am trying to get the sing method to play one of the audioclips I created up top. I know I need an audioSource, I just have no clue how it fits in with the audioClips. I don't currently have an audiosoure assigned to the object that this script…
1v0ryh4t
  • 55
  • 1
  • 7
2
votes
0 answers

Audioclip: javax.sound.sampled.LineUnavailableException

Im trying to play a file to my speakers using AudioClip. To mention i run this on a docker container Here i get the audio file info from my server and tried to play it. int length = fromServer.readInt();//takes audio file length from socket if…
nemime
  • 29
  • 2
2
votes
1 answer

Playing multiple audio clips in unity

There might be similar questions to this one but I couldn't find any useful. I have a simple scrips which has a list of classes that contains audio clips, id, and event system individually for each one of those elements. I need to make that audio…
pourya011
  • 91
  • 2
  • 13
2
votes
0 answers

Unity some noise in audio after convert Byte[] to AudioClip

I'm trying to convert a base64 into a byte[] and in a audioClip but i'm getting some noise in my sound. I'm using this class to convert byte[] to AudioClip. using UnityEngine; using System.Collections; using System.IO; using System; namespace…
Felipe
  • 75
  • 1
  • 11
2
votes
0 answers

How to convert Unity AudioClip into byte array suitable for Firebase Storage upload

I am using Firebase Storage on Unity3D to store microphone recordings from the user. How do I convert an AudioClip into a byte stream that can be uploaded to Firebase Storage? While the project is uploading sound files at the appropriate time, the…
2
votes
0 answers

AudioClip.SetData(samples,0) not working loading sample data from json file in Unity

I am trying to Set audioclip samples previously saved using audioclip.GetData from a json file. The Audio data is present in my json file but it seems not to work when Loading this file and setting up the audioclip data using SetData: In my Load…
FSebH
  • 33
  • 5
2
votes
1 answer

Load external OGG file into Unity WebGL build at runtime

I am trying to load some sounds in OGG format into my game at runtime in a WebGL build. I use a WWW class to fetch the file which has an ".ogg" extension and then I call www.audioClip to get the downloaded file. This works on other platforms but…
1
vote
1 answer

How to convert base64 mpeg to AudioClip in Unity?

After some research, I have got the following private float[] Normalize(float[] data) { float max = float.MinValue; for (int i = 0; i < data.Length; i++){ if (System.Math.Abs(data[i]) > max) max = System.Math.Abs(data[i]); } …
Chong Lip Phang
  • 8,755
  • 5
  • 65
  • 100
1
vote
1 answer

AudioClip.Length is incorrect when loading from UnityWebRequestMultimedia GetAudioClip

When I get an unity audio clip from firebase by url var request = UnityWebRequestMultimedia.GetAudioClip(url, AudioType.MPEG); yield return request.SendWebRequest(); var clip = DownloadHandlerAudioClip.GetContent(request); …
Zerbeeyili
  • 11
  • 1
1
vote
0 answers

JavaFx - Play audio on beginn with animation

How can I play an audio with the animation on the same time. private final AudioClip soundRed = new AudioClip(getClass().getResource("resources/soundRed.mp3").toExternalForm()); private void computerButtonBlink() { …
Detrua
  • 59
  • 6
1
vote
1 answer

How to Fade Audio In Unity C#

I wrote a script that plays random audio files from an array. But I can't figure out how to fade out the current playing audio at the end of the file and fade in the new audio file. below is the code. The Audio file I am using is mp3 files for now…
Savad
  • 1,240
  • 3
  • 21
  • 50
1
vote
0 answers

Problem in playing an MP3 file in JavaFX - compatibility issue?

I'm trying to play a small MP3 file or two using JavaFX, trying with MediaPlayer and AudioClip but getting an exception in each case. Some kind of compatibility issue? Technology stack (1) Windows 10 home (2) Java 8 update 211 (3) Java SE…
Simon G
  • 83
  • 3
1
vote
0 answers

JavaFX AudioClip: any way to play more sounds at the same time?

First question on Stack Overflow, please have mercy if I don't know all the conventions yet. :) I'm playing sounds with JavaFX AudioClip, and I'm running out of sound channels. I'm doing my best to fiddle with the priority, stop, and isPlaying…
Byproduct
  • 11
  • 1
1
2 3