Musical speaker [PLACEHOLDER]

by moogan

Adds a speaker to the game that includes 189 instruments for use in music production.

3 years ago
1.1
453
Owner:
moogan
Source:
https://github.com/Xcelled/musical-speaker
Homepage:
N/A
License:
GNU GPLv3
Created:
3 years ago
Latest Version:
1.0.1 (3 years ago)
Factorio version:
1.1
Downloaded by:
453 users

NOTE:

This is a mod portal placeholder. To use this mod, see the "Installation" section below. Do not install directly from the mod portal!

musical-speaker

A Factorio mod that provides an enhanced version of the programmable speaker, mostly intended for music production.

Sound data for this mod was generated by FluidSynth (GPL licensed) from the FluidR3_GM2 soundfont (MIT licensed). Much thanks goes to the developers of these projects.

Features:
- Includes 189 instruments.
- Provides all instruments specified by General Midi Level II.
- All melodic (non-percussion) instruments have a range of A0 to C8, AKA standard 88-key piano.
- All percussion instruments provide GM2 drum sounds.
- Sounds stop when the speaker is disabled via circuit network (Vanilla programmable speaker continues playing).
- Control volume via circuit network.

Installation

Right now, the number of sound files in the mod precludes uploading it directly to the mod portal. To install the mod, download the release zip file from GitHub and drop it into your mods directory.

Example usage

This video was made entirely in Factorio by utilizing musical-speaker. You can grab the save from here to try it yourself!

Caveats

  • For right now, enabled condition comparison is limited to > 0.
    • If you want a different condition, use a decider combinator to translate the condition.
  • Volume can be set by the circuit network only during the tick when a note starts playing.
    • This is for performance reasons, due to the expensive nature of querying the circuit network.
    • I might make this an option in the future.
  • For performance reasons, musical speaker sounds are not pre-loaded by the game.
    • This means that there will be a slight-but-noticeable delay the first time each note is played.
    • If you're in a situation where you need minimal delay (ie recording), play your composition once ahead of time to warm up the sounds.

Helpful Tips

  • To convert a midi note number to a melodic pitch, subtract 21.
  • To convert a midi note number to a percussion sound, subtract 35

Future Plans

  • Circuit-network signal to control instrument.
  • Make enabled condition fully controllable.
  • Support GM2_SM (?).
  • Split the sounds from the code
    • This is required to be able to upload the mod to the portal

Implementation

  • Musical-speaker is implemented in TypeScript and transpiled to lua by the amazing TypeScriptToLua. I doubt musical-speaker would have been finished without this project.