# Timeline problem about creatSound with MODE.CREATESTREAM

**URL:** <https://qa.fmod.com/t/timeline-problem-about-creatsound-with-mode-createstream/19203>\
**Category:** FMOD Engine\
**Tags:** unity\
**Created:** [August 29, 2022, 12:42pm UTC](https://qa.fmod.com/t/timeline-problem-about-creatsound-with-mode-createstream/19203 "2022-08-29T12:42:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![RiddleC](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@RiddleC](https://qa.fmod.com/u/RiddleC)\
**Post date:** [August 29, 2022, 12:42pm UTC](https://qa.fmod.com/t/timeline-problem-about-creatsound-with-mode-createstream/19203/1 "2022-08-29T12:42:34Z")

</div>

Hi, forums!  
I use a url to play web audio. In order to reduce GC overhead, I use MODE.CREATESTREAM to CreateSound. However, when the sound starts playing, the Timelineposition is always offset backwards for a period of time.  
Does anyone know the reason for this phenomenon？ Thanks！

```auto
        public static bool CreateSound(string url, MODE mode, out Sound sound)
        {
            sound = new Sound();
            try
            {
                var exinfo = new CREATESOUNDEXINFO();
                exinfo.cbsize = Marshal.SizeOf(exinfo);
                exinfo.suggestedsoundtype = SOUND_TYPE.OGGVORBIS;
                exinfo.ignoresetfilesystem = 1;

                var result = CoreSystem.createSound(url, mode, ref exinfo, out sound);
                if (result == RESULT.OK)
                    return true;
                throw new Exception($"{result}");
            }
            catch (Exception e)
            {
                GameLog.LogError($"FMOD CreateSound Error, {url}, {e.Message}");
                return false;
            }
        }

```

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [September 2, 2022, 12:06am UTC](https://qa.fmod.com/t/timeline-problem-about-creatsound-with-mode-createstream/19203/2 "2022-09-02T00:06:51Z")

</div>

Hi,

Unfortunately, I was not able to recreate this issue. However, a solution might be setting the playback position to the start of the audio track after the sound is played. Setting the playback position is explained under [Core API | Channel](https://fmod.com/docs/2.02/api/core-api-channel.html#channel_setposition).

---

<div class="post-metadata">

**Author:** ![RiddleC](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@RiddleC](https://qa.fmod.com/u/RiddleC)\
**Post date:** [September 6, 2022, 12:29pm UTC](https://qa.fmod.com/t/timeline-problem-about-creatsound-with-mode-createstream/19203/3 "2022-09-06T12:29:34Z")

</div>

> [@RiddleC](#):
>
> b audio. In order to reduce GC ov

Thank you for your reply!  
However, it seems impossible to set timelineposition when a web sound is created as a stream,  
I try to get the length of the sound, and it is 0.  
Is there any way to solve it?

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [September 6, 2022, 11:49pm UTC](https://qa.fmod.com/t/timeline-problem-about-creatsound-with-mode-createstream/19203/4 "2022-09-06T23:49:54Z")

</div>

Hi, no worries and let’s try something else to solve the issue

Could I get the Url you are playing your sound from to test it on my end?

Also please clarify what you mean by “Timelineposition is always offset backwards a period of time”? Do you mean you are hearing silence for a couple of seconds?

Thanks

---

<div class="post-metadata">

**Author:** ![RiddleC](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@RiddleC](https://qa.fmod.com/u/RiddleC)\
**Post date:** [September 7, 2022, 4:00am UTC](https://qa.fmod.com/t/timeline-problem-about-creatsound-with-mode-createstream/19203/5 "2022-09-07T04:00:56Z")

</div>

> [@Connor\_FMOD](#):
>
> “Timelineposition is always offset backwards a period of time”

Thanks！  
First, I am sorry that I can’t give you the URL due to commercial confidentiality.  
Here, I would like to answer your question about “Timelineposition is always offset backwards a period of time” in detail.  
In fact, when I downloaded the sound resource from the URL via HTTP request and played it, the sound played without problems.( use the following function to createSound)

```auto
public RESULT createSound(byte[] data, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound)

```

Then, I try to make the sound played in stream mode, there’s a little bit of sound that’s not playing. For example, the original sound has a duration of 10 seconds. When the sound is played through a stream, the sound starts to be played from the second second.

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [September 7, 2022, 11:43pm UTC](https://qa.fmod.com/t/timeline-problem-about-creatsound-with-mode-createstream/19203/6 "2022-09-07T23:43:28Z")

</div>

Unfortunately, I am not able to replicate the issue using your code on files that are available to me. Is it possible to DM me the URL? Alternatively, could you test a public file and see if the issue persists?

---

<div class="post-metadata">

**Author:** ![RiddleC](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@RiddleC](https://qa.fmod.com/u/RiddleC)\
**Post date:** [September 8, 2022, 1:02pm UTC](https://qa.fmod.com/t/timeline-problem-about-creatsound-with-mode-createstream/19203/7 "2022-09-08T13:02:46Z")

</div>

I find some webaudio in github.  
[esp-adf/audio-samples.rst at master · espressif/esp-adf (github.com)](https://github.com/espressif/esp-adf/blob/master/docs/en/design-guide/audio-samples.rst)  
I tested this one: [https://dl.espressif.com/dl/audio/gs-16b-2c-44100hz.ogg](https://dl.espressif.com/dl/audio/gs-16b-2c-44100hz.ogg)  
However, when I createSound with Stream mode，FMOD Logs ERR\_HTTP.

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [September 16, 2022, 4:24am UTC](https://qa.fmod.com/t/timeline-problem-about-creatsound-with-mode-createstream/19203/8 "2022-09-16T04:24:21Z")

</div>

Apologies for the late reply!  
Are the files that you can get working hosted locally or remotely? Depending on the delay between the request and playing the sound this might be causing the silence. In the meantime, I have passed this issue on to our development team to look into further

---

<div class="post-metadata">

**Author:** ![RiddleC](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@RiddleC](https://qa.fmod.com/u/RiddleC)\
**Post date:** [September 26, 2022, 9:04am UTC](https://qa.fmod.com/t/timeline-problem-about-creatsound-with-mode-createstream/19203/9 "2022-09-26T09:04:37Z")

</div>

> [@Connor\_FMOD](#):
>
> can get working hosted locally or remotely? Depending on the delay between the request and playing the sound this might be causing the silence. In the meantime, I have passed this issue on to our development team to look into furth

Thanmk you!
