Repository navigation
v4.0.0-alpha.3
Pre-releaseCsoundUnity 4.0.0-alpha.3 requires Unity 2022.3 LTS or newer. In Unity: Window → Package Manager → + → Add package from git URL…, then paste:
https://github.com/rorywalsh/CsoundUnity.git#v4.0.0-alpha.3
The API reference now covers every public member of the runtime assemblies.
4.0 documentation · API reference · Migration from 3.x · 3.x documentation
The public API is being finalised before the stable release. Reading through the API reference, trying the calls you would actually use, and saying what reads wrong, is awkward to call or is missing is the most useful thing to send back from this prerelease.
What's new since alpha.2
Lifecycle. The orchestra of a live instance can be swapped. CsoundReset() answers bool, keeps the host sample rate, ksmps, audio IO and message buffer, and holds the audio callbacks silent while it runs; a callback that does not leave in time makes the reset refuse rather than reset under it. Compilation and start are separate steps, CompileOrc() then CsoundStart(), so a scene can reset and wait for an orchestra that arrives from elsewhere. Csound's cleanup no longer runs at process exit, where Unity has already taken down the scripting runtime. See the Lifecycle API.
Presets follow the csd. Preset on start takes only a preset of the assigned csd, and the preset lists follow the same rule. A global JSON preset is recognized by the (GLOBAL) suffix in its file name. One or more preset assets can be reassigned to another csd from the preset inspector.
Diagnostics. Two new scenes. Engine Constants reports what the engine answers for sample rate, control rate, ksmps, channel counts and 0dbfs, records the Unity listener, and says what a WebGL player cannot do. Table Copy Load compares a reference playback with queued table copies at the same settings, and reports per-block DSP peaks, blocks over budget, submission time, completion latency and queue saturation. Asynchronous table copies can now be tracked from submission to completion, a copy into a table preserves its guard sample, and string channels are read without assuming a fixed maximum size.
WebGL reports the engine's real settings. The getters answer the compiled sample rate, control rate, ksmps, channel counts, 0dbfs and version instead of placeholders, and compilation status reflects a successful CSD initialization.
Editors and render pipelines. CsoundUnity compiles on Unity 6.6, where the object identifiers the Timeline integration used are no longer allowed. Imported sample materials are adapted to URP/Lit keeping their colors, and CsoundUnity > Fix Sample Materials for Current Render Pipeline converts samples imported earlier. Importing the Timelines samples offers to install Unity's Timeline package when the project does not have it: without that package the whole Timeline integration is not compiled, and those scenes open with their scripts missing.
Documentation. Every public member of the runtime assemblies is documented, with parameters, return values and remarks. There is also a new page for people coming from Wwise or FMOD.
Try these samples
Import the samples from the Samples tab for CsoundUnity in Package Manager.
- API Smoke Test in Diagnostics exercises the public API and prints a pass or fail report you can paste into an issue.
- Engine Constants in Diagnostics tells you what the engine actually answers on the platform you are on, which is the quickest way to spot a mismatch with your project's audio settings.
- Table Copy Load in Diagnostics measures what a queued table copy costs, on the calling thread and inside the audio block.
Upgrading from alpha.2
CsoundReset()returnsbool, and no longer restarts the engine by itself: callCompileOrc()and thenCsoundStart().CompiledWithoutError()andHasCompiledanswer true only while the instance holds a compiled engine.CsoundWorker.Reset()refuses: the worker owns its performance thread, so another orchestra takes a new worker.CsoundUnityEncoder.Valueis nowChannelValue, andCsoundUnitySlider.Activeis gone: starting and stopping an instrument is oneSendScoreEventcall.- Three sequencer setters say what they set:
SetScale,SetChordTypeandSetSwarmGrainDurationVariation.CsoundUnityTimelineController.SetPatternBpmis gone, andSetBpmsets the clip's tempo. CsoundUnityPreset.csoundFileGUIDand the fourth argument ofCreatePresetare gone: the csd is matched by file name.- A
CsoundUnityDropdownon a Cabbage 3 combobox counting from zero reports the value Csound received, without adding one to it.
Known issues and limitations
- iOS and visionOS. iOS builds, with device playback still to be verified. visionOS is experimental and ships the iOS Csound build: device and simulator testing are pending, and native low-latency input is unavailable there.
- Samples and the new Input System. The sample scripts read
UnityEngine.Input, so in a project set to the new Input System alone their mouse and keyboard controls do not respond. Audio and on-screen UI are unaffected, entering play mode logs why, and setting Active Input Handling to Both restores them. - AudioSource Quad output. On Unity 6000.3.10f1, Quad speaker mode loses channels 3 and 4 before the listener, which Unity tracks as UUM-146928 and lists as fixed in 6000.3.29f1. Verification on the patched Editor is pending.
For audio or platform reports, include your Unity version, platform, sample or steps to reproduce, and any Diagnostics output.