aboutsummaryrefslogtreecommitdiff
path: root/examples/1-sqlite-basic.csd
diff options
context:
space:
mode:
authorRichard Knight <q@1bpm.net>2020-03-17 18:47:36 +0000
committerRichard Knight <q@1bpm.net>2020-03-17 18:47:36 +0000
commitc3853f6dd796615f332fefcaaaf563794d867ee4 (patch)
treebe3aa506a3631e9261a68894a9fad26ccd911f80 /examples/1-sqlite-basic.csd
downloadcsound-sqldb-c3853f6dd796615f332fefcaaaf563794d867ee4.tar.gz
csound-sqldb-c3853f6dd796615f332fefcaaaf563794d867ee4.tar.bz2
csound-sqldb-c3853f6dd796615f332fefcaaaf563794d867ee4.zip
initial
Diffstat (limited to 'examples/1-sqlite-basic.csd')
-rw-r--r--examples/1-sqlite-basic.csd41
1 files changed, 41 insertions, 0 deletions
diff --git a/examples/1-sqlite-basic.csd b/examples/1-sqlite-basic.csd
new file mode 100644
index 0000000..8177d4a
--- /dev/null
+++ b/examples/1-sqlite-basic.csd
@@ -0,0 +1,41 @@
+<CsoundSynthesizer>
+<CsOptions>
+-odac
+</CsOptions>
+<CsInstruments>
+/*
+ EXAMPLE 1
+
+ print some data from a sqlite3 database at i-rate
+
+
+*/
+
+sr = 44100
+kr = 4410
+nchnls = 2
+0dbfs = 1
+seed 0
+
+; sqlite3 takes a file path, or :memory: for a temporary in-memory database
+; gidb dbconnect "sqlite", "/tmp/example.db"
+gidb dbconnect "sqlite", ":memory:"
+
+instr start_example
+
+ ; print a random value
+ ires1 dbscalar gidb, "SELECT RANDOM()"
+ print ires1
+
+ ; print the second column (1) of the first row (0)
+ ires2 dbscalar gidb, "SELECT 99, 98", 0, 1
+ print ires2
+endin
+
+
+</CsInstruments>
+<CsScore>
+i "start_example" 0 1
+
+</CsScore>
+</CsoundSynthesizer> \ No newline at end of file