meenie / 8bit.js Goto Github PK
View Code? Open in Web Editor NEW8Bit.js Audio Library - Write music using 8bit oscillation sounds.
8Bit.js Audio Library - Write music using 8bit oscillation sounds.
For example:
var music = new EightBit();
var mario = {
signature: [2, 2],
tempo: 200,
instruments: {
left: 'square',
right: 'square'
},
notes: [
{ instrument: 'right', type: 'note', time: 'quarter', data: 'E5, F#4' },
{ instrument: 'right', type: 'note', time: 'quarter', data: 'E5, F#4' },
{ instrument: 'right', type: 'rest', time: 'quarter' }
// ... etc ...
]
};
music.load(mario);
music.play();
Original NES had 5 channels:
Source: http://battleofthebits.org/lyceum/View/NES/
With your library you can currently achieve the 2 pulse channels and the triangle channel. As for DPCM I don't care. It could be neat if the library would support the NES noise channel, but it certainly will be tricky. What do you think about that?
Some resources about the NES noise channel:
http://wiki.nesdev.com/w/index.php/APU_Noise
http://forums.nesdev.com/viewtopic.php?t=3879
http://www.youtube.com/watch?v=la3coK5pq5w
http://bobrost.com/nes/files/nessound.txt
Tried the online demo and cloned the repo to try the example locally. But I always get this error in JS console of my browser:
Error: 'undefined' is not a function (evaluating 'p.createGain()')
Tried with Safari and Chrome.
I was wondering how your fade (in/out) worked, and noticed that you are using:
if (i > 0) {
i = i - 2;
i = i < 0 ? 0 : i;
var gain = 'up' === direction ? masterVolumeLevel * 100 - i : i;
masterVolume.gain.value = gain / 100;
...
Would it be less verbose/painful and probably more efficient to use one of the specified audioparam automation methods from http://www.w3.org/TR/webaudio/#methodsandparams-AudioParam ?
I think linearRampToValueAtTime() would do pretty much the same thing you are doing here.
Have you tried the methods and found them to not be usable, or did you not know about them? This could be interesting feedback to us in the W3C Audio WG.
I created an experimental branch with support for an external configuration file. I suck at JavaScript though, so I don't know if this functionality even works at this point (and I haven't tested it yet.)
What do you think of it?
I have decided that 8bit.js needs to be more than just oscillator sounds because the Web Audio API is much more. I have spent the last couple of hours refactoring code and pulling sections into their own files. It now gives people the opportunity to write their own Rhythm, Tuning, or Instrument Packs and use them to compose music. For rhythms, Band.js ships with North American (whole, half, quarter) and European (Semibreve, Minim, Crotchet) Rhythms. For tuning, it only ships with Equal Temperament tuning (should be fine as most modern music uses this). And for instruments it ships with Oscillators and Noises (white, pink, brown). What this means is anyone can write an instrument to use and share it with the community.
The library is located here: https://github.com/meenie/band.js
Please uses this issue to discuss. Or open up a new issue in the new Band.js library repo.
We at VersionEye are working hard to keep up the quality of the bower's registry.
We just finished our initial analysis of the quality of the Bower.io registry:
7530 - registered packages, 224 of them doesnt exists anymore;
We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).
Sadly, your library meenie/8bit.js
is one of them.
Can you spare 15 minutes to help us to make Bower better?
Just add a new file bower.json
and change attributes.
{
"name": "meenie/8bit.js",
"version": "1.0.0",
"main": "path/to/main.css",
"description": "please add it",
"license": "Eclipse",
"ignore": [
".jshintrc",
"**/*.txt"
],
"dependencies": {
"<dependency_name>": "<semantic_version>",
"<dependency_name>": "<Local_folder>",
"<dependency_name>": "<package>"
},
"devDependencies": {
"<test-framework-name>": "<version>"
}
}
Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.
NB! Please validate your bower.json with jsonlint before commiting your updates.
Thank you!
Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!
This library might prove helpful: https://github.com/gasman/jasmid/blob/master/midifile.js
LilyPond and ABC are music typesetting engines with some MIDI support. They have relatively-simple notation formats.
It would make composition/transcription simpler if the library could support notation in either format (I'm partial to LilyPond myself).
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.