MidiPlayer | javascript class to play MIDI music | Audio Utils library
kandi X-RAY | MidiPlayer Summary
kandi X-RAY | MidiPlayer Summary
MIDI is a widely used music format online. However the HTML5 Audio tag supports only wav/mp3/ogg formats so far. Playing MIDI usually uses the embed tag which requires the QuickTime plugin, or deprecated tag such as bgsound in IE, but not always work. The MidiPlayer javascript class is used to play MIDI, without any plugin. It requires a HTML5 browser: firefox, chrome, safari, opera. IE9+ may work but not tested. Firefox works the best, followed by Chrome, Safari and Opera.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of MidiPlayer
MidiPlayer Key Features
MidiPlayer Examples and Code Snippets
Community Discussions
Trending Discussions on MidiPlayer
QUESTION
I'm attempting to play a basic MIDI file using AudioKits legacy sequencer, AKAppleSequencer. I've gotten it to play the first note of the file, but nothing after. (I couldn't get any output from the new AKSequencer.) Here is my code which is essentially identical to the MIDI playback code from AudioKits Playgrounds.
...ANSWER
Answered 2020-Apr-22 at 22:35You've declared your sampler, mixer, sequencer etc all within the scope of a single function. When the function completes, the OS assumes you're done with them, and will try to free up the memory they used.
This function is actually a method within a class. Try declaring these variables at the class level, so that they can persist after the method completes. E.g.,
QUESTION
I am developing a JavaScript library (https://github.com/yvesgurcan/web-midi-player) to enable MIDI playback in a web application. The library relies on the Web Audio API to create a way to play these MIDI files (https://github.com/yvesgurcan/web-midi-player/blob/test/src/MidiPlayer.js#L50). However, I am having trouble creating meaningful unit tests with Jest (https://github.com/yvesgurcan/web-midi-player/blob/test/tests/midiPlayer.js) because these tests don't have access to the window
object and more particularly to window.AudioContext
. As a consequence, running my application code which relies on AudioContext
throws errors related to the fact that this object does not exist and I can't actually test very much things in the library.
I've tried the following packages to solve my problem: jsdom
, jsdom-global
, and also web-audio-test-api
but none of these seem to inject AudioContext
in the environment.
I am thinking that the solution here would be to stub/mock AudioContext
but that does not sound like a good solution for solid unit tests.
What do you folks suggest to test the Web Audio API? Is stubbing the only viable solution here?
...ANSWER
Answered 2019-Dec-14 at 18:49I think it depends a bit on what you want to test. Since you're using Jest I imagine you're just interested in testing the correctness of your own code. In that case I would recommend to fully mock the Web Audio API. It's not part of your responsibility and you can assume it works the way it should. The only thing you have to test is if your code is making the expected calls.
Mocking globally available variables like the AudioContext constructor is always a bit tricky but you could allow an AudioContext to be passed into your MidiPlayer
class as an optional argument. It would make testing a little easier and it would also allow users of your library to bring their own AudioContext.
I think of something like this:
QUESTION
I'm trying to use Apple's AVMIDIPlayer
object for playing a MIDI file. It seems easy enough in Swift, using the following code:
ANSWER
Answered 2017-Apr-25 at 21:21You need to ensure that the midiPlayer
object exists until it's done playing. If the above code is just in a single function, midiPlayer
will be destroyed when the function returns because there are no remaining references to it. Typically you would declare midiPlayer
as a property of an object, like a subclassed controller.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install MidiPlayer
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page