All Projects → warpdesign → modplayer-js

warpdesign / modplayer-js

Licence: MIT license
JavaScript player for SoundTracker mod files using AudioWorklet API

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to modplayer-js

libxm
A small XM (FastTracker II Extended Module) player library.
Stars: ✭ 94 (+213.33%)
Mutual labels:  tracker, mod
glicol
(Audio) graph-oriented live coding language and music DSP library written in Rust
Stars: ✭ 853 (+2743.33%)
Mutual labels:  webaudio, audioworklet
Bassoontracker
Webbased old-school Amiga music tracker in plain old javascript - Plays and edits Amiga Mod files and FastTracker XM files
Stars: ✭ 698 (+2226.67%)
Mutual labels:  tracker, webaudio
pocketmod
Small ANSI C library for turning ProTracker MOD files into playable PCM audio.
Stars: ✭ 54 (+80%)
Mutual labels:  tracker, mod
Theorytracker
🎼 HTML5/WebAudio multi-track functional harmony analysis and songwriting app! -- https://hlorenzi.github.io/theorytracker/
Stars: ✭ 62 (+106.67%)
Mutual labels:  tracker, webaudio
eventhub
Open-source event organizing web application and a reference DDD solution.
Stars: ✭ 97 (+223.33%)
Mutual labels:  sample
cheatgui
The Noita cheat gui mod, now in its own repo
Stars: ✭ 59 (+96.67%)
Mutual labels:  mod
MetalPlayer
A video player using Metal.
Stars: ✭ 68 (+126.67%)
Mutual labels:  sample
Open-Terraria-API
Open Terraria API - Mac, Linux & Windows
Stars: ✭ 65 (+116.67%)
Mutual labels:  mod
hana-ml-samples
This project provides code examples for SAP HANA Predictive and Machine Learning scenarios and is educational content. It covers simple Predictive Analysis Library SQL examples as well as complete SAP HANA design-time “ML scenario”-application content or HANA-ML Python Notebook examples.
Stars: ✭ 67 (+123.33%)
Mutual labels:  sample
d2modmaker
A program that lets you mod Diablo II from a config
Stars: ✭ 82 (+173.33%)
Mutual labels:  mod
ModdingDiablo2Resurrected
This repository contains some tools and guides on modding Diablo 2 Resurrected.
Stars: ✭ 75 (+150%)
Mutual labels:  mod
spring-kotlin-angular4
Another abadoned Spring Boot application with Angular and Kotlinabandoned
Stars: ✭ 22 (-26.67%)
Mutual labels:  sample
Rebirth-Of-The-Night
Inspired by Terraria, 7 Days to Die, and more, Rebirth of the Night is a Minecraft 1.12.2 modpack with its own progression system, lore, mechanics, and art. It's built with the idea of remembering the central themes of what made Minecraft enjoyable and expanding them in every way, increasing the overall risk and reward as you progress.
Stars: ✭ 82 (+173.33%)
Mutual labels:  mod
pseudo-js
PLAYSTATION emulator in JavaScript
Stars: ✭ 76 (+153.33%)
Mutual labels:  webaudio
metal-chests
Better alternative to IronChests
Stars: ✭ 13 (-56.67%)
Mutual labels:  mod
cashier-register
Cashier Register is a simple quota feature usage tracker for Laravel Cashier subscriptions.
Stars: ✭ 93 (+210%)
Mutual labels:  tracker
Bannerlord.MBOptionScreen
Mod Configuration Menu. A Module for easy Setting integration. Documentation available.
Stars: ✭ 29 (-3.33%)
Mutual labels:  mod
ffapi-project
A project containing all Fast Food related APIs and other things.
Stars: ✭ 21 (-30%)
Mutual labels:  mod
lead ind
Mindustry mod - new drills, liquids and more
Stars: ✭ 48 (+60%)
Mutual labels:  mod

modplayer-js

JavaScript player for SoundTracker/Noisetracker mod files using the webaudio AudioWorklet API.

ModPlayer screenshot

For a demo, head over here.

Requirements

modplayer-js requires a browser that supports the ScriptProcessNode API and will make use of the new AudioWorklet API if it's detected (as I'm publishing it only Chrome supports it).

The native AudioWorklet API is used in these browsers:

  • Chrome 70 (OSX, Windows)

Modplayer-js will fall back to the deprecated ScriptProcessorNode API in these browsers:

  • Safari 11.1.2 (OSX & iOS)
  • Firefox 62.0 (OSX)
  • Edge 42.17134.4071.0 (Xbox One, stuttering audio)
  • Edge 42 17134.1.0 (Windows 10, stuttering audio)

What's implemented

  • Amiga 4 channel Sountracker/Noisetracker mod files with 4 channels and 15-31 instruments
  • Stereo playback (channels 0 & 3 goes to the left chan, 1 & 2 to the right, just like on a real Amiga)
  • LowPass filter (not sure it sounds right)
  • Individual Spectrum vizualizers for each channel (AudioWorklet mode only)
  • Ability to mute any of the 4 module channels (AudioWorklet only)
  • 26 great modules of various styles and times are downloaded from The Mod Archive

Most note effects should be supported, including extended ones.

Dependencies

ModPlayer JS makes use of the following piece of software:

I also heavily used MilkyTracker and webaudio-mod-player - which plays lot of module formats with high fidelity - to track down some timing bugs.

Building modplayer-js

modplayer-js only needs a webserver, which can be installed by typing npm install and then http-server.

If you want to use modplayer-js on an Xbox One, you'll also need to type npm run build: this will generate an ES5 version of the mod-processor.js file.

This is because for some unknown reason, on Xbox One Edge, the audioworklet polyfill refuses to execute ES6 code.

Module background

Modules are like MIDI files but with custom sound samples instead of builtin synth files.

Modules produce sound by playing included samples at a specific rate: this simulates the concept of note. Even though included sounds are encoded at a specific rate, this information isn't saved into the module file.

Instead of playing at a specific rate, a period is used during which the same sample is played. This is directly reminiscent of the Amiga's hardware and more specfically the Paula sound chip which is responsible for playing sound in the Amiga.

To reproduce the original sound the mod creator has to play it at the note which would play it at the same rate as it was encoded.

Soundtracker modules have 4 voices which can be independently played with a specific period and volume.

In addition to the notion of period, there is a speed at which tracks are played which was again close to the Amiga's hardware because it was synced to the monitor's refresh rate: 50hz for PAL and 60hz for NTSC.

This formula gives the speed:

7093789.2 / ((period * 2) * mixingRate)

Module files today

Original Soundtracker mod files only supported 4 channels and 15 instruments. Sample length was limited to 9,999 bytes and sample resolution was only 8bit but it was quickly extended to support 31 instruments and no special limit on sample length.

With the advent of PC sound cards with better sound capabilites (Gravis Ultra Sound could mix as many as 32 channels in hardware in 1993), the mod format was extended with more channels, more effects, 16 bit samples...

New formats were also created: S3M, IT,...

Even though its use is very limited today thanks to virtually unlimited computing power and storage size, it's amazing what can be done with only module files.

That's why it's still in use today: mostly in the demo scene, and in some rare games.

Module format

The original Sountracker format is quite simple: it starts by listing the mod's title, padded to 20 ASCII characters: there isn't even a magic number.

Then samples information is stored:

Offset Information Size (bytes)
0 Sample name 22
22 Sample Length 2
24 Finetune 1
25 Volume 1
26 Repeat Start 2
28 Repeat End 2

Then comes the patterns data: first the list of positions and then each patterns information which is encoded: each note information takes 4 bytes. Since there are 64 rows and 4 channels, this means a pattern takes exactly 64 * 4 * 4 = 1024 bytes.

Last but not least, sample data is stored, uncompressed in LPCM 8bit format.

More information can be found in the original specs file (which was written in 1988: ouch!).

Module files copyright

No file is hosted in GitHub, all modules are downloaded from The Mod Archive and are licensed under the Mod Archive Distribution License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].