SHARC is a musical instrument timbre database established by Greg Sandell.
This version of the SHARC adaptation to Csound ( see also Stephen Yi ) concentrates
on real-time playing. In this instance, the computer keyboard was used in conjunction
with three other programs :
1. Midi-Ox (MIDI utility by Jamie O' Connell and Jerry Jorgenrud includes keyboard player) and
2. Hubi's Midi Loopback Cable - (virtual loopback connector) by Hubert Winkler .
And for this set,
3. Midi-Yoke by the makers of Midi-Ox (same function as Hubi's MIDI cable).
These files were written with both loopbacks installed.
Attempting to run them with less than Hubi's LB1-LB4 and 4 Midi-Yoke connectors will result in an error.
The files have K=5 and X=1 in the options settings at the head of each file. Hubi's LB1 defaults to MIDI input 5
if Hubi's Loopback Midi Cable is installed and Midi-Yoke is installed with a four connector option.
My system is a 366Mhz PII running Windows 98, the command line options can be tweaked for performance
improvements on newer systems. For some reason, Csound AV 0.0431 crashes when I run these.
A minor problem, simply close the crash dialog box and continue. I may have ommitted a semicolon somewhere.
My system is not likely to be similar to yours. Expect to tweak some files. The common options set for all files are
-+K5 -+X1 -+e -b600 ; -dm6 -+O
These are CsoundAV settings.
K : Enable MIDI IN. <num> = MIDI IN device id number
X : Enable DirectSound primary buffer writing for low-latency audio output.
e : Allow any output sample rate (for cards that support this feature).
O : (uppercase letter) Suppress all printf for better realtime performance
Csound settings :
-b N sample frames (or - kperiods) per software sound I/O buffer
-d suppress all displays
-m N tty message level. Sum of: 1=note amps, 2=out-of-range msg, 4=warnings, 16=amps as DB.
The flags -d and -m6 above will suppress displays and amplitude messages,
which can compromise realtime performance.
Leave them on if interested
If you have more than a nodding aquaintance with a program like AWK, tweaking all these files will be easy.
You can even write your own adaptation. Mine were written specifically for keyboard real-time
performance on my PII 366Mhz in 2004.
Csound 4.19
CsoundAV 0.431
Below is a sample CSD file and a sample portion of the orchestra include file is at the bottom of the page.
<CsoundSynthesizer>
<CsOptions>
-+X -+e -+K -b800 ; -m0 -+O
</CsOptions>
<CsInstruments>
#include "01_ftables-AltoFlute2.orc"
;***************************************************
instr 1 ;**** caller instrument ****
;***************************************************
iamp ampmidi 1
ifreq cpsmidi
indx init -2
ipitch pchmidi
mididefault 0.1, 20
istart = 0 ; p2
idur = 0.1 ; 0.5; p3
iamp = 10 ; p4
iSpace= 0 ; p5
ifn = 2001
INC: indx=indx+3
ipch table indx, ifn
inum table indx-1, ifn
if ipitch=ipch goto PLAY
if (ipitch <7.07) || (ipitch >10.00) goto DONE
goto INC
PLAY:
; p1 p2 p3 p4 p5 p6 p7
callm 2, istart, idur , iamp, ifreq, inum, ipitch
; aout oscil iamp, ifreq, inum ;giadsr ; works either way
; out aout
DONE:
endin
;***************************************************
instr 2
;***************************************************
;************ COMPLEX ENVELOPE SECTION ***********
; print p6, p7
xtratim 0.1 ; 1.0 ;extra-time, i.e. release dur
krel init 0
krel release ;outputs release-stage flag (0 or 1 values)
if (krel > 0.5) kgoto rel ;if in relase-stage goto relase section
;************ ATTACK AND SUSTAIN SECTION ***********
kmp1 linsegr 0, 0.15, 1, 0.1, 1
; kmp1 linsegr 0, 0.05, 1, 10, 1
kmp = kmp1*p4
kgoto done
;************ RELEASE SECTION **********************
rel:
kmp2 linsegr 1, 0.1, 0.2, 0.1, 0
kmp = kmp1*kmp2*p4
; ********************************************************
done:
; ************** VIBRATO *********************************
; kout vibr kAverageAmp, kAverageFreq, ifn
kout vibr 1, 2, 2000 ; Added vibrato - jlj
kmp5=kmp*kout ; kmp5 with vibrato / kmp without vibrato
; ar oscil xamp, xcps, ifn[, iphs]
aout oscil kmp, p5, p6 ;giadsr ; works either way
out aout/1000
endin
</CsInstruments>
<CsScore>
f0 3600
f2000 0 65537 10 1 ;sine wave
f2001 0 128 -2
25 7.07 1.0
9 7.08 2.0
30 7.09 3.0
27 7.10 4.0
26 7.11 5.0
14 8.00 6.0
5 8.01 7.0
13 8.02 8.0
4 8.03 9.0
12 8.04 10.0
11 8.05 11.0
7 8.06 12.0
10 8.07 13.0
2 8.08 14.0
15 8.09 15.0
28 8.10 16.0
16 8.11 17.0
21 9.00 18.0
8 9.01 19.0
20 9.02 20.0
6 9.03 21.0
19 9.04 22.0
18 9.05 23.0
1 9.06 24.0
17 9.07 25.0
3 9.08 26.0
22 9.09 27.0
29 9.10 28.0
23 9.11 29.0
24 10.0 30.0
</CsScore>
</CsoundSynthesizer>
An example of the data in the orc file.
giadsr1 ftgen 1, 0, 1024, -9, \ ;altofl_f#5
1, ampdb(100 - 0.0), -92.67133970004961,\
2, ampdb(100 - 17.5761), 118.44412724062431,\
3, ampdb(100 - 23.8211), -112.88357183887967,\
4, ampdb(100 - 23.9225), 82.21027627655103,\
5, ampdb(100 - 31.6416), -93.99028854444077,\
6, ampdb(100 - 34.373), 99.67059212536775,\
7, ampdb(100 - 41.6194), -49.3024453132122,\
8, ampdb(100 - 44.1476), 154.31529592037975,\
9, ampdb(100 - 45.5558), -7.333859777674537,\
10, ampdb(100 - 50.9146), 160.89571619745726,\
11, ampdb(100 - 55.3942), 111.62363764738697,\
12, ampdb(100 - 40.7136), -133.4378597814028,\
13, ampdb(100 - 50.491), 53.72969019618809