Giter VIP home page Giter VIP logo

sf2_loader's Issues

Export Piece fails: "AttributeError: module 'fluidsynth' has no attribute 'Synth'"

Hello again 👋 ,

I was trying to export a piece with the following code:

import sf2_loader as sf
import pathlib

scriptDirectory = pathlib.Path(__file__).parent.resolve()
filePath = scriptDirectory / 'Cello2.sf2'

guitar = (sf.mp.C('CM7', 4, 1/4, 1/8) ^ 2 | sf.mp.C('G7sus', 3, 1/4, 1/8) ^ 2
          | sf.mp.C('A7sus', 3, 1/4, 1/8) ^ 2 | sf.mp.C('Em7', 3, 1/4, 1/8) ^ 2 |
          sf.mp.C('FM7', 3, 1/4, 1/8) ^ 2 | sf.mp.C('CM7', 4, 1/4, 1/8)@1 |
          sf.mp.C('AbM7', 3, 1/4, 1/8) ^ 2 | sf.mp.C('G7sus', 3, 1/4, 1/8) ^ 2)

guitar.tempo = 60

sf2.export_piece(guitar, name="piece_example.wav")

Before I got to the error that I wrote on the title, I had to change line 550 in read_sf2.py and declare the tempo property of my guitar object.

from

current_chord.normalize_tempo()

to

current_chord.normalize_tempo(bpm)

Otherwise, these errors would be thrown:

  File "C:\Users\GilDurao\AppData\Local\Programs\Python\Python39\lib\site-packages\sf2_loader\read_sf2\read_sf2.py", line 549, in export_piece
    bpm = current_chord.tempo
AttributeError: 'chord' object has no attribute 'tempo'
  File "C:\Users\GilDurao\AppData\Local\Programs\Python\Python39\lib\site-packages\sf2_loader\read_sf2\read_sf2.py", line 550, in export_piece
    current_chord.normalize_tempo()
TypeError: normalize_tempo() missing 1 required positional argument: 'bpm'

After fixing those, and running my script, I get this:

  File "C:\Users\GilDurao\AppData\Local\Programs\Python\Python39\lib\site-packages\sf2_loader\read_sf2\read_sf2.py", line 181, in __init__
    self.synth = fluidsynth.Synth()
AttributeError: module 'fluidsynth' has no attribute 'Synth'

Python version: 3.9.5
fluidsynth version: 0.2

Was hoping you could guide me to what's missing here

sf2.export_midi_file fails

Hello 👋 ,

Today I tried to export a piece to a midi file, but I am facing the following errors from musicpy and midifiles.

Traceback (most recent call last):
  File "C:\Users\GilDurao\AppData\Local\Programs\Python\Python39\lib\site-packages\musicpy\musicpy.py", line 317, in read
    current_midi = midi(name)
  File "C:\Users\GilDurao\AppData\Local\Programs\Python\Python39\lib\site-packages\mido\midifiles\midifiles.py", line 323, in __init__
    with io.open(filename, 'rb') as file:
TypeError: expected str, bytes or os.PathLike object, not piece

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\GilDurao\Documents\GitHub\flutterpy-lmusic\flutterpy_lmusic\lib\yourscript.py", line 176, in <module>
    generate_music(lSystem, iterations, musicalParsing, scale, musicKey, bpm,
  File "C:\Users\GilDurao\Documents\GitHub\flutterpy-lmusic\flutterpy_lmusic\lib\yourscript.py", line 145, in generate_music
    sf2.export_midi_file(
  File "C:\Users\GilDurao\AppData\Local\Programs\Python\Python39\lib\site-packages\sf2_loader\read_sf2\read_sf2.py", line 739, in export_midi_file
    current_chord = mp.read(current_chord,
  File "C:\Users\GilDurao\AppData\Local\Programs\Python\Python39\lib\site-packages\musicpy\musicpy.py", line 319, in read
    current_midi = midi(file=riff_to_midi(name))
  File "C:\Users\GilDurao\AppData\Local\Programs\Python\Python39\lib\site-packages\musicpy\musicpy.py", line 3598, in riff_to_midi
    root = chunk.Chunk(riff_name, bigendian=False)
  File "C:\Users\GilDurao\AppData\Local\Programs\Python\Python39\lib\chunk.py", line 61, in __init__
    self.chunkname = file.read(4)
AttributeError: 'piece' object has no attribute 'read'

Here is the python code with the export midi call

sf2.export_midi_file(
        piece, name=rf"{defaultPath}\generated_music.mid")

The variable piece is correct because I can generate .wav files correctly.

Output of pip list:

PS C:\Users\GilDurao\Documents\GitHub\flutterpy-lmusic\flutterpy_lmusic> pip list
Package     Version
----------- -------
autopep8    1.5.7
keyboard    0.13.5
MIDIUtil    1.2.1
mido        1.2.10
mpu         0.23.1
musicpy     4.24
numpy       1.21.2
Pillow      8.3.2
pip         21.2.3
py          1.10.0
pycodestyle 2.7.0
pydub       0.25.1
pygame      2.0.1
pyglet      1.5.11
setuptools  57.4.0
sf2-loader  0.59
simpleaudio 1.0.4
toml        0.10.2

Output of python --version

PS C:\Users\GilDurao\Documents\GitHub\flutterpy-lmusic\flutterpy_lmusic> python --version
Python 3.9.7

Is there a way to suppress fluidsynth error messages?

For some reason, get_all_instrument_names() only gives me a fraction of the instruments contained in a soundfont, so I'm doing a cheap version of it myself:

def get_sf2_instruments(path):
	sf2_file = sf2.sf2_loader(path)

	instruments = {}
	for b in range(128):
		instruments[b] = {}
		for i in range(128):
			inst_name = sf2_file.get_instrument_name(bank_num=b, preset_num=i)
			if not inst_name:
				continue

			instruments[b][i] = inst_name

			print(f"{b:>3} - {i:>3}: {inst_name}")

	return instruments

The problem is that for every non-existent bank/preset combination, I get a message like

fluidsynth: error: There is no preset with bank number 1 and preset number 2 in SoundFont 1

printed to my console, which is less than desirable. Can I turn these off somewhere?

Note playing ends almost instantly

Hello,

I tried using your library today (huge thanks btw for providing a clean way to just play sounds off .sf2 files) and when playing a note, it almost ends instantly (less than a second). Setting a duration for the note also does not fix this. Same thing happens when playing a chord. I wonder if this is because of the .sf2 file itself or because I'm running in on Ubuntu.

Python version is 3.9.5

Here's the code I used:

import sf2_loader as sf

sf2 = loader = sf.sf2_loader(r'pathToSf2File/piano.sf2')

sf2.play_note('C5', duration=10)

when running I do get a FluidSynth warning, don't know if it's related:

fluidsynth: warning: SDL2 not initialized, SDL2 audio driver won't be usable

Let me know if you need more info. Thanks again.

Using export_note with mono output

I have used the library to output midi notes for some soundfonts and I only need to have mono output. Unfortunately, apparently the library does not account for the combination of the channel samples during the generation of the audio file.

I have added a quick fix and it seems to work fine in my case (simple mono wave output). The quick fix is inserted in export_note() after finishing the preparation of self.audio_array:

    if channels == 1:
        self.audio_array = self.audio_array.reshape(-1, 2).mean(axis=1).astype(int)

Installation on Linux fails when processing MIDIUtil package

Hello 👋 ,

Per your documentation in the README, I downloaded the Linux compatible dist of sf2_loader, but when running the script, this error pops up:

Installed /usr/local/lib/python3.8/dist-packages/mido-1.2.10-py3.8.egg
Searching for midiutil
Reading https://pypi.org/simple/midiutil/
Downloading https://files.pythonhosted.org/packages/f5/44/fde6772d8bfaea64fcf5eb948124d0a5fdf5f848b14ac22a23ced53e562d/MIDIUtil-1.2.1.tar.gz#sha256=79fa983bd1efc60785f68a8fe78fa8f45b8d7ec5898bf7cb7f3f7f3336d6a90a
Best match: MIDIUtil 1.2.1
Processing MIDIUtil-1.2.1.tar.gz
Writing /tmp/easy_install-5xx501gk/MIDIUtil-1.2.1/setup.cfg
Running MIDIUtil-1.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-5xx501gk/MIDIUtil-1.2.1/egg-dist-tmp-f8y0q5s4
warning: no previously-included files matching '*' found under directory 'build'
warning: no previously-included files matching '*' found under directory 'dist'
warning: no previously-included files matching '*.pyc' found under directory '.'
warning: no previously-included files matching '__pycache__' found under directory '.'
zip_safe flag not set; analyzing archive contents...
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
    yield saved
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-5xx501gk/MIDIUtil-1.2.1/setup.py", line 7, in <module>
    license='GPLv3',
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 220, in run
    os.path.join(archive_root, 'EGG-INFO'), self.zip_safe()
  File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 273, in zip_safe
    return analyze_egg(self.bdist_dir, self.stubs)
  File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 383, in analyze_egg
    safe = scan_module(egg_dir, base, name, stubs) and safe
  File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 422, in scan_module
    code = marshal.load(f)
ValueError: bad marshal data (unknown type code)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    setup(name='sf2_loader',
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 117, in do_egg_install
    cmd.run(show_deprecation=False)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 450, in run
    self.easy_install(spec, not self.no_deps)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 693, in easy_install
    return self.install_item(None, spec, tmpdir, deps, True)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 740, in install_item
    self.process_distribution(spec, dist, deps)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 784, in process_distribution
    distros = WorkingSet([]).resolve(
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 781, in resolve
    dist = best[req.key] = env.best_match(
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1066, in best_match
    return self.obtain(req, installer)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1078, in obtain
    return installer(requirement)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 712, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 738, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 923, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1191, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1177, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 253, in run_setup
    raise
  File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 166, in save_modules
    saved_exc.resume()
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 141, in resume
    six.reraise(type, exc, self._tb)
  File "/usr/lib/python3/dist-packages/setuptools/_vendor/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
    yield saved
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-5xx501gk/MIDIUtil-1.2.1/setup.py", line 7, in <module>
    license='GPLv3',
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 220, in run
    os.path.join(archive_root, 'EGG-INFO'), self.zip_safe()
  File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 273, in zip_safe
    return analyze_egg(self.bdist_dir, self.stubs)
  File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 383, in analyze_egg
    safe = scan_module(egg_dir, base, name, stubs) and safe
  File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 422, in scan_module
    code = marshal.load(f)
ValueError: bad marshal data (unknown type code)

Up until this point installation was going fine without errors

Playing notes in rapid succession seems to break the sound.

I used a midi keyboard to generate multiple notes at the same time but two or more notes seem to break the audio. I tried also running each note in a new thread and it seems to break as well. Then I tried to generate single note cords and run multiple in succession as play chords. It still breaks.

FX not rendered

Hello,

I am using sf2_loader to render .mid files to audio but it is not rendering with any effects:

=> python3
Python 3.9.18 (main, Aug 24 2023, 21:32:41) 
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sf2_loader as sf
>>> loader = sf.sf2_loader("/Users/admin/Desktop/gm.sf2")
>>> loader.export_midi_file("/Users/admin/Desktop/reverb.mid", name="reverb.wav", format="wav")

When I play back the exported "reverb.wav" file, there are no reverb or other effects on the audio. However, if I use VLC media player with the same "gm.sf2" as the audio output codec and playback "reverb.mid" (or use VLC's "Convert & Stream" function to save "reverb.mid" to "reverb.wav"), the file does have reverb indicating that the "reverb.mid" file is using MIDI CC 91 to send the track to reverb (which I have confirmed in my DAW) and also that the "gm.sf2" SoundFont file I am using can produce a reverb effect. Is there some additional parameter that I need to pass to the sf2_loader object so that it correctly renders effects? Or is this a bug or missing feature? Thanks

Can't load module

Traceback (most recent call last): File "main.py", line 3, in <module> import sf2_loader File "C:\Panda3D-1.10.11-x64\python\lib\site-packages\sf2_loader-0.94-py3.7.egg\sf2_loader\__init__.py", line 4, in <module> from .read_sf2_32bit.read_sf2 import * File "C:\Panda3D-1.10.11-x64\python\lib\site-packages\sf2_loader-0.94-py3.7.egg\sf2_loader\read_sf2_32bit\read_sf2.py", line 10, in <module> from . import fluidsynth File "C:\Panda3D-1.10.11-x64\python\lib\site-packages\sf2_loader-0.94-py3.7.egg\sf2_loader\read_sf2_32bit\fluidsynth.py", line 48, in <module> _fl = CDLL(lib) File "C:\Panda3D-1.10.11-x64\python\lib\ctypes\__init__.py", line 364, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 is not a valid Win32 application

this is my code:

`import pygame
import os
#import sf2_loader
from bgm import bgm
from lasso import lasso
from random import choice

soundfonts = lasso.load('sf2/','.sf2') # SF2
midifiles = lasso.load('midi/','.mid') # MIDI
soundtrack = lasso.load('bgm/','.ogg') # OGG
soundtrackhq = lasso.load('bgmhq/','.wav') # Stereo WAV
soundfx = lasso.load('sfx/','.wav') # Stereo WAV
soundfx3d = lasso.load('sfx3d/','.wav') # Mono WAV

#sf = sf2_loader.sf2_loader()
print(choice(soundfonts))
#loader = sf.sf2_loader(choice(soundfonts))
#loader.play_midi_file(midifiles)
music = bgm
music.playBgm(choice(soundtrack), 1)
pygame.init()
pygame.display.set_caption('Team SnakeDog')
img = pygame.image.load('gfx/Rings.png')
img = pygame.transform.scale(img,(1920,1080))
display = pygame.display.set_mode((1920,1080))
display.blit(img,[0,0])
pygame.display.update()
while True:
pass`

'piece object has no attribute 'tempo''

Hello,

After installing the most recent version, I am getting this error as well:

Traceback (most recent call last):
  File "C:\Users\GilDurao\Documents\GitHub\flutterpy-lmusic\flutterpy_lmusic\lib\yourscript.py", line 145, in <module>
    generate_instrument_sample(sys.argv[2], sys.argv[3])
  File "C:\Users\GilDurao\Documents\GitHub\flutterpy-lmusic\flutterpy_lmusic\lib\yourscript.py", line 85, in generate_instrument_sample       
    sf2.export_piece(piece, name="instrument_sample.wav")
  File "C:\Users\GilDurao\AppData\Local\Programs\Python\Python39\lib\site-packages\sf2_loader\read_sf2\read_sf2.py", line 655, in export_piece
    bpm = current_chord.tempo
AttributeError: 'piece' object has no attribute 'tempo'

Exporting musicpy piece fails [possibly not an issue with library, but syntax error of musicpy]

Hello again 👋 ,

I've been following musicpy's documentation, and from what I understood a chord can also represent a whole piece of music. I was trying to understand this by creating a simple example by just creating a piece that is a C chord over 3 bars:

c = sf.mp.note('C', 5, 1, 100)
e = sf.mp.note('E', 5, 1, 100)
g = sf.mp.note('G', 5, 1, 100)

myGChord = sf.mp.chord([c, e, g])

fantasyInG = sf.mp.piece([myGChord], [1], 100, [0], channels=[1])

This code runs fine, but when I export the piece:

sf2.export_piece(fantasyInG, "fantasy_in_g.wav")

the following error is output:

Traceback (most recent call last):
  File "yourscript.py", line 51, in <module>
    sf2.export_piece(fantasyInG, "fantasy_in_g.wav")
  File "/usr/local/lib/python3.8/dist-packages/sf2_loader/read_sf2/read_sf2.py", line 583, in export_piece
    current_audio = self.export_chord(each, decay, track, 0,
  File "/usr/local/lib/python3.8/dist-packages/sf2_loader/read_sf2/read_sf2.py", line 432, in export_chord
    whole_length_with_decay = mp.chord(temp.notes, [
  File "/usr/local/lib/python3.8/dist-packages/sf2_loader/read_sf2/read_sf2.py", line 433, in <listcomp>
    temp.notes[i].duration + current_decay[i]
TypeError: unsupported operand type(s) for +: 'int' and 'str'

So, I was wondering where my mistake is syntax wise, because I'm certain that this is just my lack of knowledge of musicpy 😅

'ModuleNotFoundError: No module named fluidsynth'

Hello,

After upgrading to most recent version, I get this error when trying to run any script that improts sf2_loader

 File "C:\Users\GilDurao\AppData\Local\Programs\Python\Python39\lib\site-packages\sf2_loader\__init__.py", line 2, in <module>
    from .read_sf2.read_sf2 import *
  File "C:\Users\GilDurao\AppData\Local\Programs\Python\Python39\lib\site-packages\sf2_loader\read_sf2\read_sf2.py", line 4, in <module>      
    import fluidsynth
ModuleNotFoundError: No module named 'fluidsynth'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\GilDurao\Documents\GitHub\flutterpy-lmusic\flutterpy_lmusic\lib\yourscript.py", line 2, in <module>
    import sf2_loader as sf
  File "C:\Users\GilDurao\AppData\Local\Programs\Python\Python39\lib\site-packages\sf2_loader\__init__.py", line 4, in <module>
    from .read_sf2_32bit.read_sf2 import *
  File "C:\Users\GilDurao\AppData\Local\Programs\Python\Python39\lib\site-packages\sf2_loader\read_sf2_32bit\read_sf2.py", line 4, in <module>
    import fluidsynth
ModuleNotFoundError: No module named 'fluidsynth'

I'm not really sure why this happens, because in the sf2_loader folders there is indeed a module named fluidsynth.py

[Help Wanted] - Generating chord progressions

Hello 👋 ,

I've been able to generate 1 voice melodies so far with ease, but right now I am struggling to export a piece that is supposed to represent a chord progression.

I have this code that generates the progression:

def chord_progression_parsing(output, scaleRoot, scaleMode, durations, volume=100):
    scale = mp.scale(scaleRoot, scaleMode)
    progression = []
    degree = 1
    numberOfNotes = 3
    for i in range(len(output)):
        currentSymbol = output[i]
        duration = random.choice(durations)
        chord = scale.pickchord_by_degree(
            degree, duration=duration, num=numberOfNotes)
        for j in range(1, len(output)):
                #some conditions to know when to create a new chord that dont have musicpy code
                duration = random.choice(durations)
                chordNotes = chord.notes
                progressionChord.append(
                    mp.chord(chordNotes, interval=1, duration=duration))
                chord = scale.pickchord_by_degree(
                    degree, duration=duration, num=numberOfNotes)
               # conditions  to change degree and numberOfNotes values that don't have musicpy code
    print(progressionChord)
    return [progressionChord]

And then I am using export_piece like this

  piece = sf.mp.piece(
            [progressionChord], [sf2.current_preset_num], bpm, [0], channels=[1]
        )

But I get this error

Traceback (most recent call last):
  File "C:\Users\GilDurao\Documents\GitHub\flutterpy-lmusic\flutterpy_lmusic\lib\yourscript.py", line 196, in <module>
    generate_music(lSystem, iterations, musicalParsing, scale, musicKey, bpm,
  File "C:\Users\GilDurao\Documents\GitHub\flutterpy-lmusic\flutterpy_lmusic\lib\yourscript.py", line 163, in generate_music
    sf2.export_piece(
  File "C:\Users\GilDurao\Documents\GitHub\flutterpy-lmusic\.venv\lib\site-packages\sf2_loader\read_sf2\read_sf2.py", line 656, in export_piece
    current_chord.normalize_tempo()
  File "C:\Users\GilDurao\Documents\GitHub\flutterpy-lmusic\.venv\lib\site-packages\musicpy\structures.py", line 3360, in normalize_tempo      
    first_track.normalize_tempo(bpm, start_time=first_track_start_time)
AttributeError: 'list' object has no attribute 'normalize_tempo'

Could you tell me what I am doing wrong if you would be so kind?

Error when calling 'change_preset'

Hello,

When I try to run

  sf2 = sf.sf2_loader(str(sf2FilePath))
    sf2.change_preset('myInstrument')

I get the following error:

  File "..\yourscript.py", line 162, in <module>
    generate_music(lSystem, iterations, musicalParsing, scale, musicKey, bpm,
  File "..\yourscript.py", line 124, in generate_music
    sf2.change_preset(instrumentName)
  File "..\Python\Python39\lib\site-packages\sf2_loader\read_sf2\read_sf2.py", line 401, in change_preset
    self.instruments, self.instruments_ind = self.get_all_instrument_names(
ValueError: not enough values to unpack (expected 2, got 0)

This happened after I upgraded from 0.32 to most recent version 0.57. It was working before

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.