Coder Social home page Coder Social logo

fynv / scoredraft Goto Github PK

View Code? Open in Web Editor NEW
180.0 13.0 35.0 108.94 MB

ScoreDraft is a simple music/singing synthesizer that provides a Python based score authoring interface.

License: Other

C++ 23.95% Python 68.15% C 3.92% CMake 0.97% Cuda 2.77% LilyPond 0.24%
utau singing sythesizer psola audio

scoredraft's Introduction

-> 中文Readme

ScoreDraft

ScoreDraft is a music/singing synthesizer that provides a Python based score authoring interface.

Currently, it includes the following synthesizer engines:

  • Instrumental
    • SimpleInstruments: simple mathematic functions like sine-waves
    • KarplusStrong: guitar simulator using pure algorithm
    • BasicSamplers: tones generated by sampling one or multiple waveform samples
    • SoundFont2
  • Percussion
    • BasicSamplers
    • SoundFont2 (GM Drums)
  • Voice
    • VoiceSampler: a PSOLA-like algorithm is used to sample voice samples. A front-end "UtauDraft" is provided making it compatible to existing UTAU voice banks.

The framework is open and can be easily extended.

A PCM Player is provided to playback and visualize generated waveforms.

A more sophisticated visualizer "Meteor" is provided to visualize the notes/beats/syllables where the music is generated from.

The following example shows how easily a piece of musical sound can be generated using ScoreDraft.

    import ScoreDraft
    from ScoreDraft.Notes import *

    doc=ScoreDraft.Document()

    seq=[do(),do(),so(),so(),la(),la(),so(5,96)]

    doc.playNoteSeq(seq, ScoreDraft.Piano())
    doc.mixDown('twinkle.wav')

Starting from version 1.0.3, ScoreDraft now supports a YAML based input format, which looks like:

# test.yaml
score:
    staffs:
        -
            relative: c''
            instrument: Piano()
            content: |
                c4 c g g a a g2

where in the 'content' part, LilyPond syntax can be used to input notes. The following shell command can be used to generate a wav:

# scoredraft -wav twinkle.wav test.yaml

For GUI editor, see ScoreDraftEditor

For more detailed introduction and demos see: https://fynv.github.io/ScoreDraft/

Installation

ScoreDraft is now available from PyPi. Windows x64/Linux x64 supported.

# pip install scoredraft

Known issue: For Linux, it is only tested on Ubuntu 20.04. It is known to be not working on Ubuntu 18.04.

Building

Build-time dependencies:

  • CMake 3.0+

  • Python3

  • CUDA(optional): To build without CUDA, disable the CMake option "USE_CUDA"

  • FreeType:

    • Library included for Windows
    • Ubuntu: sudo apt install libfreetype-dev
  • GLFW:

    • Source code included
    • Ubuntu: sudo apt install libglfw3-dev libxinerama-dev libxcursor-dev libxi-dev
  • PortAudio:

    • Source code included
    • Ubuntu: sudo apt-get install libasound-dev libjack-dev

Build process:

# mkdir build
# cd build
# cmake .. -DCMAKE_INSTALL_PREFIX=../Test
# make
# make install

Run-time dependencies:

  • Python3
  • cffi
  • X-org, ALSA drivers are optionally needed for players
  • xsdata, python_ly are optionally needed for MusicXML and LilyPond support
  • pyyaml is optionally needed for YAML support

Samples & Voice Banks

To avoid causing troubles, ScoreDraft now only includes a minimal set of instrumental/percussion samples to support the tests. The PyPi package doesn't include any of these.

ScoreDraft indexes the samples and banks by searching specific directory where the python script is started.

  • Directory InstrumentSamples: wav instrument samples

    • There can be sub-directories containing multiple wav samples defining a single instrument for different pitch ranges.
    • Optionally, a freq file can be provided to define the frequency of the sample tone.
  • Directory PercussionSamples: wav percussion samples

  • Directory SF2: SoundFont2 bank files

  • Directory UTAUVoice: UTAU voice banks (as sub-directories)

Users need to help themselves to download and organize extra samples and voicebanks. Here are just some recommandations, which is what I do at my place.

License

ScoreDraft is now formally available under MIT license.

Version History

ScoreDraft was my first Python project. There were some severe limitations for pythonic packaging and releasing. As a result, there was no formal release before the Nov 2021 refactoring (version 1.0.0).

SingingGadgets was a refactoring attempt in 2018, which only partially solves the issues.

After the Nov 2021 refactoring, ScoreDraft have all the benefits of both SingingGadgets and the old ScoreDraft. Therefore, the SingingGadgets project is now closed.

  • Dec 17, 2021. ScoreDraft 1.0.11, fix slur handling
  • Dec 12, 2021. ScoreDraft 1.0.10, support track volume for YAML input
  • Dec 12, 2021. ScoreDraft 1.0.8 & 1.0.9, bug fix
  • Dec 04, 2021. ScoreDraft 1.0.7, percussion visualization bug fix
  • Dec 01, 2021. ScoreDraft 1.0.6, expose more low-level functions
  • Nov 29, 2021. ScoreDraft 1.0.4, 1.0.5, YAML function updates
  • Nov 27, 2021. ScoreDraft 1.0.3, adding a YAML based input routine support
  • Nov 24, 2021. ScoreDraft 1.0.2, adding MusicXML & LilyPond support
  • Nov 19, 2021. ScoreDraft 1.0.0 & 1.0.1
  • Jun 16, 2018. SingingGadgets 0.0.3

scoredraft's People

Contributors

fynv avatar leo3738 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scoredraft's Issues

无法自动对齐起始音

代码:

#! /usr/bin/python3

import ScoreDraft
from ScoreDraftRapChinese import CRap as r
from ScoreDraftNotes import *

doc=ScoreDraft.Document()
singer=ScoreDraft.GePing_UTAU()

seq_rap_1=[r('zhe',4,12),r('zhi',3,12),r('shi',4,12),r('yi',2,12),r('ge',4,12),r('an',1,12),r('jing',4,8),r('de',0,8),r('shi',2,8),r('zi',4,12),r('lu',4,12),r('kou',3,24)]

tempo_map_1=[(0,1135139.0),(ScoreDraft.TellDuration(seq_rap_1),1100242.0)]

doc.sing(seq_rap_1,singer)
doc.mixDown('hujiutest.wav')

生成的音频的起始点不会自动对齐到 1135139.0 采样。

编译版本:根目录下 /python_test 预编译版
系统:Windows 7 x64

Crashes on macOS

When running the program, the wav file is successfully mixed down and sounds correctly, but then python crashes.

Here is my program:
Hello.py (located in the same directory as ScoreDraft.py):

import sys

import ScoreDraft
from ScoreDraftNotes import *

doc=ScoreDraft.Document()

seq=[do(),do(),so(),so(),la(),la(),so(5,96)]

doc.playNoteSeq(seq, ScoreDraft.Triangle())
doc.mixDown('Hello.wav')

Here is the shell output:

$ /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 Hello.py 
Loading extension: libPercussionSampler.so
Loading extension: libUtauDraft.so
Loading extension: libInstrumentSampler.so
Loading extension: libMIDIWriter.so
Loading extension: libKeLa.so
Illegal instruction: 4

Attached is the error report: ErrorReport_ScoreDraft.txt

How about half keys?

I am wondering if there's any way to do half keys(black keys on the keyboard) in scoredraft. Based on my reading of the documentation, I can not yet find a way to do it.

Cannot compile on macOS

I tried to use CMake GUI (3.11.0) to configure the project, but it shows error CUDA_SDK_ROOT_DIR-NOTFOUND. CUDA Toolkit 9.1 is already installed.

CMake errors

Model: MacBook Pro (Retina, 15-inch, Mid 2015)
Processor: Intel Core i7-4870HQ @ 2.50GHz
Graphics: AMD Radeon R9 M370X 2048 MB / Intel Iris Pro 1536 MB
Memory: 16 GB 1600 MHz DDR3
OS: macOS 10.13.4 (17E199)

Status of this project

Is this project still in development? Because right now the utaudraft still sounds a bit unnatural (compared to other resamplers). This is a really nice project, it will be so unfortunate if this project is discontinued

No sound when using external instruments

OS: win64
python: 3.6

Hello.py works fine, but other test files(ex.piano_test.py) using external instruments will not work(no sound).

Is it because I need to install more software? (I only downloaded the python_test folder)

ps. before this I changed two places in the init.py of ScoreDraft for it causes compile errors and may be a logic error

First one:

ScoreDraftPath_old= os.path.dirname(__file__)
ScoreDraftPath=""
#\\escaping fix
for ch in ScoreDraftPath_old:
        if ch=="\\":
                ScoreDraftPath+="/"
        else:
                ScoreDraftPath+=ch

Second one:

try:
	from .InstrumentSampler import InstrumentSampler_Single
	from .InstrumentSampler import InstrumentSampler_Multi

	INSTR_SAMPLE_ROOT=ScoreDraftPath+'/InstrumentSamples'
	if os.path.isdir(INSTR_SAMPLE_ROOT):
		for item in os.listdir(INSTR_SAMPLE_ROOT):
			inst_path = INSTR_SAMPLE_ROOT+'/'+item
			if os.path.isfile(inst_path) and item.endswith(".wav"):
				name = item[0:len(item)-4]
				definition="""
def """+name+"""():
	return InstrumentSampler_Single('"""+inst_path+"""')
"""
				exec(definition)
				Catalog['Instruments'] += [name+' - InstrumentSampler_Single']
			elif os.path.isdir(inst_path):
				definition="""
def """+item+"""():
	return InstrumentSampler_Multi('"""+inst_path+"""')
"""
				name=item #name fix (added)
				exec(definition)
				Catalog['Instruments'] += [name+' - InstrumentSampler_Multi']
except ImportError:
	pass

运行python_test下的任何Python脚本,提示分段错误

平台:MacOS v10.14.6
过程:

  1. 关闭CUDA支持
  2. 删除QT依赖模块
  3. CMakeLists.txt指定build路径,指定python_test路径
  4. cmake ./
  5. make
  6. make install
  7. 运行脚本报错
/usr/local/bin/python3.7 /Users/cheese/Src/PythonSrc/ScoreDraft/python_test/piano_test.py

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

Missing lyric error encountered when running singing synthesis example

I try to run this example on the documentation:

doc = ScoreDraft.Document()
seq = [ ("mA", mi(5,24), "mA", re(5,24), mi(5,48)), BL(24)]
seq +=[ ("du",mi(5,24),"ju", so(5,24), "rIm", la(5,24), "Em", mi(5,12),re(5,12), "b3", re(5,72)), BL(24)]
doc.sing(seq, ScoreDraft.TetoEng_UTAU())

I got this error:

TypeError: 'NoneType' object is not subscriptable
missed lyic: rIm

I have downloaded and installed TetoEng voicebank from the English Voicebank (CVVC) Voicebank tab in https://kasaneteto.jp/en-voicebank.html. I cannot find the token rIm in oto.ini manually either. There are similar issues with the token Em, s@n in the example, but other tokens like du, ju are fine.

Are there extra voicebanks I need to install to resolve this? Thanks!

AttributeError: module 'ScoreDraft' has no attribute 'jklex_UTAU'

When I run the script KeLaTest.py, error is happen as list bellow. It seems ScoreDraft has no attribute 'jklex_UTAU'. (My os is win64)

Traceback (most recent call last):
File "KeLaTest.py", line 13, in
doc.sing(seq, ScoreDraft.jklex_UTAU())
AttributeError: module 'ScoreDraft' has no attribute 'jklex_UTAU'

Fail to build on Android 无法在 Android 上编译(aarch64)

编译平台:Android aarch64(使用 Termux)

版本:

  • ScoreDraft 源码:最新 master
  • cmake:3.11.1
  • make:4.2.1
  • clang:6.0.0
  • python:3.6.5

错误回显:

[ 26%] Built target ScoreDraftCore
[ 34%] Built target WavUtil
[ 36%] Building CXX object PyScoreDraft/CMakeFiles/PyScoreDraft.dir/PyScoreDraft.cpp.o
In file included from /data/data/com.termux/files/home/ScoreDraft/PyScoreDraft/PyScoreDraft.cpp:1:
/data/data/com.termux/files/usr/include/python3.6m/Python.h:39:10: fatal error:
      'crypt.h' file not found
#include <crypt.h>
         ^~~~~~~~~
1 error generated.
make[2]: *** [PyScoreDraft/CMakeFiles/PyScoreDraft.dir/build.make:63: PyScoreDraft/CMakeFiles/PyScoreDraft.dir/PyScoreDraft.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:197: PyScoreDraft/CMakeFiles/PyScoreDraft.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Some questions about ScoreDraft

It's nice job about singing synthesizer. There are some questions about ScoreDraft:
(1) which pitch shifting method using in ScoreDraft?
(2) which time shifting method using in ScoreDraft?
(3) It seems there are some noise in singing voice synthesizer case, so how to reduce noise or solve it?
(4) from the source code, ScoreDraft is concatenated based method, do ScoreDraft have plan use HMM or DNN based method?
(5) What about the future plan of next version?

ScoreDraft 模块无法导入

运行任意一个 python_test 目录下的示例,得出如下 Traceback:

Traceback (most recent call last):
  File "C:\Users\zeroa\repos\ScoreDraft-master\python_test\Hello.py", line 3, in <module>
    import ScoreDraft
  File "C:\Users\zeroa\repos\ScoreDraft-master\python_test\ScoreDraft\__init__.py", line 2, in <module>
    from . import PyScoreDraft
ImportError: DLL load failed: 找不到指定的模块。

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.