Re: Adding MIDI APIs to Audio WG Charter (was: MIDI enumeration (was: Re: getUserMedia use cases))

02.02.2012, 15:32, "Robert O'Callahan" <robert@ocallahan.org>:
> Accessing an OS synthesizer raises the issue of inconsistent synthesis across OSes (which was raised as a priority by Joseph earlier in the thread). Sending untrusted input to that native code also increases attack surface. Building a synthesizer into every browser adds footprint and also raises cross-browser inconsistency issues and new attack surface.
>
> It would be really good if there was an open-source Javascript synthesizer that all developers could use (assuming browsers implement a suitable API to play the generated samples). Is there any good code available that could be adapted for this? It would be very helpful if someone investigated the viability of this approach.
>
> Rob
> --
> "If we claim to be without sin, we deceive ourselves and the truth is not in us. If we confess our sins, he is faithful and just and will forgive us our sins and purify us from all unrighteousness. If we claim we have not sinned, we make him out to be a liar and his word is not in us." [1 John 1:8-10]

Even if there was pure-script GM synth fully capable to play GM SMF MIDIs, it would have fundamental problems (even apart from that it would consume much CPU power):

1. if it would generate timbres on-the-fly (e.g. with FM-chip-like algorithms), its sound would be as lo-fi as sound of OPL-chips on cheap soundcards did provide in previous century;

2. even if the pure-script GM synth would have support for wave samples, users would be forced to download all that multi-megabyte samples to just listen one MIDI. Samples can have size of at least several megabytes, and at maximum -- hundreds of megabytes. Regular MIDI file is extremely small -- it usually have size less than 100 KB. So instead of downloading samples, it would be easier for user to download prerendered MP3 since need for download samples would just nullify benefit of small MIDI-size.

Unlike pure-script synth, using local system GM synth, it's easy to download small MIDI file itself and be able to benefit from its small size compared with wave-like formats such as MP3 or Ogg Vorbis.

I would prefer having ability to play MIDI files at least in Windows browsers. It would be much better than inability to play MIDI files at all. Browser's Audio.canPlayType('audio/midi') method could consider availability of system GM synth on particular computer, and pure-script synth could be used as _fallback_ then, not as main and only option.

Received on Friday, 3 February 2012 23:07:05 UTC