aboutsummaryrefslogtreecommitdiff
path: root/site/udo/soundfont.udo
diff options
context:
space:
mode:
authorRichard <q@1bpm.net>2025-04-13 18:48:02 +0100
committerRichard <q@1bpm.net>2025-04-13 18:48:02 +0100
commit9fbf91db06a6d4f4b5cd8bb45389a731bb86bf22 (patch)
tree291bd79ce340e67affa755a8a6b4f6a83cce93ea /site/udo/soundfont.udo
downloadapps.csound.1bpm.net-9fbf91db06a6d4f4b5cd8bb45389a731bb86bf22.tar.gz
apps.csound.1bpm.net-9fbf91db06a6d4f4b5cd8bb45389a731bb86bf22.tar.bz2
apps.csound.1bpm.net-9fbf91db06a6d4f4b5cd8bb45389a731bb86bf22.zip
initial
Diffstat (limited to 'site/udo/soundfont.udo')
-rwxr-xr-xsite/udo/soundfont.udo68
1 files changed, 68 insertions, 0 deletions
diff --git a/site/udo/soundfont.udo b/site/udo/soundfont.udo
new file mode 100755
index 0000000..6c60b99
--- /dev/null
+++ b/site/udo/soundfont.udo
@@ -0,0 +1,68 @@
+#ifndef UDO_SOUNDFONT
+#define UDO_SOUNDFONT ##
+/*
+ Sound font tools
+
+ This file is part of the SONICS UDO collection by Richard Knight 2021
+ License: GPL-2.0-or-later
+ http://1bpm.net
+
+*/
+
+#include "host_tools.udo"
+
+; load soundfonts
+isf_temp[] fillarray \
+ sfload(dir_soundfont("Rhodes/Galaxy_Electric_Pianos.sf2")),\
+ sfload(dir_soundfont("Rhodes/vibra.sf2")),\
+ sfload(dir_soundfont("Rhodes/JR_elepiano.sf2")),\
+ sfload(dir_soundfont("Rhodes/Crysrhod.sf2")),\
+ sfload(dir_soundfont("Rhodes/KR-O5R-Operator.sf2"))
+
+; prepare rhodes presets
+gisf_rhodes[] fillarray \
+ sfpreset(4, 2, isf_temp[0], 0),\
+ sfpreset(5, 2, isf_temp[0], 1),\
+ sfpreset(4, 3, isf_temp[0], 2),\
+ sfpreset(5, 3, isf_temp[0], 3),\
+ sfpreset(4, 4, isf_temp[0], 4),\
+ sfpreset(5, 4, isf_temp[0], 5),\
+ sfpreset(0, 0, isf_temp[1], 6),\
+ sfpreset(2, 0, isf_temp[1], 7),\
+ sfpreset(0, 0, isf_temp[2], 8 ),\
+ sfpreset(0, 0, isf_temp[3], 9),\
+ sfpreset(0, 0, isf_temp[4], 10)
+
+; rhodes gains for each preset index as above
+gisf_rhodes_gain[] fillarray 1.6, 5, 1, 1, 1, 1, 1, 1, 1, 1.5, 1
+gisf_rhodes_noteaugment[] fillarray 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0
+
+/*
+ Play rhodes soundfont
+ aL, aR sf_rhodes index, inote, [ivel]
+
+ index index in gisf_rhodes, 0 to 10
+ inote midi note number
+ ivel velocity, 0 to 1, default=1
+*/
+opcode sf_rhodes, aa, iip
+ index, inote, ivel xin
+ aL, aR sfplay3 ivel, inote + gisf_rhodes_noteaugment[index], gisf_rhodes_gain[index]/30000, 1, gisf_rhodes[index]
+ xout aL, aR
+endop
+
+
+/*
+ Play random rhodes soundfont from gisf_rhodes
+ aL, aR sf_rhodes inote, [ivel]
+
+ inote midi note number
+ ivel velocity, 0 to 1, default=1
+*/
+opcode sf_rhodes_random, aa, ip
+ inote, ivel xin
+ aL, aR sf_rhodes round(random(0, lenarray(gisf_rhodes)-1)), inote, ivel
+ xout aL, aR
+endop
+
+#end \ No newline at end of file