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

Python 2/3 music synthesizer scripts (old but still functional project)

NotificationsYou must be signed in to change notification settings

mdoege/PySynth

Repository files navigation

PySynth is no longer being actively developed by me and has therefore been removed from PyPI.

There is now a maintained fork of PySynth atg4brielvs/PySynth.


Overview

PySynth is a simple music synthesizer for Python 2 or 3. The goal is not to produce many different sounds, but to have scripts that can turn ABC notation or MIDI files into a WAV file without too much tinkering.

The current release of the synthesizer can only play one note at a time. (Although successive notes can overlap in PySynth B and S, but not A.) However, two output files can be mixed together to get stereo sound.

Synthesizer scripts

SynthSynthesis methodApproximate timbreNote decayNeeds NumPy?
Aadditive (3 sine waves)flute, organ, pianovariable (depends on note length)no
Badditive (5 sine waves)acoustic pianomediumyes
Csubtractive (sawtooth wave)bowed string, analog synth padnoneno
Dsubtractive (square wave)woodwind, analog synth leadnoneno
EFM/phase modulation (6 sine waves)DX7 Rhodes pianomediumyes
Psubtractive (white noise)untuned percussion hitvery fastno
SKarplus-Strong (physical modeling)plucked string, guitar, kotofastyes
beeperadditiveNokia phone ringtonenoneno
sampsamplerSalamander Grand Pianomediumyes

Installation

Linux

Clone the repository:

git clone git@github.com:mdoege/PySynth.git

or

git clone https://github.com/mdoege/PySynth.git

Enter the directory (cd PySynth) and run

python3 setup.py install

Sample usage

Basic usage:

importpysynthaspstest= (('c',4), ('e',4), ('g',4),('c5',-2), ('e6',8), ('d#6',2))ps.make_wav(test,fn="test.wav")

More advanced usage:

importpysynth_baspsb# a, b, e, and s variants available''' (note, duration)Note name (a to g), then optionally a '#' for sharp or'b' for flat, then optionally the octave (defaults to 4).An asterisk at the end means to play the note a littlelouder.  Duration: 4 is a quarter note, -4 is a dottedquarter note, etc.'''song= (  ('c',4), ('c*',4), ('eb',4),   ('g#',4),  ('g*',2), ('g5',4),  ('g5*',4), ('r',4), ('e5',16),  ('f5',16),  ('e5',16),  ('d5',16),  ('e5*',4) )# Beats per minute (bpm) is really quarters per minute herepsb.make_wav(song,fn="danube.wav",leg_stac=.7,bpm=180)

Read ABC file and output WAV:

python3 read_abc.py straw.abc

Documentation

More documentation and examples at thePySynth homepage.

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp