- Home /
Error: Cannot create FMOD
While loading sounds from a certain folder, I always get the error message:
Error: Cannot create FMOD::Sound instance for resource "qB, (Operation could not be performed because specified sound/DSP connection is not ready. )
UnityEngine.WWW:GetAudioClip(Boolean, Boolean, AudioType)
<LoadFiles>c__Iterator0:MoveNext() (at Assets/Scripts/LoadFolder.cs:38)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
My code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using System.Linq;
public class LoadFolder : MonoBehaviour
{
public string PathString;
public SproutSoundList ListScript;
public AudioClip SproutSound;
void Start()
{
ListScript = GameObject.Find("ScriptCargo").GetComponent<SproutSoundList>();
}
public void StartLoading()
{
PathString = transform.parent.FindChild("Path").FindChild("PathDir").GetComponent<UnityEngine.UI.Text>().text;
PathString.Replace("\\", "/");
StartCoroutine("LoadFiles");
}
IEnumerator LoadFiles()
{
string Url = string.Format("file://{0}", PathString);
WWW www = new WWW(Url);
yield return www;
foreach (string File in Directory.GetFiles(PathString))
{
if (Path.GetFileName(File).Contains(".wav") || Path.GetFileName(File).Contains(".WAV"))
{
SproutSound = www.GetAudioClip(false, false, AudioType.WAV);
SproutSound.name = Path.GetFileName(File);
ListScript.SoundList.Add(SproutSound);
}
}
}
}
How to fix that??
What certain folder? How is it different from other folders that do work? What version of Unity? What operating system?
Thanks for your effort!
The folder the path leads to; can be any folder on the harddisk. I never got it to work, I just read people used that code without problems. Unity 5.5.0f3 Win7 x64, SP1
Answer by metge · May 22, 2017 at 05:07 AM
using UnityEngine; using System.Collections;
public class TestAudio : MonoBehaviour { private AudioSource _audiopoint; // аудио источник private WWW _www;
void Start()
{
_audiopoint = GetComponent<AudioSource>();
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
//StartCoroutine(DownloadAndPlay("http://www.tannerhelland.com/dmusic/AMemoryAway.ogg"));
StartCoroutine(DownloadAndPlay("file:///"+ Application.dataPath + "/UserSounds/" + "/my.ogg"));
}
}
IEnumerator DownloadAndPlay(string url)
{
Debug.Log(url);
_www = new WWW(url);
Debug.Log("Start Dowload");
yield return _www;
Debug.Log("Playing");
_audiopoint = GetComponent<AudioSource>();
_audiopoint.clip = _www.GetAudioClip(false, true, AudioType.OGGVORBIS);
_audiopoint.clip.name = "Downloaded clip";
_audiopoint.Play();
}
}
Answer by GDesmoulins · Jan 22, 2019 at 09:57 PM
Be carefull of special Characters in your sound filePath ! for my part : { and } caused this problem
Your answer
![](https://koobas.hobune.stream/wayback/20220612103853im_/https://answers.unity.com/themes/thub/images/avi.jpg)