All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
This update will break almost all existing applications!
The package has moved to @nbsjs/core
to allow for future addons to the library.
Please carefully read through these changes and refer to the examples.
- The project has been rebranded from
NBS.js
tonbs.js
. - The project has moved from
@encode42/nbs.js
to@nbsjs/core
. - The project's repository has moved to the OpenNBS organization.
- The project is designated as a module by default.
- This update redesigns how classes and their properties are structured.
- Continuing what v5 started, multiple arrays tied to IDs/ticks have been transformed into an object.
SongInstruments#all
is now indexed byID: Instrument
.
- Renamed
Song#nbsVersion
toSong#version
. - Moved all properties from
Song#meta
andSong#stats
intoSong
. - Moved all properties from
Layer#meta
intoLayer
. - Moved all properties from
Instrument#meta
intoInstrument
. - Renamed
Song#autosave
toSong#autoSave
. - Some
Song
properties are now getters to reflect their dynamic nature.Song#length
->Song#getLength()
Song#duration
->Song#getDuration()
Song#lastMeasure
->Song#getLastMeasure()
Song#tempo
->Song#getTempo()
Song#timePerTick
->Song#getTimePerTick()
- The
Song#hasSolo
property is now a method. - The following
Song
methods have been replaced:Song#createLayer
->SongLayers#create
Song#addLayer
->SongLayers#add
Song#deleteLayer
->SongLayers#delete
Song#setNote
->LayerNotes#set
Song#addNote
->LayerNotes#add
- The
SongInstruments#loaded
property has been renamed toSongInstruments#all
. - The
Instrument#builtIn
property has been renamed toInstrument#isBuiltIn
. - The ArrayBuffer writer no longer requires two passes. This doubles the speed of buffer exports!
- Properties that are not designed to be modified are now
readonly
. - The build system has been remade using Bun.
- The docs have been reorganized to reflect the project's larger scope.
- Moved all classes out of
util.ts
and into their own files.
- The
Song#setTempo
andSong#setTimePerTick
methods update each other when changed. - The
SongLayers
class that provides helper methods and stores layers. - The
LayerNotes
class that provides helper methods and stores notes. - The following helper methods and properties for
SongInstruments
:getTotal
,set
,add
,create
, anddelete
. SongLayers
,LayerNotes
, andSongInstruments
are now iterable in a loop.- The
omitEmptyLayers
function. - The
Mutable
type class. - Examples featuring multiple real-world use cases.
- Documentation categories.
- The
Song#toArrayBuffer
method. (usetoArrayBuffer
) - The private
Song#expand
method. - The
Song#errors
property. (errors are thrown instead) - The
Song#arrayBuffer
property. - The ability to pass an
Instrument
instance intoNote
's constructor. - The
Instrument#id
property and constructor parameter. util.ts
- Consistency between existing files and exported songs has been improved.
- This means that importing and immediately exporting a song will yield identical buffers.
- The song no longer expands one tick too far.
-
Layer#notes
has been changed from an array to an object.- The object has been designed similarly to an array to ensure parity with existing code.
- Applications that access notes using a property accessor should continue to function normally.
- Applications that iterate
Layer#notes
using a for loop require changes. For example:
for (const note of layer.notes) {}
Is translated to
for (const note of Object.values(layer.notes)) {}
toArrayBuffer
now has anoptions
parameter acceptingignoreEmptyLayers
as a boolean.- The
Song#addLayer
function to add existingLayer
objects to the song. - The
Layer#inSong
boolean used to show a warning whenLayer#setNote
orLayer#addNote
are called within a song. - The
defaultToArrayBufferOptions
object. - The
ToArrayBufferOptions
interface. - The
LayerNotes
interface. - More tests to ensure consistency and accuracy.
- No longer marks itself as a module.
- Updated examples in readme and docs.
#9
: Fix custom instruments getting empty name and ID.
- Meta repository restructuring, developer dependency updates, etc.
- Incorrect default panning for older NBS file formats.
- Incorrect
nbsVersion
for songs using v0, causing read errors. - Incorrect
Instrument
s incorrectly being read.
- Renamed
pitch
tokey
inInstrumentOptions
. - Renamed
pitch
tokey
indefaultInstrumentOptions
. - Renamed
pitch
tokey
inInstrument
. - Improved and updated docs.
- Updated all devDependencies.
- Removed NPM dependency.
- Cleaned up eslint config.
- Cleaned up tsconfig.
- The various class getters/setters from
util
.- This never worked properly. A better solution for modifying these classes would be to write a wrapper.
getLayerClass
getNoteClass
getInstrumentClass
setLayerClass
setNoteClass
setInstrumentClass
- This never worked properly. A better solution for modifying these classes would be to write a wrapper.
- Tuottaa dependency and index page.
- Replacement is being worked on.
fromArrayBuffer
now supports trimming empty leading layers.- ONBS automatically generates extra layers past the last populated layer.
- Created basic testing via
jest
. - Added ESLint and plugins to
devDependencies
. - Added
test
script which lints and runs tests. - The
options
argument infromArrayBuffer
. - The
FromArrayBufferOptions
interface.
- The
build
now runs thetest
script. - All interfaces, classes, and objects no longer have a default export.
- This should not affect
@encode42/nbs.js
imports.
- This should not affect
- All interfaces have been moved to their respective class.
- For example,
InstrumentMeta.ts
->Instrument.ts
.
- For example,
- The
nbs/interfaces
directory. - The
SongMeta.ts
interface file.- Moved to
Song.ts
.
- Moved to
- The
SongStats.ts
interface file.- Moved to
Song.ts
.
- Moved to
- The
SongAutosaveOptions.ts
interface file.- Moved to
Song.ts
.
- Moved to
- The
SongLoopOptions.ts
interface file.- Moved to
Song.ts
.
- Moved to
- The
LayerMeta.ts
interface file.- Moved to
Layer.ts
.
- Moved to
- The
NoteOptions.ts
interface file.- Moved to
Note.ts
.
- Moved to
- The
InstrumentMeta.ts
interface file.- Moved to
Instrument.ts
.
- Moved to
- The
InstrumentOptions.ts
interface file.- Moved to
Instrument.ts
.
- Moved to
- Updated all
devDependencies
. - Revamped build scripts.
- Changed target from
ESNext
toES2015
for compatibility.
- Properly included typings.
- Moved
devDependencies
out ofdependencies
.
- Fixed potential
defaultSongMeta
pollution. - Fixed potential
defaultSongLoopOptions
pollution. - Fixed potential
defaultSongAutosaveOptions
pollution. - Fixed
defaultSongStats
pollution. - Fixed potential
defaultLayerMeta
pollution. - Fixed potential
defaultInstrumentMeta
pollution.
- The
Song#arrayBuffer
field. - The
SongStats#lastMeasure
getter.
- The
defaultSongStats#duration
getter is now defined after song instantiation. - The
defaultSongStats#hasSolo
getter is now defined after song instantiation.
- The
defaultSongStats#duration
default value. - The
defaultSongStats#hasSolo
default value.
- Minified bundles (
cjs.min.js
,esm.min.js
, andumd.min.js
).
- Updated
README.md
.
- The
Song#meta
field. - The
Song#loop
field. - The
Song#autosave
field. - The
Song#stats
field. - The
options
argument inSong#addNote
. - The
Layer#meta
field. - The
options
argument inLayer#addNote
. - The
Note#meta
field. - The
options
argument inNote
. - The
Instrument#meta
field. - The
SongInstrument
class. - The
SongMeta
interface. - The
SongStats
interface. - The
SongAutosaveOptions
interface. - The
SongLoopOptions
interface. - The
LayerMeta
interface. - The
NoteOptions
interface. - The
InstrumentMeta
interface. - The
InstrumentOptions
interface. - The
defaultSongMeta
object. - The
defaultSongStats
object. - The
defaultSongAutosaveOptions
object. - The
defaultSongLoopOptions
object. - The
defaultLayerMeta
object. - The
defaultNoteOptions
object. - The
defaultInstrumentMeta
object. - The
defaultInstrumentOptions
object.
- Renamed
Song#size
toSong#length
. - Renamed
Song#addLayer
toSong#createLayer
. - Swapped
layer
andtick
arguments inSong#setNote
. - Moved various fields from
Song
toSong#meta
- The
Song#name
field. - The
Song#author
field. - The
Song#originalAuthor
field. - The
Song#description
field. - The
Song#midiName
field.- Renamed to
SongMeta#importName
.
- Renamed to
- The
- Moved various fields from
Song
toSong#loop
- The
Song#loopEnabled
field.- Renamed to
SongLoopOptions#enabled
.
- Renamed to
- The
Song#loopStartTick
field.- Renamed to
SongLoopOptions#startTick
.
- Renamed to
- The
Song#maxLoopCount
field.- Renamed to
SongLoopOptions#totalLoops
.
- Renamed to
- The
- Moved various fields from
Song
toSong#autosave
- The
Song#autoSaveEnabled
field.- Renamed to
SongAutosaveOptions#enabled
.
- Renamed to
- The
Song#autoSaveDuration
field.- Renamed to
SongAutosaveOptions#interval
.
- Renamed to
- The
- Moved various fields from
Song
toSong#stats
- The
Song#minutesSpent
field. - The
Song#leftClicks
field. - The
Song#rightClicks
field. - The
Song#blocksAdded
field. - The
Song#blocksRemoved
field. - The
Song#hasSolo
field.- Checks for
Layer#isSolo
on get.
- Checks for
- The
Song#endTime
field.- Renamed to
SongStates#duration
.
- Renamed to
- The
- Moved various fields from
Song
toSong#instruments
- The
Song#firstCustomIndex
field. - The
Song#instruments
field.- Renamed to
SongInstrument#loaded
.
- Renamed to
- The
- Moved various fields from
Layer
toLayer#meta
- The
Layer#name
field.
- The
- Renamed
Layer#locked
toLayer#isLocked
. - Renamed
Layer#solo
toLayer#isSolo
. - Renamed
Layer#velocity
toLayer#volume
. - Renamed
Layer#panning
toLayer#stereo
. Note#instrument
now stores an instrument ID.- Moved various fields from
Instrument
toInstrument#meta
- The
Instrument#name
field. - The
Instrument#audioSrc
field.- Renamed to
InstrumentOptions#soundFile
.
- Renamed to
- The
- Replaced
static Song#fromArrayBuffer
withUtil#fromArrayBuffer
. - Replaced
static Song#toArrayBuffer
withUtil#toArrayBuffer
. - Typescript now compiles to ESNext rather than CommonJS.
- Switched from Webpack to Rollup for CommonJS and ESM modules.
- CommonJS and ESM modules are now stored in
dist
.package.json
should handle this. - Improved documentation in
util.ts
. - Adjusted documentation everywhere to match the official documentation.
- Made
Buffer#buffer
readonly.
- The
key
argument inSong#addNote
. - The
panning
argument inSong#addNote
. - The
velocity
argument inSong#addNote
. - The
pitch
argument inSong#addNote
. - The
key
argument inLayer#addNote
. - The
panning
argument inLayer#addNote
. - The
velocity
argument inLayer#addNote
. - The
pitch
argument inLayer#addNote
. - The
key
argument inNote
. - The
panning
argument inNote
. - The
velocity
argument inNote
. - The
pitch
argument inNote
. - The
name
argument inInstrument
.
- Bumped webpack version from
5.65.0
to5.67.0
.
- Custom instruments polluting
Instrument#builtIn
.
- Correctly generated webpack bundle.
- Updated various values in
package.yml
. - Updated NPM scripts.
dist/index.js
is now published to NPM.
- Made
Layer#setNote
return thenote
argument. - Made
Song#nbsVersion
default to5
. - Made
Song#firstCustomIndex
default toInstrument#builtIn.length
- Improved method documentation.
- The
Song#setNote
method.
BufferReader#viewer
andBufferWriter#viewer
have been madeprotected
.
pressKey
toInstrumentOptions
. Defaults tofalse
.- The
Instrument#pressKey
field. - The
Layer#solo
field. - The
Song#firstCustomIndex
field. - The
Song#hasSolo
field. - The
Song#addNote
method. - The
Song#toArrayBuffer
member and static method.
pitch
fromInstrumentOptions
.song
fromLayer
's constructor.- The
Instrument#pitch
field. - The
Layer#song
field. - The
Layer#delete()
method.
- The
Instrument#builtIn
field incorrectly being overwritten by falsy values. - The
Note#instrument
field incorrectly being overwritten by falsy values. - The
Note#key
field incorrectly being overwritten by falsy values. - The
Note#panning
field incorrectly being overwritten by falsy values. - The
Note#velocity
field incorrectly being overwritten by falsy values. - The
Note#pitch
field incorrectly being overwritten by falsy values.
- Made
InstrumentOptions
a public interface. - Made
Instrument#name
default to""
. - Made
Instrument#audioSrc
default to""
. - Made
Instrument#pitch
default to0
. - Made
Instrument#key
default to45
. - Made
Instrument#builtIn
default tofalse
. - Made
Layer#panning
default to0
. - Made
Song#tempo
default to10
. - Moved
Layer#setNote
toLayer#addNote
. - Moved
Layer#addNote
'sinstrument
argument. - Improved method documentation.
- Defaults for
Note
's constructor. - The
instrument
argument toNote
's constructor. - The
Song#errors
field. - The
Layer#setNote
method.