Code Monkey home page Code Monkey logo

realtimesingingsynthesizer's Introduction

Live Coding Singing Synthesizer

Real Time Singing Synthesizer project made from sinsy-NG. The idea was to generate vocal audio samples on real time easily for live coding performances.

Demo

Here is a video demonstration using the program to synthesize samples and load them into the FoxDot live coding environment.

IMAGE ALT TEXT HERE

Requirements

  • python (Should work on 3 and 2.7 versions)
  • musescore (It's used to convert midi to musicxml)

Installation

Software contained in synthesisSoftware must be installed.

  • libespeak-NG (Install this first)
  • Sinsy-NG (Install this second)

You can check the Colab notebook for a detailed guide about how to install it on Ubuntu.

Usage

Try it on Colab

If you want to check it quickly you can try it online here.

Open In Colab

Try it on Docker

Build it

  • docker build . -t voice-synth

Run it

  • docker run --rm --network="host" -p 8080:8080 -e PORT=8080 voice-synth

Once that's done you can try test-api.py script as a small singing synthesis example. After running this an output wav file will be generated containing the specified vocals.

python test-api.py 

All the parameters are optional, they contain a default value in case they are not specified. You can specify them in any order when running the program in the command line.

  • notes: The numerical value of notes in the scale, in C Major would be something like 0:C, 1:D, 2:E, 3:F and so on... The scale is C major by default, it's hardcoded in the main.py file and can be modified.

  • dur: The duration of each note in BPM (beats per minute)

  • lyrics: The text to be synthesized. Each word is mapped to one note from the "dur" and "notes" parameters

  • lang: The language code, "es" for spanish and "en" for english. There are several languages supported, You can check them here

  • tempo: The tempo in BPM

  • file: The name of the output file

Support my work

If you want to help me to keep going developing and maintaining open-source projects you can contribute buying me some ko-fi.

realtimesingingsynthesizer's People

Contributors

mathigatti 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

Watchers

 avatar  avatar  avatar

realtimesingingsynthesizer's Issues

Resulting output never matches the MIDI file perfectly

Hello,
Is there any "magic trick/formula" to guarantee that the lyrics will always match the midi file when you play them together? My resulting output sounds good to the ear and nothing seems out of place until I add the midi instrumentals in the background, the timing is off even if the output was generated using the same tempo or the two files have the same duration, even when after some tweaking the lyrics are pronounced with the correct timing, the duration of the entire file is off, so I have to manually cut and paste the lyrics from an audio editor and glue them in the correct place, which is quite a tedious work. It would be great if it was possible to play the resulting output and midi file together right out of the box, or understand the logic why this problem happens.
Thanks for the amazing repo, I'm really enjoying this.

Sinsy make error

Hello mathigatti, thank you alot for this. I am excited to get it to work but i am having an error when i try and make the Sinsy file on linux (Linux Mint 19.3). This is the last bit of the error message i get:

[100%] Linking CXX executable sinsyNG
CMakeFiles/sinsyNG.dir/bin/sinsy.o: In function ECantorix::init(double)': sinsy.cpp:(.text._ZN9ECantorix4initEd[_ZN9ECantorix4initEd]+0x8d): undefined reference to sinsy_ng_Init'
CMakeFiles/sinsyNG.dir/bin/sinsy.o: In function ECantorix::addNote(unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, bool, bool, unsigned long, unsigned long, unsigned long, bool)': sinsy.cpp:(.text._ZN9ECantorix7addNoteEmRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmbbmmmb[_ZN9ECantorix7addNoteEmRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmbbmmmb]+0xd0): undefined reference to sinsy_ng_addNote'
sinsy.cpp:(.text._ZN9ECantorix7addNoteEmRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmbbmmmb[_ZN9ECantorix7addNoteEmRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmbbmmmb]+0x12a): undefined reference to sinsy_ng_addNote' CMakeFiles/sinsyNG.dir/bin/sinsy.o: In function ECantorix::addRest(unsigned long)':
sinsy.cpp:(.text._ZN9ECantorix7addRestEm[_ZN9ECantorix7addRestEm]+0x4e): undefined reference to sinsy_ng_addRest' CMakeFiles/sinsyNG.dir/bin/sinsy.o: In function ECantorix::saveTo(std::__cxx11::basic_string<char, std::char_traits, std::allocator >)':
sinsy.cpp:(.text._ZN9ECantorix6saveToENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN9ECantorix6saveToENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x3a): undefined reference to `sinsy_ng_getAudioData'
collect2: error: ld returned 1 exit status
CMakeFiles/sinsyNG.dir/build.make:95: recipe for target 'sinsyNG' failed
make[2]: *** [sinsyNG] Error 1

Maybe you can help, thank u!

Editing main.py for accepting extra command-line options

Hello,
Sorry for being a total python noob, to my understanding, main.py creates 3 files on /tmp ("last_midi_generated_by_vrender.mid", "last_voice.musicxml" and "last_voice.xml") with my lyrics on repeat to the 4 notes that are hardcoded, then outputs a "output.wav" file, however, when trying to define a tempo and custom output name (as mentioned in the README.md file) doesn't seem to have any effect at all.
Can you show me how to have a fully working main.py please ? The idea is to use a command-line such as "python main.py singing_output.wav "some lyrics to sing" 100 song.mid".
Until now I managed to do it manually with "musescore ./tmp/song.mid -o ./tmp/last_voice.musicxml", run main.py but preventing musescore to be found so it won't not generate a "last_midi_generated_by_vrender.mid" on ./tmp but will generate a valid "last_voice.xml" from the "last_voice.musicxml" I created before, then load "sinsyNG -m en -o output.wav ./tmp/last_voice.xml", however, the output duration is much longer than the actual midi (ie. output.wav is 6 minutes vs song.mid is 3 minutes), I couldn't figure out how to manually change the tempo so the output.wav lyrics matches with the midi instruments.
Any help is much appreciated, thank you for your kind attention!

colab error

Colab Error

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
[<ipython-input-14-0a7be42dee8f>](https://localhost:8080/#) in <cell line: 3>()
      1 # Press the play button on this cell for loading the new result
      2 # Then the new audio file will be available to listen in the player
----> 3 ipd.Audio("/content/RealTimeSingingSynthesizer/output.wav")

[/usr/local/lib/python3.10/dist-packages/IPython/lib/display.py](https://localhost:8080/#) in __init__(self, data, filename, url, embed, rate, autoplay, normalize, element_id)
    114         if self.data is not None and not isinstance(self.data, bytes):
    115             if rate is None:
--> 116                 raise ValueError("rate must be specified when data is a numpy array or list of audio samples.")
    117             self.data = Audio._make_wav(data, rate, normalize)
    118 

ValueError: rate must be specified when data is a numpy array or list of audio samples.

secondly there is no output file.
image

MBROLA voices - no sound

Hi,

Is there a way to use MBROLA voices?
I have tried to test this in Colab (installed mbrola and the mbrola voices as well), but the result is empty (the length of the output looks fine, but there is just silence).

Another question:
Do you have plan to make the notes of the singing connected to the syllables instead of the words?

Thanks!

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.