Code Monkey home page Code Monkey logo

nixpkg-timidity's Introduction

Nix package for TiMidity++

This repository contains a Nix package for TiMidity++.

TiMidity++ is a software synthesizer. It can play MIDI files by converting them into PCM waveform data; give it a MIDI data along with digital instrument data files, then it synthesizes them in real-time, and plays. It can not only play sounds, but also can save the generated waveforms into hard disks as various audio file formats.

TiMidity++ is a free software, distributed under the terms of GNU general public license.

There is already a Nix package for TiMidity++ in nixpkgs, but it does not support some features, and in particular the generation of OGG files, which is of interest to me personally.

Building & Running

The Nix Flake provides multiple targets to build timidity:

  • timidityFromNixpkgs provides TiMidity++ as-is from nixpkgs. This is also the default target.

  • timidityFromNixpkgs' does just the same, except the call to callPackage is inlined in the flake.

  • timidityWithVorbis also goes through callPackage but with an additional enableVorbis = true argument. It provide a variant of TiMidity++ compiled with support for OGG Vorbis.

Building is trivial with Nix. The timidity binary ends up in the directory result/bin.

$ nix build .#<target>
$ result/bin/timidity --version
TiMidity++ version 2.15.0
[...]

Alternatively, one can run timidity directly with:

$ nix run .#<target> -- --version
TiMidity++ version 2.15.0
[...]

A last option is to run the flake immediately from the GitHub repository, with:

$ nix run github:niols/nixpkg-timidity#<target> -- --version
TiMidity++ version 2.15.0
[...]

Testing

Once built, you can try to compile a test MIDI file to WAV and see if things work correctly.

$ nix run .#timidityFromNixpkgs -- -Ow test/the-ashgrove.midi
Playing test/the-ashgrove.midi
MIDI file: test/the-ashgrove.midi
Format: 1  Tracks: 3  Divisions: 384
Sequence:
Text: creator:
Text: GNU LilyPond 2.22.2
Track name: \new:
Output test/the-ashgrove.wav
Playing time: ~37 seconds
Notes cut: 0
Notes lost totally: 0

You can then try again, but to compile to OGG this time. At this point, it should fail.

$ nix run .#timidityFromNixpkgs -- -Ov test/the-ashgrove.midi
Playmode `v' is not compiled in.
Try timidity -h for help

But if you try with the version supposed to support OGG Vorbis:

$ nix run .#timidityWithVorbis -- -Ov test/the-ashgrove.midi
Playing test/the-ashgrove.midi
MIDI file: test/the-ashgrove.midi
Format: 1  Tracks: 3  Divisions: 384
Sequence:
Text: creator:
Text: GNU LilyPond 2.22.2
Track name: \new:
Output test/the-ashgrove.ogg
Playing time: ~37 seconds
Notes cut: 0
Notes lost totally: 0

Fun fact: The difference also shows up in the help where an additional line specifies that Ogg Vorbis is an available output mode. For instance:

$ diff <(nix run .#timidityFromNixpkgs -- --help) <(nix run .#timidityWithVorbis -- --help)
243a244
>   -Ov          Ogg Vorbis

nixpkg-timidity's People

Contributors

niols avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.