abudaan / heartbeat Goto Github PK
View Code? Open in Web Editor NEWa javascript MIDI/Audio sequencer for your browser
Home Page: http://abudaan.github.io/heartbeat/
a javascript MIDI/Audio sequencer for your browser
Home Page: http://abudaan.github.io/heartbeat/
Will be added to song.addEventListener()
In function KeyEditor.prototype.getSnapshot 'recordedEventsSong' and 'recordedNotesSong' are sometimes undefined throwing an error. This happens when loading new songs and removing old ones
for a quick fix i've added an 'if' block around the objects so they are not called
recordedEventsSong = this.song.recordedEvents;
**if(recordedEventsSong){**
length = recordedEventsSong.length;
for(i = 0; i < length; i++){
tmp = recordedEventsSong[i];
if(this.recordedEventsObj[tmp.id] === undefined){
tmp.bbox = this.getEventRect(tmp);
recordedEvents.push(tmp);
this.recordedEventsObj[tmp.id] = tmp;
}
}
}
recordedNotesSong = this.song.recordedNotes;
**if(recordedNotesSong){**
length = recordedNotesSong.length;
for(i = 0; i < length; i++){
tmp = recordedNotesSong[i];
if(this.recordedNotesObj[tmp.id] === undefined){
this.recordedNotesObj[tmp.id] = tmp;
tmp.bbox = this.getNoteRect(tmp);
recordedNotes.push(tmp);
//console.log('recordedNotes', tmp);
}else if(tmp.endless === true){
tmp.bbox = this.getNoteRect(tmp);
recordingNotes.push(tmp);
//console.log('endless1', tmp);
}else if(tmp.endless === false){
tmp.bbox = this.getNoteRect(tmp);
recordingNotes.push(tmp);
//console.log('endless2', tmp);
tmp.endless = undefined;
}
//console.log(tmp.bbox.width);
}
}
I'm just imported and called the save:
const song = window.sequencer.createSong(window.sequencer.getMidiFile('minute_waltz'));
window.sequencer.saveSongAsMidiFile(song);
It saves fine, but when I try to load it here or here it fails. The original midi file works fine.
The original and saved midi archives:
The 'transposeAllEvents' method can throw an error from Heartbeat. 'you can only transpose note on and note off'
I tried to require the library in a codepen environment (that requires esmodules via skypack cdn), and I am getting the following error (see pen):
Uncaught ReferenceError: parcelRequire is not defined
at parcelRequire.ipHv (heartbeat-sequencer.js:60)
at heartbeat-sequencer.js:63
at createCommonjsModule (heartbeat-sequencer.js:11)
at heartbeat-sequencer.js:16
From my understanding, it has to do with some package.json
module declaration / this parcel issue.
On the other hand it works fine in codesandbox because it bundles the app via node in a VM, and not directly in the browser.
I understand that it is not strictly related to the module itself, but to access it from codepens makes prototyping / showcasing much faster ^^
Using the function 'addPartAt' with an empty part causes the part always to start at position 0 regardless of the ticks sent.
We use this feature when a user creates a new part to start adding notes to. ie. Dragging a 'new part' icon to the position in the sequence where an editor opens allowing notes to be added at that bar.
If I try the same code with a note pre populated into the part it works. This is part of my current workaround.
Workaround
create a NEW part with a note ** HB workaround
currentTrack.addPartAt(part, ['ticks', partPosition]);
update Song
remove all part events ** HB workaround
part is in correct position
Possible bug
1 - Create a song from a midi file
2 - Delete that song
bug?
3 - Now create a song from the same midi file, the song has no notes or tracks
I can create a multiple songs with the same midi file but if I delete a song then the song after that are blank.
Hello,
I would like to play midi files (.mid) with heartbeat.js. This works so far, however every track is played with then sinewave instrument.
Is it possible to use general midi instruments? How can you add instruments so that the "original" instruments from the .mid file are used?
Function Track.prototype.reset - around line 19709
this.audio.setSong(null); causes error
temp fix
if(this.audio){
this.audio.setSong(null);
}
I've been using heartbeat successfully for the last week using it to communicate Chrome with Ableton Live using the OSX built-in IAC driver. Suddenly the MIDI stopped initializing with no error message whatsoever. Tracing the lines one by one I notice that the line midi.outputs() is the one making the init function stop.
Trying to find out if it's a problem with my program, I tried to run the heartbeatjs.org examples with the same result. Then I tried to use both Chromium and Chrome Canary. both get stuck in the "getting midi ports..." message and display the same error :
I tried restarting the sound system, running it with Jazz plugin in FireFox and Safari:
-In Safari with the Jazz plugin, I get the same problem. The examples are stuck in the "getting MIDI ports..." message with no error. (The metronome takes 0s to parse)
-In FireFox (as of this morning) it initializes normally with the Jazz plugin (unexpectedly).
Not a bug but, slightly inconsistent maybe.. not important
I can set an id on a track (I did this by mistake). In console logs the id in the track has been updated but using getTrack cannot by used with that id.
Hi there. First of all, create lib, thanks.
I know we can remove notes and I know there is a way to move a note around, but I'm trying to add a note when clicking in the score. Is there any example that I've missed that does that?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.