[Csnd] Firefox and WASM

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] Firefox and WASM

gsenna
Hi,

I've noticed a weird thing when using the wasm build on Firefox. There
seems to be a "hiccup" in the sound around the 175ms mark. I'm testing
with the following purposefully non-enveloped instrument:

sr = 48000
ksmps = 64
nchnls = 2
0dbfs = 1.0

instr 1
  aout oscils .4, 440, 0
  outs aout, aout
endin
schedule(1, 0, 1)

Listen to the difference in the recordings (rendering works fine) taken
from Chromium's output
[https://drive.google.com/open?id=1KQC-EpaoZraOPItTxx65d9go6vU1meco] and
then Firefox's output
[https://drive.google.com/open?id=10Z2ewMnHs6MDUij2pNoKQnuIGd7ok3Jm]. Is
this a problem with Firefox's implementation of WebAudio?

Cheers.

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Firefox and WASM

Victor Lazzarini-2
Is it always at that point? Dropouts can happen because the javascript code is running on the main browser thread, and
graphics etc can interrupt the audio.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 15 Feb 2018, at 03:39, Guillermo Senna <[hidden email]> wrote:
>
> Hi,
>
> I've noticed a weird thing when using the wasm build on Firefox. There
> seems to be a "hiccup" in the sound around the 175ms mark. I'm testing
> with the following purposefully non-enveloped instrument:
>
> sr = 48000
> ksmps = 64
> nchnls = 2
> 0dbfs = 1.0
>
> instr 1
>   aout oscils .4, 440, 0
>   outs aout, aout
> endin
> schedule(1, 0, 1)
>
> Listen to the difference in the recordings (rendering works fine) taken
> from Chromium's output
> [https://drive.google.com/open?id=1KQC-EpaoZraOPItTxx65d9go6vU1meco] and
> then Firefox's output
> [https://drive.google.com/open?id=10Z2ewMnHs6MDUij2pNoKQnuIGd7ok3Jm]. Is
> this a problem with Firefox's implementation of WebAudio?
>
> Cheers.
>
> Csound mailing list
> [hidden email]
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Firefox and WASM

gsenna
Hi Victor,

It happens always within the 1st second of performance and sometimes you
get more than one dropout. A ramp or even starting everything after the
first second works -> schedule(1,1,1).

It has to be a Firefox issue because Chrome and Chromium don't exhibit
the same behavior, so be warned when using Firefox for testing the WASM
build in real-time.


On 15/02/18 04:50, Victor Lazzarini wrote:

> Is it always at that point? Dropouts can happen because the javascript code is running on the main browser thread, and
> graphics etc can interrupt the audio.
>
> Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy
> Maynooth University
> Ireland
>
>> On 15 Feb 2018, at 03:39, Guillermo Senna <[hidden email]> wrote:
>>
>> Hi,
>>
>> I've noticed a weird thing when using the wasm build on Firefox. There
>> seems to be a "hiccup" in the sound around the 175ms mark. I'm testing
>> with the following purposefully non-enveloped instrument:
>>
>> sr = 48000
>> ksmps = 64
>> nchnls = 2
>> 0dbfs = 1.0
>>
>> instr 1
>>   aout oscils .4, 440, 0
>>   outs aout, aout
>> endin
>> schedule(1, 0, 1)
>>
>> Listen to the difference in the recordings (rendering works fine) taken
>> from Chromium's output
>> [https://drive.google.com/open?id=1KQC-EpaoZraOPItTxx65d9go6vU1meco] and
>> then Firefox's output
>> [https://drive.google.com/open?id=10Z2ewMnHs6MDUij2pNoKQnuIGd7ok3Jm]. Is
>> this a problem with Firefox's implementation of WebAudio?
>>
>> Cheers.
>>
>> Csound mailing list
>> [hidden email]
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>        https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
> Csound mailing list
> [hidden email]
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Firefox and WASM

Victor Lazzarini-2
Very interesting. It must be some initialisation taking place that interrupts the
processing in some place.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 15 Feb 2018, at 18:52, Guillermo Senna <[hidden email]> wrote:
>
> Hi Victor,
>
> It happens always within the 1st second of performance and sometimes you
> get more than one dropout. A ramp or even starting everything after the
> first second works -> schedule(1,1,1).
>
> It has to be a Firefox issue because Chrome and Chromium don't exhibit
> the same behavior, so be warned when using Firefox for testing the WASM
> build in real-time.
>
>
>> On 15/02/18 04:50, Victor Lazzarini wrote:
>> Is it always at that point? Dropouts can happen because the javascript code is running on the main browser thread, and
>> graphics etc can interrupt the audio.
>>
>> Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy
>> Maynooth University
>> Ireland
>>
>>> On 15 Feb 2018, at 03:39, Guillermo Senna <[hidden email]> wrote:
>>>
>>> Hi,
>>>
>>> I've noticed a weird thing when using the wasm build on Firefox. There
>>> seems to be a "hiccup" in the sound around the 175ms mark. I'm testing
>>> with the following purposefully non-enveloped instrument:
>>>
>>> sr = 48000
>>> ksmps = 64
>>> nchnls = 2
>>> 0dbfs = 1.0
>>>
>>> instr 1
>>>  aout oscils .4, 440, 0
>>>  outs aout, aout
>>> endin
>>> schedule(1, 0, 1)
>>>
>>> Listen to the difference in the recordings (rendering works fine) taken
>>> from Chromium's output
>>> [https://drive.google.com/open?id=1KQC-EpaoZraOPItTxx65d9go6vU1meco] and
>>> then Firefox's output
>>> [https://drive.google.com/open?id=10Z2ewMnHs6MDUij2pNoKQnuIGd7ok3Jm]. Is
>>> this a problem with Firefox's implementation of WebAudio?
>>>
>>> Cheers.
>>>
>>> Csound mailing list
>>> [hidden email]
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>       https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>> Csound mailing list
>> [hidden email]
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>        https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
> Csound mailing list
> [hidden email]
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Firefox and WASM

Steven Yi
In reply to this post by gsenna
It could be JIT warming up or WASM loading process which was optimized
recently by Firefox.  However, I seem to remember working with Hlodver
on a related issue like this recently and I suggested to him to use
Module['onRuntimeInitialized'] to ensure not doing any calls until
things completely loaded. You can see this as an example here:

https://github.com/kunstmusik/instruments/blob/master/vt/vt.js#L204-L208

and test it here:


Do you have an example of the HTML/JS used to start the project?

On Thu, Feb 15, 2018 at 1:52 PM, Guillermo Senna <[hidden email]> wrote:

> Hi Victor,
>
> It happens always within the 1st second of performance and sometimes you
> get more than one dropout. A ramp or even starting everything after the
> first second works -> schedule(1,1,1).
>
> It has to be a Firefox issue because Chrome and Chromium don't exhibit
> the same behavior, so be warned when using Firefox for testing the WASM
> build in real-time.
>
>
> On 15/02/18 04:50, Victor Lazzarini wrote:
>> Is it always at that point? Dropouts can happen because the javascript code is running on the main browser thread, and
>> graphics etc can interrupt the audio.
>>
>> Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy
>> Maynooth University
>> Ireland
>>
>>> On 15 Feb 2018, at 03:39, Guillermo Senna <[hidden email]> wrote:
>>>
>>> Hi,
>>>
>>> I've noticed a weird thing when using the wasm build on Firefox. There
>>> seems to be a "hiccup" in the sound around the 175ms mark. I'm testing
>>> with the following purposefully non-enveloped instrument:
>>>
>>> sr = 48000
>>> ksmps = 64
>>> nchnls = 2
>>> 0dbfs = 1.0
>>>
>>> instr 1
>>>   aout oscils .4, 440, 0
>>>   outs aout, aout
>>> endin
>>> schedule(1, 0, 1)
>>>
>>> Listen to the difference in the recordings (rendering works fine) taken
>>> from Chromium's output
>>> [https://drive.google.com/open?id=1KQC-EpaoZraOPItTxx65d9go6vU1meco] and
>>> then Firefox's output
>>> [https://drive.google.com/open?id=10Z2ewMnHs6MDUij2pNoKQnuIGd7ok3Jm]. Is
>>> this a problem with Firefox's implementation of WebAudio?
>>>
>>> Cheers.
>>>
>>> Csound mailing list
>>> [hidden email]
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>        https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>> Csound mailing list
>> [hidden email]
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>         https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>
> Csound mailing list
> [hidden email]
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Firefox and WASM

Steven Yi
(Oops, pressed send before finishing the email)

You can test the web instruments here:

http://instruments.kunstmusik.com/

(Requires touch screen, tested on Surface Pro 4 and Android cell phone)

I'm getting good results without dropouts but it might be due to just
taking time to hit the screen.

Do you have an example of the HTML/JS used to start the project? I
wonder if using similar code to what I'm doing will help the
situation.

On Thu, Feb 15, 2018 at 2:26 PM, Steven Yi <[hidden email]> wrote:

> It could be JIT warming up or WASM loading process which was optimized
> recently by Firefox.  However, I seem to remember working with Hlodver
> on a related issue like this recently and I suggested to him to use
> Module['onRuntimeInitialized'] to ensure not doing any calls until
> things completely loaded. You can see this as an example here:
>
> https://github.com/kunstmusik/instruments/blob/master/vt/vt.js#L204-L208
>
> and test it here:
>
>
> Do you have an example of the HTML/JS used to start the project?
>
> On Thu, Feb 15, 2018 at 1:52 PM, Guillermo Senna <[hidden email]> wrote:
>> Hi Victor,
>>
>> It happens always within the 1st second of performance and sometimes you
>> get more than one dropout. A ramp or even starting everything after the
>> first second works -> schedule(1,1,1).
>>
>> It has to be a Firefox issue because Chrome and Chromium don't exhibit
>> the same behavior, so be warned when using Firefox for testing the WASM
>> build in real-time.
>>
>>
>> On 15/02/18 04:50, Victor Lazzarini wrote:
>>> Is it always at that point? Dropouts can happen because the javascript code is running on the main browser thread, and
>>> graphics etc can interrupt the audio.
>>>
>>> Victor Lazzarini
>>> Dean of Arts, Celtic Studies, and Philosophy
>>> Maynooth University
>>> Ireland
>>>
>>>> On 15 Feb 2018, at 03:39, Guillermo Senna <[hidden email]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I've noticed a weird thing when using the wasm build on Firefox. There
>>>> seems to be a "hiccup" in the sound around the 175ms mark. I'm testing
>>>> with the following purposefully non-enveloped instrument:
>>>>
>>>> sr = 48000
>>>> ksmps = 64
>>>> nchnls = 2
>>>> 0dbfs = 1.0
>>>>
>>>> instr 1
>>>>   aout oscils .4, 440, 0
>>>>   outs aout, aout
>>>> endin
>>>> schedule(1, 0, 1)
>>>>
>>>> Listen to the difference in the recordings (rendering works fine) taken
>>>> from Chromium's output
>>>> [https://drive.google.com/open?id=1KQC-EpaoZraOPItTxx65d9go6vU1meco] and
>>>> then Firefox's output
>>>> [https://drive.google.com/open?id=10Z2ewMnHs6MDUij2pNoKQnuIGd7ok3Jm]. Is
>>>> this a problem with Firefox's implementation of WebAudio?
>>>>
>>>> Cheers.
>>>>
>>>> Csound mailing list
>>>> [hidden email]
>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>> Send bugs reports to
>>>>        https://github.com/csound/csound/issues
>>>> Discussions of bugs and features can be posted here
>>> Csound mailing list
>>> [hidden email]
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>         https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>>
>> Csound mailing list
>> [hidden email]
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>         https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Firefox and WASM

gsenna
Hi Steven,

Thanks for the tip! This is for the online csound tutorial I'm working
on right now. The website is based on both your learn-csound-site and
your live-coding project. But as I didn't want to hit the issue related
to Module[TOTAL_MEMORY] we'd discussed before, I don't call anything
upon Module['onRuntimeInitialized']. Instead, I do this when someone
presses a button:

     csound.stop();
     csound.Csound.setOption("-r" + AudioContext_sr.sampleRate);
     csound.CompileCsdText(currentFilePath);
     csound.Play();
 

Works perfectly in Chrome/Chromium for Desktop and Android. I also found
several people complaining about using very short sounds that produce a
click or a change in tone with Firefox. Try this with Firefox and then
Chrome -> https://codepen.io/schwenky/pen/rxRJwE?editors=0011

I'll probably just recommend Chrome/Chromium to people that want to use
the website for now.


On 15/02/18 16:29, Steven Yi wrote:

> (Oops, pressed send before finishing the email)
>
> You can test the web instruments here:
>
> http://instruments.kunstmusik.com/
>
> (Requires touch screen, tested on Surface Pro 4 and Android cell phone)
>
> I'm getting good results without dropouts but it might be due to just
> taking time to hit the screen.
>
> Do you have an example of the HTML/JS used to start the project? I
> wonder if using similar code to what I'm doing will help the
> situation.
>
> On Thu, Feb 15, 2018 at 2:26 PM, Steven Yi <[hidden email]> wrote:
>> It could be JIT warming up or WASM loading process which was optimized
>> recently by Firefox.  However, I seem to remember working with Hlodver
>> on a related issue like this recently and I suggested to him to use
>> Module['onRuntimeInitialized'] to ensure not doing any calls until
>> things completely loaded. You can see this as an example here:
>>
>> https://github.com/kunstmusik/instruments/blob/master/vt/vt.js#L204-L208
>>
>> and test it here:
>>
>>
>> Do you have an example of the HTML/JS used to start the project?
>>
>> On Thu, Feb 15, 2018 at 1:52 PM, Guillermo Senna <[hidden email]> wrote:
>>> Hi Victor,
>>>
>>> It happens always within the 1st second of performance and sometimes you
>>> get more than one dropout. A ramp or even starting everything after the
>>> first second works -> schedule(1,1,1).
>>>
>>> It has to be a Firefox issue because Chrome and Chromium don't exhibit
>>> the same behavior, so be warned when using Firefox for testing the WASM
>>> build in real-time.
>>>
>>>
>>> On 15/02/18 04:50, Victor Lazzarini wrote:
>>>> Is it always at that point? Dropouts can happen because the javascript code is running on the main browser thread, and
>>>> graphics etc can interrupt the audio.
>>>>
>>>> Victor Lazzarini
>>>> Dean of Arts, Celtic Studies, and Philosophy
>>>> Maynooth University
>>>> Ireland
>>>>
>>>>> On 15 Feb 2018, at 03:39, Guillermo Senna <[hidden email]> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I've noticed a weird thing when using the wasm build on Firefox. There
>>>>> seems to be a "hiccup" in the sound around the 175ms mark. I'm testing
>>>>> with the following purposefully non-enveloped instrument:
>>>>>
>>>>> sr = 48000
>>>>> ksmps = 64
>>>>> nchnls = 2
>>>>> 0dbfs = 1.0
>>>>>
>>>>> instr 1
>>>>>   aout oscils .4, 440, 0
>>>>>   outs aout, aout
>>>>> endin
>>>>> schedule(1, 0, 1)
>>>>>
>>>>> Listen to the difference in the recordings (rendering works fine) taken
>>>>> from Chromium's output
>>>>> [https://drive.google.com/open?id=1KQC-EpaoZraOPItTxx65d9go6vU1meco] and
>>>>> then Firefox's output
>>>>> [https://drive.google.com/open?id=10Z2ewMnHs6MDUij2pNoKQnuIGd7ok3Jm]. Is
>>>>> this a problem with Firefox's implementation of WebAudio?
>>>>>
>>>>> Cheers.
>>>>>
>>>>> Csound mailing list
>>>>> [hidden email]
>>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>>> Send bugs reports to
>>>>>        https://github.com/csound/csound/issues
>>>>> Discussions of bugs and features can be posted here
>>>> Csound mailing list
>>>> [hidden email]
>>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>>> Send bugs reports to
>>>>         https://github.com/csound/csound/issues
>>>> Discussions of bugs and features can be posted here
>>> Csound mailing list
>>> [hidden email]
>>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>>> Send bugs reports to
>>>         https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
> Csound mailing list
> [hidden email]
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here