Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synthetized song sounds off key when using the FluidR3Mono_GM soundfont #55

Open
martinResearch opened this issue Nov 11, 2024 · 1 comment

Comments

@martinResearch
Copy link

Describe the bug

The rendered notes sound off key when using the FluidR3Mono_GM soundfont.

To Reproduce

pip install symusic==0.5.4 and then

launch the script

import requests
from symusic import Score, Synthesizer, dump_wav
from pathlib import Path

def download_file(url, filename):
    response = requests.get(url)
    with open(filename, "wb") as f:
            f.write(response.content)
def main():
    midi_file = Path(__file__).parent / "1080-c01.mid"
    sf_path = Path(__file__).parent / "FluidR3Mono_GM.sf3"

    url = "http://www.jsbach.net/midi/1080-c01.mid"
    download_file(url, midi_file)

    # https://github.com/musescore/MuseScore/blob/master/share/sound/FluidR3Mono_GM.sf3
    url = "https://github.com/musescore/MuseScore/raw/2.1/share/sound/FluidR3Mono_GM.sf3"
    
    download_file(url, sf_path)

    score = Score(midi_file)

    synth = Synthesizer(
            sf_path = sf_path,
            sample_rate = 44100, 
        )
    audio = synth.render(score, stereo=True)  
    ouput_file = Path(__file__).parent / "out.wav"
    dump_wav(str(ouput_file), audio, sample_rate=44100, use_int16=True)

if __name__ == "__main__":
    main()

Expected behavior

The songs sounds off key.
https://github.com/user-attachments/assets/90fa0642-8e53-471d-9565-af798c71e8f1

Using the default soundfont it sounds better in therm of key, although it seems there is a bit temporal misalignment between the tracks w.r.t the original and it sound a bit messy (not sure I am not a musicians!).
https://github.com/user-attachments/assets/142082ec-42a0-4973-8f9d-6faf6e09dc4f

Desktop (please complete the following information):

  • OS: Windows
@lzqlzzq
Copy link
Collaborator

lzqlzzq commented Nov 13, 2024

Synthesize functionality is still experimental and we obeserved more bugs paticularly in windows...... You may use fluidsynth for more stable synthesis.
We will have a major refactory for prestosynth maybe in next year and I please gather the problems with one issue: lzqlzzq/prestosynth#1

@lzqlzzq lzqlzzq pinned this issue Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants