Coder Social home page Coder Social logo

limunimi / pycarla Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 1.0 145 KB

Synthesize music in Python using any audio plugins, both realtime and offline (batch-processing)

Home Page: https://federicosimonetta.eu.org

License: GNU General Public License v3.0

Python 100.00%
python synthesizer vst lv2 jackaudio jack audio midi

pycarla's People

Contributors

00sapo avatar dependabot[bot] avatar trellixvulnteam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

trellixvulnteam

pycarla's Issues

[FEATURE] Automatically detect xruns

Is your feature request related to a problem? Please describe.
Xruns happens in with a non-predictive behavior, crashing the whole Carla software

Describe the solution you'd like
Detect xruns, save the last processing command (e.g. synthesize_midi_file and the arguments) restart Carla, and resubmit the command.

Detection could happen via parsing of the Carla stdout.

Describe alternatives you've considered
Opened an issue for using the Carla python scripts, but received no attention at all falkTX/Carla#1316

[INFO] Cant get pycarla to work

I try to use pycarla to have a python script create and control midi output over the systems audio out.

I'm not very experienced with linux and this might cause the problem. Sorry for that... :)

However, I used the usage examples to have carla output a downloaded midifile. at the moment I'm using lubuntu 22.10.
Its a fresh install and I just did

sudo apt-get install jackd2
sudo apt-get install carla

However, Carla is not be able to start the engine if QjackCtl is not startet and running first. Maybe the wrong place to ask here?
Furthermore, I had to connect carla and systems out not only in the carla patchbay but also in the QjackCtl Patchcontrol have to connect them? I had a try earlier, where both of these steps worked flawlessly, but just cant reproduce it..
Then I installed pip and python 3.10.7 and followed the installation instructions. If I do all of that, created a carla project in the same folder and have carla up and running opening that project I used the following code:

from pycarla import Carla, MIDIPlayer, AudioRecorder, get_smf_duration
carla = Carla("A.carxp", ['-R', '-d', 'alsa'], min_wait=4)
carla.start()

player = MIDIPlayer()

with MIDIPlayer() as player:
    #print("Playing full file using freewheeling mode..")
	duration = get_smf_duration("test.mid")
	# in the following, `condition` ensures that both the recorder and player
	# start in the same cycle
	player.synthesize_midi_file("test.mid", in_fw=True, out_fw=True)
	# or asynchronously:
	# player.synthesize_midi_file("filename.mid", sync=False)
	# in this case, use
	# player.wait(in_fw=True, out_fw=True)
	player.close()
	server.close()
	#pass

try:
    carla.kill()
except Exception as e:
    print("Processes already closed!")

I get the following error:

Carla ready!
Traceback (most recent call last):
  File "/home/mane/test1.py", line 12, in <module>
    player.synthesize_midi_file("test.mid", in_fw=True, out_fw=True)
  File "/usr/local/lib/python3.10/dist-packages/pycarla/midiplayer.py", line 193, in synthesize_midi_file
    return self.synthesize_messages(messages, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/pycarla/midiplayer.py", line 118, in synthesize_messages
    self.activate()
  File "/usr/local/lib/python3.10/dist-packages/pycarla/midiplayer.py", line 36, in activate
    raise RuntimeWarning(
RuntimeWarning: Cannot find the Carla instance, Retry later!

I would really appreciate any help with that! This package is exactly what I need, if only I could get it running! :)

I also (at least I think I did) solved the following problems so far, maybe it makes sense to add this to the documentation?:

  • Carla has to be installed first, before installing pycarla. May be obvious. Still was costing me a few hours to fix.
  • I think the user needs to be added to the audio group in order to have real time performance? (used "sudo usermod -a -G audio UserID" and restart to fix the error)
  • I also ran into the developement steps out of the documentation, was also not obvious to me, that this is for the pros... ;)e

[FEATURE] Easier API for synthesizing a midi file

Is your feature request related to a problem? Please describe.
Right now, synthesis of midi file requires the computation of the duration, the setup of Carla, MidiPlayer, and, maybe, of AudioRecorder.

Describe the solution you'd like
All these things could be performed with one single function

[FEATURE] Automatically set-up patchbay mode

Is your feature request related to a problem? Please describe.
Installation and setup of Carla is a little complex, especially for non-experienced people

Describe the solution you'd like
When Carla.start is called, it automatically checks if the configuration file contains the patchbay mode string (ProcessMode=3 into ~/.config/falkTX/Carla2.conf), otherwise sets it and notify the user in stdout.

Raise an exception if the configuration file is not found. Need to understand what are the default paths of the configuration file for Windows and MacOS

Describe alternatives you've considered
Opened an issue in Carla, but received no attention at all falkTX/Carla#1315

Error at running : poetry run -m pycarla <file.mid>

Hi,
I m under win10 and after installed all the dependencies, created a small runnning Carla project, running Jack.
I get this error for this syntax, launched under pycarla folder:
...\pycarla>poetry run -m pycarla k12.mid
'-m' is not recognized as an internal or external command,
operable program or batch file.

Help needed, thanks Federico

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.