MIDI.js icon indicating copy to clipboard operation
MIDI.js copied to clipboard

Safari on iPad fails to play multiple tracks

Open kusog opened this issue 10 years ago • 7 comments

I'm unable to here sound when playing the latest version of your code on the iPad. However, the demo site version works.

I've also noticed that the demo site code base works on the iPad, but won't play multi-track midi files properly. No sound is played, even though on my demo site http://kusogmusic.azurewebsites.net/home/contact the notes fall for both tracks. It seems that it is trying to play. If you want to see that, pick the Cyrstallize Duet. The duet song is the same instrument for both tracks, so I wonder if it is not the same issue as you outlined with multiple instruments in another issue.

On my windows 8.1 desktop, it works fine with IE11, Chrome, Opera, and FireFox.

kusog avatar Feb 16 '14 02:02 kusog

I believe this is due to CPU overload. When used on lower end PCs I get odd problems. When used on the Mac with Safari or Chrome, the CPU is hit and the more sounds playing at once the more the sound quality is impacted. Removed the gain node helps significantly. I believe that when using web audio api, anything that requires sound processing like the gain will eat CPU. Works fantastic on Chrome for my quad core i7, but not so good on Chrome on my Acer Iconia W500 with the C50 atom cpu.

kusog avatar Feb 17 '14 19:02 kusog

In some ways, using

kusog avatar Feb 17 '14 19:02 kusog

Hi @kusog, Good point, there should be an option to turn on/off any special WebAudioAPI features, like gain support (and future effects) to support Mobile browsers more effectively. I'll take a look into this and add to the list for next release. Also, browser support for MIDI.js listed on the project page would be a boon.

mudcube avatar Feb 18 '14 05:02 mudcube

In the meantime, it'd be easy for you to detect iOS, and then have a conditional in the plugin.js that prevents linearRampToValueAtTime, and the createGain function from being run in the WebAudioAPI portion of the script.

mudcube avatar Feb 18 '14 05:02 mudcube

I discovered that the version of MIDI-js I am running will set gain volume above 1, yet the docs say the value should be between 0 and 1 as a decimal. When I did some tests and just hard coded the volume to 50, I get the bad scratchy sound on Safari. A test I made just working with web audio API works great on safari >6.0 with many sounds playing even with gain and no problems.

From: Michael Deal [mailto:[email protected]] Sent: Tuesday, February 18, 2014 12:47 AM To: mudcube/MIDI.js Cc: kusog Subject: Re: [MIDI.js] Safari on iPad fails to play multiple tracks (#64)

Hi @kusog https://github.com/kusog , Good point, there should be an option to turn on/off any special WebAudioAPI features, like gain support (and future effects) to support Mobile browsers more effectively. I'll take a look into this and add to the list for next release. Also, browser support for MIDI.js listed on the project page would be a boon.

— Reply to this email directly or view it on GitHub https://github.com/mudcube/MIDI.js/issues/64#issuecomment-35354783 . https://github.com/notifications/beacon/1085858__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcwODIzNTIzMCwiZGF0YSI6eyJpZCI6MjU3NjIyMTd9fQ==--1584e23d93d3f2d74eb6cb40bad77f6514a084c4.gif

kusog avatar Feb 18 '14 15:02 kusog

@kusog I noticed in the docs it says between 0-1 also but for some reason it requires -1 in order to turn the volume completely off... so I mapped from -1.0 to 1.0 for the MIDIPlayer demo. I've added an upwards constraint for values more than 1.0 in the latest push to prevent accidentally going out of range.

mudcube avatar Feb 18 '14 20:02 mudcube

The iPad is still a problem. I was using an older version of your library from Feb and your library worked reasonably well on the iPad in both safari and chrome. I just upgraded to the latest version and there are significant performance issues on Safari.

Let me know if I can help in any way. Unfortunately I don't have a Mac, so I can't debug anything on an Ipad. (Silly platform)

montulli avatar Jul 27 '15 18:07 montulli