Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Sep 10, 2022. It is now read-only.
/sonic-midiPublic archive

Plays melodies in SonicPi while converting them to MIDI

License

NotificationsYou must be signed in to change notification settings

google/sonic-midi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

This tool allows to programmatically define melodies that can be played in Sonic Pi via an externalcommand-line interface (CLI) while automatically exporting them to MIDI files to be consumedelsewhere (such as in LMMS).

Note: this is not an official Google product.

Installation

gem install sonic-midi

Usage

sonic-midi sonic melody.rbsonic-midi midi melody.rbsonic-midi all melody.rb

Defining a melody

The melodies are defined by the means of simple Ruby programs (see the examples directory forsome examples).At the very least, a melody file needs to contain a function that specifies a single melody.For example:def melody  return [[60], [0.25]]endThis will result in the 4th octave C note to be played for a quarter duration.In general, the simple melody is defined as an array containing two or three subarrays:  - List of MIDI pitches  - List of durations (as fractions of the measure)  - Optional: List of volumes (in the 0..5 range, to match SonicPi)Note that pitch of 0 is reserved for silenceIn order to allow playing multiple notes at the same time, the melody function can return adictionary of sub-melodies instead of a single melody.For example:def melody()  return { m1: m1(), m2: m2(), m3: m3() }end(We're assuming m1(), m2() and m3() are defined as individual melodies)In addition to the actual melody, the melody file can specify BPM (via def mybmp()) and a synth touse in SonicPi (via def mysynth()). Note that mysynth() is ignored when generating the Midi file.

Importing Midi to LMMS

Once you've generated a melody and prototyped it in SonicPi, you can use the exported Midi filein LMMS. For this, simply do Project | Import in LMMS and select the resulting Midi file. Note thatby default, LMMS will create a SoundFont track, but you can override it with any instrument.Tip: the Midi files can be used to generate a percussion track (the pitches will get ignored).

About

Plays melodies in SonicPi while converting them to MIDI

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp