Skip to main content

munotes

musical-notes

PyPI version PyPI - Python Version


This library is for handling notes and chords in Python.

General Usage

Note

Note class. Handling note.

This class is used by inputting the note name and octave height, or MIDI note number at initialization.

import munotes as mn

note = mn.Note("A4")
print(note) # A4

note = mn.Note(69)
print(note) # A4
  • transpose()

Transpose the note.

note.transpose(2)
print(note) # B4
  • render()

Get the waveform of the note.

import matplotlib.pyplot as plt
y = note.render('sin')
plt.plot(y[:200])

image

squere and sawtooth are also sapported.

y = note.render('squere')
plt.plot(y[:200])

image

y = note.render('sawtooth')
plt.plot(y[:200])

image

Arbitrary waveforms are also supported.

y = note.render(lambda t: np.sin(t) + np.sin(2*t))
plt.plot(y[:200])

image

  • play()

Get IPython.display.Audio object.

image

Notes

Notes class. Handling multiple notes.

This class is used by inputting the notes at initialization.

notes = mn.Notes("C4", "E4", "G4")
print(notes) # C4 E4 G4

Methods are the same as Note. Ex: transpose(), render(), play().

Chord

Chord class. Handling chord.

This class generates a Notes object by inputting a chord name at initialization.

from munotes import Chord
chord = Chord("A#m7")
print(chord) # A#m7
print(chord.names) # ['A#', 'C#', 'F', 'G#']

Methods are the same as Note (and Notes).
Transpose is also supported by transpose()

chord.transpose(3)
print(chord) # C#m7
print(chord.names) # ['C#', 'E', 'G#', 'B']

Track

Track class. Handling multiple Notes as a sequence.

This class is used by inputting the notes with durations at initialization.

track = mn.Track([
    mn.Note("C4", duration=1),
    mn.Note("E4", duration=1),
    mn.Note("G4", duration=1)
])

Methods are the same as other classes.
But in methods that handling waveform (render(), play(), etc), generate the waveform as sequence of notes (like: C -> E -> G).

Stream

Stream class. Handling multiple tracks.

This class is used by inputting the tracks at initialization.

track = mn.Track([
    mn.Note("C4", duration=1),
    mn.Note("E4", duration=1),
    mn.Note("G4", duration=1)
])

chords = mn.Track([
    mn.Chord("C", duration=3),
])

stream = mn.Stream([melody, chords])

Methods are the same as other classes.

Version History

0.1.0 (2022-11-12, Beta-release)

  • Add Note class
  • Add Chord class

1.0.0 (2023-02-09)

  • Add Notes class
  • Add Track class
  • Add Stream class
  • Add Rest class
  • Add sin(), square(), sawtooth() methods
  • Add play() method
  • Add render() method

1.0.1 (2023-02-12)

  • Fix a bug that Rest could not be put into Track.

1.1.0 (2023-02-16)

  • Waveform parameters can be specified. Ex: note.sawtooth(width=0.5)
  • Support for inputting octave with note names. Ex: note = mn.Note("A4")
  • All supported chords can be seen in mn.chord_names
  • Arbitrary chords can be added

2.0.0 (2023-11-19)

  • Add Envelope class
  • Modify sec argument to duration
  • Add default parameters for rendering that can be specified in initialization
    • waveform
    • duration
    • unit
    • bpm
    • envelope
    • duty
    • width
    • amp
  • Remove function that change frequency of A4 directly
  • Modify input type of Track from Tuple[Note, float] to List[Note]
    • Note.duration is used to duration when rendering
  • Remove **kwargs in render() method

2.0.1 (2023-11-20)

  • Fix __add__ method of Notes class
  • Fix a bug that append() method of Notes class does not work
  • Modify __repr__ method

2.0.2 (2024-05-21)

  • Fix a bug that chord names in Track and Stream are not update when transposed

2.0.3 (2026-07-05, Latest)

  • Fix __all__ exports
  • Update GitHub Pages URL

Metadata

Release files for munotes 2.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for munotes 2.0.3
File Size Uploaded
munotes-2.0.3.tar.gz 14.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for munotes 2.0.3
File Interpreter ABI Platform
munotes-2.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 30.7 kB

Release files / munotes-2.0.3.tar.gz

Download URL munotes-2.0.3.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4791fb9392b899df868096a7ddffccfbd924eef04106d0bd7a96d9ea4146e980
BLAKE2b-256 checksum
How to use checksums
45d519b1aad3d72f70972482d02c6a04653f2aee543f1ffd2761d8d1397c4ef5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / munotes-2.0.3-py3-none-any.whl

Download URL munotes-2.0.3-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8efefb54b76ebdf09ff3cd2e57215aa93e21b8008e4eb60724ec9ac72c53ecbb
BLAKE2b-256 checksum
How to use checksums
b8994fc8fecfa6c71185f973d437579171712b8ed09b8fb96791f7ce617ba8fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release history Release notifications | RSS feed

This release

2.0.3 This release

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

1 release file

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page