Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/plugins_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ jobs:
run: |
mkdir -p package
cp build/src/chua/*.so \
build/src/chips/*.so \
build/src/linear_algebra/*.so \
build/src/fluidOpcodes/*.so \
build/src/dssi4cs/*.so \
Expand Down Expand Up @@ -285,6 +286,7 @@ jobs:
run: |
mkdir -p package
cp build/src/chua/*.dylib \
build/src/chips/*.dylib \
build/src/linear_algebra/*.dylib \
build/src/fluidOpcodes/*.dylib \
build/src/image/*.dylib \
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ endif()
enable_testing()

add_subdirectory(./src/chua)
add_subdirectory(./src/chips)
Comment thread
rorywalsh marked this conversation as resolved.
Resolved
add_subdirectory(./src/linear_algebra)
add_subdirectory(./src/fluidOpcodes)
add_subdirectory(./src/dssi4cs)
Expand Down
54 changes: 53 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Currently, the plugins available in this tree are
- chua (requires the Eigen library, header-only)
**chuap**

- chips (uses the floooh/chips `m6581.h` SID 6581 emulator, header-only; vendored under this directory)
**sid6581 sid6581adsr sid6581voice**

- fluidOpcodes (requires fluidsynth)
**fluidEngine fluidLoad fluidNote fluidCCi fluidCCk fluidControl fluidProgramSelect fluidAllOut fluidOut fluidInfo fluidSetInterpMethod**

Expand Down Expand Up @@ -217,6 +220,55 @@ if set, overrides the built-in default location; otherwise the installed
Windows release packages.


chips opcodes
---

The `chips` plugin's `sid6581` opcode wraps the
[floooh/chips](https://github.com/floooh/chips) MOS 6581 "SID" emulator
(`m6581.h`), which is **vendored under this directory** (header-only), so no
external dependency is required. A companion `sid6581adsr` opcode builds a
`Sid6581ADSR` user-defined type (attack/decay/release in seconds, sustain 0..1),
whose `.att`, `.dec`, `.sus` and `.rel` members can be read or written with
dot notation, and a `sid6581voice` opcode builds a `Sid6581Voice` type whose
`.freq`, `.wave` and `.pw` members describe a voice's tone:

```
iEnv:Sid6581ADSR sid6581adsr kA, kD, kS, kR
iVoice:Sid6581Voice sid6581voice kFreq, kWave, kPw

aOut sid6581 iVoice1, kGate1, iEnv1, \
iVoice2, kGate2, iEnv2, \
iVoice3, kGate3, iEnv3, \
kCutoff, kRes, iFilterMode, iRouteMask
```

Where:

| Argument | Rate | Meaning |
| --- | --- | --- |
| `aOut` | a | output signal (single channel) |
| `kFreq` | k | voice frequency in Hz (`.freq`) |
| `kWave` | k | waveform bitmask: 1 = triangle, 2 = sawtooth, 4 = pulse, 8 = noise (values combine) (`.wave`) |
| `kPw` | k | pulse-width register (0..4095); used only by the pulse waveform (`.pw`) |
| `iVoice1..3` | Sid6581Voice | per-voice tone (from `sid6581voice`) |
| `kGate1..3` | k | envelope gate (>= 0.5 on, otherwise off) |
| `iEnv1..3` | Sid6581ADSR | per-voice envelope (from `sid6581adsr`) |
| `kCutoff` | k | filter cutoff register (0..2047) |
| `kRes` | k | filter resonance (0..15) |
| `iFilterMode` | i | filter mode bitmask: 1 = low-pass, 2 = band-pass, 4 = high-pass, 8 = voice 3 off (no effect if voice 3 is in `iRouteMask`; e.g. `iRouteMask = 7` still plays voice 3) |
| `iRouteMask` | i | filter routing bitmask: 1 = voice 1, 2 = voice 2, 4 = voice 3 |

The SID clock is fixed at the PAL rate (985248 Hz) and the master volume at
maximum (15). Each voice's ADSR is latched on a gate transition (note-on
latches A/D/S/R, note-off refreshes R), so k-rate envelope changes apply to
the next note.
The emulator is licensed under zlib/libpng (the SID implementation derives
from tedplay, Unlicense); see the notices in `src/chips/m6581.h`.

It is built by default; configure with `-DBUILD_CHIPS_OPCODES=OFF` to
exclude it.


Faust opcodes
---

Expand Down Expand Up @@ -399,7 +451,7 @@ $ make

By default, all the plugins are built. If one wants to exclude a
plugin from the build process, one can pass an option to the cmake command.
The options are `BUILD_CHUA_OPCODES`, `BUILD_CUDA_OPCODES`,
The options are `BUILD_CHUA_OPCODES`, `BUILD_CHIPS_OPCODES`, `BUILD_CUDA_OPCODES`,
`BUILD_DSSI_OPCODES`, `BUILD_OPENCL_OPCODES`, `BUILD_FAUST_OPCODES`,
`BUILD_FLUID_OPCODES`, `BUILD_IMAGE_OPCODES`, `BUILD_HDF5_OPCODES`,
`BUILD_LINEAR_ALGEBRA_OPCODES`, `BUILD_P5GLOVE_OPCODES`, `BUILD_STK_OPCODES`,
Expand Down
63 changes: 50 additions & 13 deletions cmake/Modules/FindCSOUND.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,87 @@
# CSOUND_LIBRARIES - The libraries needed to use the Csound library.

if(APPLE)
# Hints are tried in order: explicit overrides, local builds in ~/Library,
# the Csound 7 installer, then the system framework.
set(CMAKE_FIND_FRAMEWORK LAST)
find_path(CSOUND_INCLUDE_DIR csound.h
HINTS
${CSOUND_INCLUDE_DIR_HINT}
"$ENV{HOME}/Library/Frameworks/CsoundLib64.framework/Headers"
"$ENV{HOME}/Library/Frameworks/CsoundLib.framework/Headers"
/Applications/csound/CsoundLib64.framework/Headers
/Library/Frameworks/CsoundLib64.framework/Headers
/Library/Frameworks/CsoundLib.framework/Headers
${CSOUND_INCLUDE_DIR_HINT}
)

find_path(CSOUND_FRAMEWORK CsoundLib64
HINTS
${CSOUND_FRAMEWORK_DIR_HINT}
"$ENV{HOME}/Library/Frameworks/CsoundLib64.framework"
/Applications/csound/CsoundLib64.framework
/Library/Frameworks/CsoundLib64.framework
${CSOUND_FRAMEWORK_DIR_HINT}
)

find_path(CSOUND_FRAMEWORK32 CsoundLib
HINTS
${CSOUND_FRAMEWORK32_DIR_HINT}
"$ENV{HOME}/Library/Frameworks/CsoundLib64.framework"
"$ENV{HOME}/Library/Frameworks/CsoundLib.framework"
/Applications/csound/CsoundLib64.framework
/Library/Frameworks/CsoundLib64.framework
/Library/Frameworks/CsoundLib.framework
${CSOUND_FRAMEWORK32_DIR_HINT}
)
else()
find_path(CSOUND_INCLUDE_DIR csound.h
PATH_SUFFIXES csound
HINTS ${CSOUND_INCLUDE_DIR_HINT}
)
if(WIN32)
find_path(CSOUND_INCLUDE_DIR csound.h
PATH_SUFFIXES csound
HINTS
${CSOUND_INCLUDE_DIR_HINT}
"$ENV{ProgramFiles}/Csound7/include"
"$ENV{ProgramW6432}/Csound7/include"
Comment thread
rorywalsh marked this conversation as resolved.
Resolved
"$ENV{ProgramFiles\(x86\)}/Csound7/include"
)
else()
find_path(CSOUND_INCLUDE_DIR csound.h
PATH_SUFFIXES csound
HINTS ${CSOUND_INCLUDE_DIR_HINT}
)
endif()
endif()

if(APPLE)
# Hints are framework parent dirs; find_library resolves CsoundLib64.framework inside them.
find_library(CSOUND_LIBRARY
NAMES CsoundLib64
NO_DEFAULT_PATH
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
HINTS
/Library/Frameworks/CsoundLib64.framework/
"$ENV{HOME}/Library/Frameworks/CsoundLib64.framework"
${CSOUND_LIBRARY_DIR_HINT}
"$ENV{HOME}/Library/Frameworks"
/Applications/csound
/Library/Frameworks
)
else()
find_library(CSOUND_LIBRARY
NAMES csound64 csound
HINTS ${CSOUND_LIBRARY_DIR_HINT}
)
# Csound 7 on Windows is named csound7_64 (double) or csound7 (single).
if(WIN32)
set(_csound_library_names csound7_64 csound7 csound64 csound)
else()
set(_csound_library_names csound64 csound)
endif()
if(WIN32)
find_library(CSOUND_LIBRARY
NAMES ${_csound_library_names}
HINTS
${CSOUND_LIBRARY_DIR_HINT}
"$ENV{ProgramFiles}/Csound7/lib"
"$ENV{ProgramW6432}/Csound7/lib"
)
else()
find_library(CSOUND_LIBRARY
NAMES ${_csound_library_names}
HINTS ${CSOUND_LIBRARY_DIR_HINT}
)
endif()
unset(_csound_library_names)
endif()

if(CSOUND_INCLUDE_DIR AND EXISTS "${CSOUND_INCLUDE_DIR}/version.h")
Expand Down
13 changes: 13 additions & 0 deletions src/chips/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Build chips opcodes (floooh/chips emulators)
option(BUILD_CHIPS_OPCODES "Build the chips opcodes" ON)

if(BUILD_CHIPS_OPCODES)
# m6581.h is header-only and vendored under this directory.
make_plugin(chips sid6581.cpp)
target_include_directories(chips PRIVATE
${CSOUND_INCLUDE_DIRS}
"${CMAKE_CURRENT_SOURCE_DIR}")
target_compile_definitions(chips PRIVATE BUILD_PLUGINS)

message(STATUS "Building chips opcodes")
endif()
Loading
Loading