def initCbox(clientName): cbox.init_engine("") cbox.Config.set("io", "client_name", clientName) cbox.start_audio() scene = cbox.Document.get_engine().new_scene() scene.clear() cbox.do_cmd("/master/set_ppqn_factor", None, [D4]) #quarter note has how many ticks? cbox.Transport.stop() cbox.Transport.seek_ppqn(0) cbox.Transport.set_tempo(120.0) #must be float eventLoop.call_soon(cboxLoop, eventLoop) return scene, cbox, eventLoop
def initCbox(clientName, internalEventProcessor=True, commonMidiInput=True): cbox.init_engine("") cbox.Config.set("io", "client_name", clientName) cbox.Config.set("io", "enable_common_midi_input", commonMidiInput) #the default "catch all" midi input cbox.start_audio() scene = cbox.Document.get_engine().new_scene() scene.clear() cbox.do_cmd("/master/set_ppqn_factor", None, [D4]) #quarter note has how many ticks? cbox.Transport.stop() cbox.Transport.seek_ppqn(0) cbox.Transport.set_tempo(120.0) #must be float if internalEventProcessor: eventLoop.call_soon(cboxLoop, eventLoop) return scene, cbox, eventLoop
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ import atexit from pprint import pprint from calfbox import cbox cbox.init_engine("") cbox.Config.set("io", "outputs", 8) NAME = "Cbox Interactive" cbox.Config.set("io", "client_name", NAME) cbox.start_audio() scene = cbox.Document.get_engine().new_scene() scene.clear() print("Setting nonsense meta data to our first two ports and midi port") cbox.JackIO.Metadata.set_property("Cbox Interactive:out_1", "foo", "bar") cbox.JackIO.Metadata.set_property("Cbox Interactive:out_1", "faz", "baz") cbox.JackIO.Metadata.set_property("Cbox Interactive:out_2", "rolf", "hello") cbox.JackIO.Metadata.set_property("Cbox Interactive:out_2", "rolf", "hello") cbox.JackIO.Metadata.set_property("Cbox Interactive:midi", "wolf", "world", "stryng") cbox.JackIO.Metadata.set_property("Cbox Interactive:midi", "asd", "qwe", "")
#! /usr/bin/env python3 # -*- coding: utf-8 -*- from calfbox import cbox import time def cmd_dumper(cmd, fb, args): print("%s(%s)" % (cmd, ",".join(list(map(repr, args))))) cbox.init_engine("") #empty string so cbox doesn't look for the .cboxrc file cbox.Config.set("io", "use_usb", 0) cbox.Config.set("io", "midi", "*.*") cbox.start_audio(cmd_dumper) global Document Document = cbox.Document status = cbox.JackIO.status() client_name = status.client_name print("Client name: %s" % client_name) print("Audio inputs: %d, outputs: %d" % (status.audio_inputs, status.audio_outputs)) print("Sample rate: %d frames/sec" % (status.sample_rate)) print("JACK period: %d frames" % (status.buffer_size)) left_dry = cbox.JackIO.create_audio_output('left_dry') right_dry = cbox.JackIO.create_audio_output('right_dry')
from calfbox import cbox def cmd_dumper(cmd, fb, args): print ("%s(%s)" % (cmd, ",".join(list(map(repr,args))))) cbox.init_engine() cbox.Config.add_section("drumpattern:pat1", """ title=Straight - Verse beats=4 track1=bd track2=sd track3=hh track4=ho bd_note=c1 sd_note=d1 hh_note=f#1 ho_note=a#1 bd_trigger=9... .... 9.6. .... sd_trigger=.... 9..5 .2.. 9... hh_trigger=9353 7353 7353 73.3 ho_trigger=.... .... .... ..3. """) cbox.Config.set("io", "use_usb", 1) cbox.start_audio(cmd_dumper) global Document Document = cbox.Document status = cbox.JackIO.status()
from calfbox import cbox def cmd_dumper(cmd, fb, args): print("%s(%s)" % (cmd, ",".join(list(map(repr, args))))) cbox.init_engine() cbox.start_audio(cmd_dumper) global Document Document = cbox.Document scene = Document.get_scene() scene.clear() instrument = scene.add_new_instrument_layer("test_sampler", "sampler").get_instrument() pgm_no = instrument.engine.get_unused_program() pgm = instrument.engine.load_patch_from_file(pgm_no, 'synthbass.sfz', 'SynthBass') instrument.engine.set_patch(1, pgm_no) print(instrument.engine.get_patches()) print(instrument.get_output_slot(0)) print(instrument.get_output_slot(0).status()) instrument.get_output_slot(0).set_insert_engine("reverb") print(instrument.get_output_slot(0).status()) instrument.get_output_slot(0).engine.cmd("/wet_amt", None, 1.0) for i in pgm.get_groups(): print("<group>", i.as_string()) for j in i.get_children(): print("<region>", j.as_string())
import os import sys import struct import time import unittest # This is for locale testing from gi.repository import GObject, Gdk, Gtk from calfbox import cbox cbox.init_engine("") cbox.start_noaudio(44100) cbox.Config.add_section( "drumpattern:pat1", """ title=Straight - Verse beats=4 track1=bd track2=sd track3=hh track4=ho bd_note=c1 sd_note=d1 hh_note=f#1 ho_note=a#1 bd_trigger=9... .... 9.6. .... sd_trigger=.... 9..5 .2.. 9... hh_trigger=9353 7353 7353 73.3 ho_trigger=.... .... .... ..3. """) cbox.Config.add_section("fxpreset:piano_reverb", """