experchange > javascript

Jonas Thörnvall (09-11-18, 09:19 AM)
I try to run the examples in JS fiddle and Code Pen but none of them do "anything", it can't be my OS's? I mean i tried with Vista, 7, 10 and the only ones that output something and seem to work is XP?

Do you get any output / result from running "midi" with these examples below?









So is the web midi api broken or just replaced, if replaced could you point me to working examples with newer one?

***RUDIMENTARY*** no i do not wish to use some library just the web midi api in its simplest form.

If it is replaced could i ask why, it seemed to work perfectly for me?
Because now i do not even know where to look for working code examples. Why change something that isn't broken or was it?

This is what i need to know.
Howto Open devices
Howto Listen to message from device/devices
Howto Send message to device/devices

All in one package "JS", after that i manage just fine.

***Just a working example*** of something echoing in/out and i be on my way.

For some weird reason list the devices still seem to work? But i can't send anything not even echo input to console log, and none of the examples above work.
Jonas Thörnvall (09-11-18, 09:23 AM)
Den tisdag 11 september 2018 kl. 09:19:37 UTC+2 skrev Jonas Thörnvall:
[..]
> All in one package "JS", after that i manage just fine.
> ***Just a working example*** of something echoing in/out and i be on my way.
> For some weird reason list the devices still seem to work? But i can't send anything not even echo input to console log, and none of the examples above work.


I am tired coding in XP, and its better change now then later.
Jonas Thörnvall (09-11-18, 09:49 AM)
Den tisdag 11 september 2018 kl. 09:19:37 UTC+2 skrev Jonas Thörnvall:
[..]
> All in one package "JS", after that i manage just fine.
> ***Just a working example*** of something echoing in/out and i be on my way.
> For some weird reason list the devices still seem to work? But i can't send anything not even echo input to console log, and none of the examples above work.


If W3 themself do not fucking can get a simple loopback to work how is one expected to be able to program to this API????

Can anyone get this to work, i mean it is an example it should work?
Well it give error on entries so i thought it may be a function? I added paragraphs and it pass, listening to nothing, loopback nothing.

But what the fuck???????????



4.10.6 A Simple Loopback
This example loops all input messages on the first input port to the first output port - including system exclusive messages.

********NO THE FUCK IT DOES NOT*************

EXAMPLE 8
var midi = null; // global MIDIAccess object
var output = null;

function echoMIDIMessage( event ) {
if (output) {
output.send( event.data, event.timestamp );
}
}

function onMIDISuccess( midiAccess ) {
console.log( "MIDI ready!" );
var input = midiAccess.inputs.entries.next();
if (input)
input.onmidimessage = echoMIDIMessage;
output = midiAccess.outputs.values().next().value;
if (!input || !output)
console.log("Uh oh! Couldn't get i/o ports.");
}

function onMIDIFailure(msg) {
console.log( "Failed to get MIDI access - " + msg );
}

navigator.requestMIDIAccess().then( onMIDISuccess, onMIDIFailure );
Jonas Thörnvall (09-11-18, 09:51 AM)
Den tisdag 11 september 2018 kl. 09:50:04 UTC+2 skrev Jonas Thörnvall:
[..]
> console.log( "Failed to get MIDI access - " + msg );
> }
> navigator.requestMIDIAccess().then( onMIDISuccess, onMIDIFailure );


And what the fuck are entries supposed to be?
Julio Di Egidio (09-11-18, 12:56 PM)
On Tuesday, 11 September 2018 09:19:37 UTC+2, Jonas Thörnvall wrote:

> I try to run the examples in JS fiddle and Code Pen but none of them
> do "anything",


I opened the first one (in Edge) and got a pretty clear "No MIDI support in
your browser."

> it can't be my OS's? I mean i tried with Vista, 7, 10 and the only ones that
> output something and seem to work is XP?


What has the OS to do with it?? In fact, have you bothered looking at the
documentation at all?

<https://developer.mozilla.org/en-US/docs/Web/API/MIDIAccess>

It starts by saying << This is an experimental technology
Check the Browser compatibility table carefully
before using this in production. >>
And what does the browser compatibility table say?

Though, even if the API is supported by the browser, that still does not mean
that necessarily there are MIDI interfaces (ports) available on your system....

Julio
Jonas Thörnvall (09-11-18, 01:17 PM)
Den tisdag 11 september 2018 kl. 12:56:09 UTC+2 skrev Julio Di Egidio:
[..]
> Though, even if the API is supported by the browser, that still does not mean
> that necessarily there are MIDI interfaces (ports) available on your system...
> Julio


Well Julio if it fucking works using Windows XP with browsers that aren't up to date, ***WHY ISN'T WORKING ON NEW ONES*** "yeah it works on old chromeand opera" at least using Windows XP. I can't see they say anything changed within interface?

Something is just broken?

Can you get any browser working, with the examples using any OS?
Tell me OS and browser, because i had it working under Vista for a day, next day i started browser "probably autoupdate" it did not work any longer.

output.send(message); is undefined on all up to date browsers i tried to send messages.
Jonas Thörnvall (09-11-18, 01:30 PM)
Den tisdag 11 september 2018 kl. 12:56:09 UTC+2 skrev Julio Di Egidio:
[..]
> Though, even if the API is supported by the browser, that still does not mean
> that necessarily there are MIDI interfaces (ports) available on your system...
> Julio


Yeah i do read from the API i did try the latest example. Look for loopback


It doesn't work, and i have midiequipment and ports, they work and scripts work just fine using XP.

So something changed in the API but i do not understand what.
Jonas Thörnvall (09-11-18, 01:35 PM)
Den tisdag 11 september 2018 kl. 13:31:04 UTC+2 skrev Jonas Thörnvall:
> Den tisdag 11 september 2018 kl. 12:56:09 UTC+2 skrev Julio Di Egidio:
> Yeah i do read from the API i did try the latest example. Look for loopback
>
> It doesn't work, and i have midiequipment and ports, they work and scripts work just fine using XP.
> So something changed in the API but i do not understand what.


To be honest i would like to make my fucking sequenser work on something that isn't XP with an old browser.

But i just can't, because output not defined.
Julio Di Egidio (09-11-18, 01:47 PM)
On Tuesday, 11 September 2018 13:17:15 UTC+2, Jonas Thörnvall wrote:

> Well Julio if it fucking works using Windows XP with browsers that aren'tup
> to date, ***WHY ISN'T WORKING ON NEW ONES***


I don't know why most computer producers dropped built-in support for MIDI
at some point before 2010, at least for Windows machines. I guess it was
too good a simple, high-level protocol for interprocess communication...
AFAIK, nowadays one usually only gets it with a proper sound card. But
I may be wrong on the whole line, this is far from my field of expertise.

> "yeah it works on old chrome and opera" at least using Windows XP. I can't
> see they say anything changed within interface?


I'll give it a try on my laptop with Chrome on both Win 10 and Ubuntu,
as soon as I manage...

Julio
Jonas Thörnvall (09-11-18, 02:46 PM)
Den tisdag 11 september 2018 kl. 13:47:42 UTC+2 skrev Julio Di Egidio:
> On Tuesday, 11 September 2018 13:17:15 UTC+2, Jonas Thörnvall wrote:
> I don't know why most computer producers dropped built-in support for MIDI
> at some point before 2010, at least for Windows machines. I guess it was
> too good a simple, high-level protocol for interprocess communication...
> AFAIK, nowadays one usually only gets it with a proper sound card. But
> I may be wrong on the whole line, this is far from my field of expertise.
> I'll give it a try on my laptop with Chrome on both Win 10 and Ubuntu,
> as soon as I manage...
> Julio


Here is a little snippet it do read from in, but nothing goes out.

var midi = null; // global MIDIAccess object
var output = null;

function onMIDIMessage(notemessage) {
output = mid.outputs.get(0);
output.send(noteMessage);
}

function success (midi) {
mid=midi;
inputs = midi.inputs.values();
outputs = midi.outputs.values();
// inputs outputs are Iterators
for (input = inputs.next(); input && !input.done; input = inputs.next()) {
// each time there is a midi message call the onMIDIMessage function
input.value.onmidimessage = onMIDIMessage;
}
}

function failure(msg) {
console.log( "Failed to get MIDI access - " + msg );
}
Similar Threads