All Projects → kunitoki → popsicle

kunitoki / popsicle

Licence: other
Popsicle aims to bridge the JUCE c++ framework to python.

Programming Languages

python
139335 projects - #7 most used programming language
CMake
9771 projects
shell
77523 projects

Projects that are alternatives of or similar to popsicle

Vue Firestore
☁️ Cloud Firestore binding in realtime with Vuejs
Stars: ✭ 239 (+134.31%)
Mutual labels:  bindings
XinFramework
Android 快速开发框架 总结以往开发结合三方项目 不断更新
Stars: ✭ 21 (-79.41%)
Mutual labels:  rapid-development
gfort2py
Library to allow calling fortran code from python
Stars: ✭ 60 (-41.18%)
Mutual labels:  bindings
Python Mpv
Python interface to the awesome mpv media player
Stars: ✭ 245 (+140.2%)
Mutual labels:  bindings
mapbox-ios-binding
Xamarin binding library for Mapbox iOS SDK
Stars: ✭ 15 (-85.29%)
Mutual labels:  bindings
swift-tree-sitter
Swift bindings for the tree-sitter parsing library
Stars: ✭ 29 (-71.57%)
Mutual labels:  bindings
Freetype Py
Python binding for the freetype library
Stars: ✭ 209 (+104.9%)
Mutual labels:  bindings
Roboverb
A VST / VST3 / AU / LV2 Reverb Plugin
Stars: ✭ 48 (-52.94%)
Mutual labels:  juce
ventilator-FI5
FI5: Rapidly Manufactured Ventilator System
Stars: ✭ 31 (-69.61%)
Mutual labels:  rapid-development
DSP-Testbench
A DSP Testbench for users of the JUCE framework
Stars: ✭ 40 (-60.78%)
Mutual labels:  juce
RubyGateway
Embed Ruby in Swift: load Gems, run scripts, call APIs seamlessly in both directions.
Stars: ✭ 108 (+5.88%)
Mutual labels:  bindings
osmid
osmid is a tool to bridge MIDI and OSC. It is currently in use in Sonic Pi
Stars: ✭ 63 (-38.24%)
Mutual labels:  juce
loam
Javascript wrapper for GDAL in the browser
Stars: ✭ 174 (+70.59%)
Mutual labels:  bindings
Fltk Rs
Rust bindings for the FLTK GUI library.
Stars: ✭ 241 (+136.27%)
Mutual labels:  bindings
juce-plugin-ci
Cross-platform CI for JUCE audio plugins with Github Actions
Stars: ✭ 51 (-50%)
Mutual labels:  juce
Nimgl
NimGL is a Nim library that offers bindings for popular libraries used in computer graphics
Stars: ✭ 218 (+113.73%)
Mutual labels:  bindings
hoedown
rust bindings for hoedown
Stars: ✭ 16 (-84.31%)
Mutual labels:  bindings
htaglib
Haskell bindings for TagLib, an audio meta-data library
Stars: ✭ 20 (-80.39%)
Mutual labels:  bindings
Amalgamate
A tool for creating an amalgamation from C and C++ sources. Forked from https://github.com/vinniefalco/Amalgamate.
Stars: ✭ 17 (-83.33%)
Mutual labels:  juce
DotNetJS
Consume C# in JavaScript with comfort: single-file UMD library, auto-generated 2-way bindings and type definitions
Stars: ✭ 551 (+440.2%)
Mutual labels:  bindings
popsicle

popsicle

Popsicle is a project that aims to give JUCE (https://juce.com/) a broader audience by allowing it to be used from python. Thanks to cppyy (http://cppyy.readthedocs.io/en/latest/) it exposes the JUCE framework api in a pythonic way, and the way it enables to write apps in python is very much similar to the way of writing them in C++ but without the overweight of managing project build, configurations and IDE solutions.

Linux Builds Status macOS Builds Status Windows Builds Status PyPI - Status PyPI - License PyPI - Python Version PyPI - Downloads

Features

  • Easy and quick to iterate over a JUCE application, no need to setup a build environment.
  • The way it allows to write JUCE code is very similar to how you would write it in C++.
  • It allows to mix Python and C++, and even compile C++ code at runtime when needed.
  • It is fast, and when the speed of C++ is required, it is possible to write those parts in C++ directly.

Example usage

A single 80 lines script is better than thousand of words:

from popsicle import juce_gui_basics
from popsicle import juce, juce_multi, START_JUCE_APPLICATION


class MainContentComponent(juce_multi(juce.Component, juce.Timer)):
    def __init__(self):
        super().__init__((), ())

        self.setSize(600, 400)
        self.startTimerHz(60)

    def __del__(self):
        self.stopTimer()

    def paint(self, g):
        g.fillAll(juce.Colours.black)

        random = juce.Random.getSystemRandom()
        rect = juce.Rectangle[int](0, 0, 20, 20)

        for _ in range(100):
            g.setColour(juce.Colour(
                random.nextInt(256),
                random.nextInt(256),
                random.nextInt(256)))

            rect.setCentre(random.nextInt(self.getWidth()), random.nextInt(self.getHeight()))
            g.drawRect(rect)

    def timerCallback(self):
        if self.isVisible():
            self.repaint()


class MainWindow(juce.DocumentWindow):
    component = None

    def __init__(self):
        super().__init__(
            juce.JUCEApplication.getInstance().getApplicationName(),
            juce.Desktop.getInstance().getDefaultLookAndFeel()
                .findColour(juce.ResizableWindow.backgroundColourId),
            juce.DocumentWindow.allButtons,
            True)

        self.component = MainContentComponent()

        self.setResizable(True, True)
        self.setContentNonOwned(self.component, True)
        self.centreWithSize(800, 600)
        self.setVisible(True)

    def __del__(self):
        if hasattr(self, "component"):
            self.component.__del__()
            self.component = None

    def closeButtonPressed(self):
        juce.JUCEApplication.getInstance().systemRequestedQuit()


class Application(juce.JUCEApplication):
    window = None

    def getApplicationName(self):
        return "JUCE-o-matic"

    def getApplicationVersion(self):
        return "1.0"

    def initialise(self, commandLine):
        self.window = MainWindow()

    def shutdown(self):
        if hasattr(self, "window"):
            self.window.__del__()
            self.window = None


if __name__ == "__main__":
    START_JUCE_APPLICATION(Application)

As easy as that ! You will find more example on JUCE usage in the examples folder.

Example Applications

Some images of JUCE tutorials and other small apps ported to popsicle.

Animated Component (https://docs.juce.com/master/tutorial_animation.html)

https://github.com/kunitoki/popsicle/raw/master/images/animated_component.png

Audio Player with waveforms (https://docs.juce.com/master/tutorial_audio_thumbnail.html)

https://github.com/kunitoki/popsicle/raw/master/images/audio_player_waveform.png

Slider decibels (https://docs.juce.com/master/tutorial_synth_db_level_control.html)

https://github.com/kunitoki/popsicle/raw/master/images/slider_decibels.png

Slider values example (https://docs.juce.com/master/tutorial_slider_values.html)

https://github.com/kunitoki/popsicle/raw/master/images/slider_values_example.png

Wavetable oscillator (https://docs.juce.com/master/tutorial_wavetable_synth.html)

https://github.com/kunitoki/popsicle/raw/master/images/wavetable_oscillator.png

Responsive GUI layouts using FlexBox and Grid (https://docs.juce.com/master/tutorial_flex_box_grid.html)

https://github.com/kunitoki/popsicle/raw/master/images/layout_flexgrid.png

Advanced GUI layout techniques (https://docs.juce.com/master/tutorial_rectangle_advanced.html)

https://github.com/kunitoki/popsicle/raw/master/images/layout_rectangles.png

Table listbox (https://docs.juce.com/master/tutorial_table_list_box.html)

https://github.com/kunitoki/popsicle/raw/master/images/table_list_box.png

Super Simple Animated Graphics

https://github.com/kunitoki/popsicle/raw/master/images/juce_o_matic.png

Installation

Installing popsicle is as easy as pulling from pypi (osx only for now):

pip3 install popsicle

Make sure you have a recent pip if you are on BigSur intel.

Build From Source

Clone the repository recursively as JUCE is a submodule

git clone --recursive [email protected]:kunitoki/popsicle.git

Install python dependencies.

pip3 install "cppyy>=2.3.1"

Then it's possible to package a wheel and install it (currently this is only tested on macOS and Linux):

# Cleanup the temporary folders
python3 setup.py clean --all

# Build the binary distribution
python3 setup.py bdist_wheel

# Install the local wheel
pip3 install dist/popsicle-*.whl

Eventually uploading to PyPI:

python3 -m twine upload --repository popsicle dist/popsicle-*.whl
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].