aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: bdbfff6bdc4f7b82ee5c84b5776fc7597a6254a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

   

Introduction

csound-sqldb provides database access opcodes which allow for the querying of data in SQL databases at i- and k-rate. MySQL, PostgreSQL and SQLite3 are supported and are used with the same opcodes after the initial connection. The opcodes have been tested on Linux and Windows.

The opcodes rely on changes made after the official 6.13.0 release of Csound so while awaiting the next release the Csound source will need to be obtained from the develop branch of https://github.com/csound/csound/ otherwise they will not build.

Opcode overview

The opcodes are detailed in full in OpcodeDocumentation.md

Aside from the connection opcode, there are three groups available for each to allow for design options particularly when considering database latency/performance:

  • i-rate : to be used when db latency is particularly low, in global orchestra space or not running in realtime etc.
  • k-rate : these execute in a separate thread invoked by a trigger, and emit a trigger when complete so can always safely be used in audio generating instruments.
  • k-rate (blocking) : these execute at k-rate but block the instrument execution so would be used in special cases such as non-realtime analysis instruments (eg in example 7) or when generating audio offline etc.

Requirements

  • Csound libraries
  • Cmake >= 2.8.12
  • At least one database development library from the three below. Opcodes will support whichever of these databases can be found, which will be indicated when running the initial cmake command.

MySQL

Connector/C++ (https://dev.mysql.com/downloads/connector/cpp/)

# apt-get install libmysqlcppconn-dev

PostgreSQL

libpq (https://www.postgresql.org/download/)

# apt-get install libpq-dev

SQLite

libsqlite (https://www.sqlite.org/download.html)

# apt-get install libsqlite3-dev

Building

Create a build directory at the top of the source tree, execute cmake .., make and optionally make install as root. If the latter is not used/possible then the resulting libsqldb.so can be used with the --opcode-lib flag in Csound. eg:

git clone https://git.1bpm.net/csound-sqldb
cd csound-sqldb
mkdir build && cd build
cmake ..
make && sudo make install

Examples

A number of examples are included in the examples directory. Generally the syntax of each opcode is agnostic to the database type used, so the different techniques in each can be used for any database type.

Reference

OpcodeDocumentation.md contains an explanation of all provided opcodes.

By Richard Knight 2019