Csound Csound-dev Csound-tekno Search About

[Csnd] Decent sampler

Date2017-10-26 18:51
FromRichard
Subject[Csnd] Decent sampler
I wonder: has anyone ever built a decent sampler with csound? I'm 
thinking of multiple samples per octave (horizontal), multiple samples 
for loudness per note (vertical)?

Richard

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-10-26 21:42
FromMichael Gogins
SubjectRe: [Csnd] Decent sampler
The fluidsynth opcodes do exactly this using SoundFonts. You could do
this in Csound, but it would be a lot of work. In theory SoundFonts
can have 24 bit samples, not sure if the fluidsynth engine can use
that resolution. If so, or if 16 bit samples are satisfactory,
implementing in Csound would be reinventing the wheel. If not, Csound
could in theory render better audio.

You can create your own SoundFonts using your own samples using a
SoundFont editor such as http://polyphone-soundfonts.com/en/. This is
where you set up sample mappings and layerings.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Thu, Oct 26, 2017 at 1:51 PM, Richard  wrote:
> I wonder: has anyone ever built a decent sampler with csound? I'm thinking
> of multiple samples per octave (horizontal), multiple samples for loudness
> per note (vertical)?
>
> Richard
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2017-10-27 07:45
FromOeyvind Brandtsegg
SubjectRe: [Csnd] Decent sampler
I did something like this a few years back. Haven't looked at it in a while, but here are some code snippets that shows how I used note number and midi velocity to select the sample for each key/velocity combination.
I also had some velocity dependent filtering, assumedly to smooth out the transition between the soft, medium, and hard samples. Now I see that I did comment out the filtering, so not sure about the status of that.

best
Oeyvind


;*** load ftables
; *******************
;Vibes Samples
; *******************
giVibSoft_F2    ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibSoft_F2.wav",  0,  0,  0
giVibSoft_Bb2   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibSoft_Bb2.wav",  0,  0,  0
giVibSoft_Eb3   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibSoft_Eb3.wav",  0,  0,  0
giVibSoft_Ab3   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibSoft_Ab3.wav",  0,  0,  0
giVibSoft_Db4   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibSoft_Db4.wav",  0,  0,  0
giVibSoft_Gb4   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibSoft_Gb4.wav",  0,  0,  0
giVibSoft_Db5   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibSoft_Db5.wav",  0,  0,  0

giVibMed_F2     ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibMed_F2.wav",  0,  0,  0
giVibMed_Bb2    ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibMed_Bb2.wav",  0,  0,  0
giVibMed_Eb3    ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibMed_Eb3.wav",  0,  0,  0
giVibMed_Ab3    ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibMed_Ab3.wav",  0,  0,  0
giVibMed_Db4    ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibMed_Db4.wav",  0,  0,  0
giVibMed_Gb4    ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibMed_Gb4.wav",  0,  0,  0
giVibMed_Db5    ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibMed_Db5.wav",  0,  0,  0

giVibHard_F2    ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibHard_F2.wav",  0,  0,  0
giVibHard_Bb2   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibHard_Bb2.wav",  0,  0,  0
giVibHard_Eb3   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibHard_Eb3.wav",  0,  0,  0
giVibHard_Ab3   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibHard_Ab3.wav",  0,  0,  0
giVibHard_Db4   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibHard_Db4.wav",  0,  0,  0
giVibHard_Gb4   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibHard_Gb4.wav",  0,  0,  0
giVibHard_Db5   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibHard_Db5.wav",  0,  0,  0


; original cps for each sample 
giVibOrig       ftgen   0, 0, 512, -17, \
0,              174.609,        \
giVibMed_F2,    174.609,        \
giVibMed_Bb2,   233.069,        \
giVibMed_Eb3,   311.127,        \
giVibMed_Ab3,   415.293,        \
giVibMed_Db4,   554.334,        \
giVibMed_Gb4,   739.989,        \
giVibMed_Db5,   1108.668

; sample select, keyboard split
giVibKeySplitSoft       ftgen   0, 0, 128, -17, \
0,      giVibSoft_F2,   \
56,     giVibSoft_Bb2,  \
61,     giVibSoft_Eb3,  \
66,     giVibSoft_Ab3,  \
71,     giVibSoft_Db4,  \
76,     giVibSoft_Gb4,  \
81,     giVibSoft_Db5

giVibKeySplitMed        ftgen   0, 0, 128, -17, \
0,      giVibMed_F2,    \
56,     giVibMed_Bb2,   \
61,     giVibMed_Eb3,   \
66,     giVibMed_Ab3,   \
71,     giVibMed_Db4,   \
76,     giVibMed_Gb4,   \
81,     giVibMed_Db5

giVibKeySplitHard       ftgen   0, 0, 128, -17, \
0,      giVibHard_F2,   \
56,     giVibHard_Bb2,  \
61,     giVibHard_Eb3,  \
66,     giVibHard_Ab3,  \
71,     giVibHard_Db4,  \
76,     giVibHard_Gb4,  \
81,     giVibHard_Db5

; velocity switch, choose which keysplit ftable to use
giVibVelocitySplit      ftgen  0, 0, 128, -17, \
0,      giVibKeySplitSoft,      \
50,     giVibKeySplitMed,       \
100,    giVibKeySplitHard

; filtering, dependend on velocity split
; table indexed by velocity value
; values in this table represent overtone series of fundamental to be filtered 
; (starting at value zero for fundamental freq)
; format: fund index fund zero
giVibVelocityFilt  ftgen   0, 128, -5,  \ 
10,     50,     50,     0,      \
2,      50,     50,     0,      \
2,      28,     50      

;*** part of the instrument code
;*************************************
inum notnum
icps cpsmidi
inum notnum
ivel veloc
amp linenr 1, 0.001, 0.1, .001 

; sample select, from midi note number (and velocity)
ivelKeyFt table ivel, giVibVelocitySplit ; velocity split choosing keysplit ftable 
ifno table inum, ivelKeyFt ; keysplit choosing sample ftable 
ifno1 table inum, giVibKeySplitMed ; use static (non-velocity) ftable for original key of the samples
iorig table ifno1, giVibOrig
;ifilt table ivel, giVibVelocityFilt
;ifilt = icps + (ifilt*icps) + 1000
;ifilt = (ifilt > 21000 ? 21000 : ifilt)
;ifamp = (iVel < 50 ? 0.7 : 1.0)
;ifamp = (iVel > 100 ? 1.7 : ifamp)
a1 loscil amp, icps, ifno, iorig


2017-10-26 19:51 GMT+02:00 Richard <zappfinger@gmail.com>:
I wonder: has anyone ever built a decent sampler with csound? I'm thinking of multiple samples per octave (horizontal), multiple samples for loudness per note (vertical)?

Richard

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
       https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here



--
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2017-10-27 09:06
FromRichard van Bemmelen
SubjectRe: [Csnd] Decent sampler
Thanks Michael, I forgot about creating SoundFonts.

Richard

2017-10-26 22:42 GMT+02:00 Michael Gogins <michael.gogins@gmail.com>:
The fluidsynth opcodes do exactly this using SoundFonts. You could do
this in Csound, but it would be a lot of work. In theory SoundFonts
can have 24 bit samples, not sure if the fluidsynth engine can use
that resolution. If so, or if 16 bit samples are satisfactory,
implementing in Csound would be reinventing the wheel. If not, Csound
could in theory render better audio.

You can create your own SoundFonts using your own samples using a
SoundFont editor such as http://polyphone-soundfonts.com/en/. This is
where you set up sample mappings and layerings.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Thu, Oct 26, 2017 at 1:51 PM, Richard <zappfinger@gmail.com> wrote:
> I wonder: has anyone ever built a decent sampler with csound? I'm thinking
> of multiple samples per octave (horizontal), multiple samples for loudness
> per note (vertical)?
>
> Richard
>
> Csound mailing list
> Csound@listserv.heanet.ie
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2017-10-27 09:07
FromRichard van Bemmelen
SubjectRe: [Csnd] Decent sampler
Interesting, I will have a look..

Richard

2017-10-27 8:45 GMT+02:00 Oeyvind Brandtsegg <oyvind.brandtsegg@ntnu.no>:
I did something like this a few years back. Haven't looked at it in a while, but here are some code snippets that shows how I used note number and midi velocity to select the sample for each key/velocity combination.
I also had some velocity dependent filtering, assumedly to smooth out the transition between the soft, medium, and hard samples. Now I see that I did comment out the filtering, so not sure about the status of that.

best
Oeyvind


;*** load ftables
; *******************
;Vibes Samples
; *******************
giVibSoft_F2    ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibSoft_F2.wav",  0,  0,  0
giVibSoft_Bb2   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibSoft_Bb2.wav",  0,  0,  0
giVibSoft_Eb3   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibSoft_Eb3.wav",  0,  0,  0
giVibSoft_Ab3   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibSoft_Ab3.wav",  0,  0,  0
giVibSoft_Db4   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibSoft_Db4.wav",  0,  0,  0
giVibSoft_Gb4   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibSoft_Gb4.wav",  0,  0,  0
giVibSoft_Db5   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibSoft_Db5.wav",  0,  0,  0

giVibMed_F2     ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibMed_F2.wav",  0,  0,  0
giVibMed_Bb2    ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibMed_Bb2.wav",  0,  0,  0
giVibMed_Eb3    ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibMed_Eb3.wav",  0,  0,  0
giVibMed_Ab3    ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibMed_Ab3.wav",  0,  0,  0
giVibMed_Db4    ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibMed_Db4.wav",  0,  0,  0
giVibMed_Gb4    ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibMed_Gb4.wav",  0,  0,  0
giVibMed_Db5    ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibMed_Db5.wav",  0,  0,  0

giVibHard_F2    ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibHard_F2.wav",  0,  0,  0
giVibHard_Bb2   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibHard_Bb2.wav",  0,  0,  0
giVibHard_Eb3   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibHard_Eb3.wav",  0,  0,  0
giVibHard_Ab3   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibHard_Ab3.wav",  0,  0,  0
giVibHard_Db4   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibHard_Db4.wav",  0,  0,  0
giVibHard_Gb4   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibHard_Gb4.wav",  0,  0,  0
giVibHard_Db5   ftgen   0, 0, 0, 1, "samples/singlenotes/BlueVibHard_Db5.wav",  0,  0,  0


; original cps for each sample 
giVibOrig       ftgen   0, 0, 512, -17, \
0,              174.609,        \
giVibMed_F2,    174.609,        \
giVibMed_Bb2,   233.069,        \
giVibMed_Eb3,   311.127,        \
giVibMed_Ab3,   415.293,        \
giVibMed_Db4,   554.334,        \
giVibMed_Gb4,   739.989,        \
giVibMed_Db5,   1108.668

; sample select, keyboard split
giVibKeySplitSoft       ftgen   0, 0, 128, -17, \
0,      giVibSoft_F2,   \
56,     giVibSoft_Bb2,  \
61,     giVibSoft_Eb3,  \
66,     giVibSoft_Ab3,  \
71,     giVibSoft_Db4,  \
76,     giVibSoft_Gb4,  \
81,     giVibSoft_Db5

giVibKeySplitMed        ftgen   0, 0, 128, -17, \
0,      giVibMed_F2,    \
56,     giVibMed_Bb2,   \
61,     giVibMed_Eb3,   \
66,     giVibMed_Ab3,   \
71,     giVibMed_Db4,   \
76,     giVibMed_Gb4,   \
81,     giVibMed_Db5

giVibKeySplitHard       ftgen   0, 0, 128, -17, \
0,      giVibHard_F2,   \
56,     giVibHard_Bb2,  \
61,     giVibHard_Eb3,  \
66,     giVibHard_Ab3,  \
71,     giVibHard_Db4,  \
76,     giVibHard_Gb4,  \
81,     giVibHard_Db5

; velocity switch, choose which keysplit ftable to use
giVibVelocitySplit      ftgen  0, 0, 128, -17, \
0,      giVibKeySplitSoft,      \
50,     giVibKeySplitMed,       \
100,    giVibKeySplitHard

; filtering, dependend on velocity split
; table indexed by velocity value
; values in this table represent overtone series of fundamental to be filtered 
; (starting at value zero for fundamental freq)
; format: fund index fund zero
giVibVelocityFilt  ftgen   0, 128, -5,  \ 
10,     50,     50,     0,      \
2,      50,     50,     0,      \
2,      28,     50      

;*** part of the instrument code
;*************************************
inum notnum
icps cpsmidi
inum notnum
ivel veloc
amp linenr 1, 0.001, 0.1, .001 

; sample select, from midi note number (and velocity)
ivelKeyFt table ivel, giVibVelocitySplit ; velocity split choosing keysplit ftable 
ifno table inum, ivelKeyFt ; keysplit choosing sample ftable 
ifno1 table inum, giVibKeySplitMed ; use static (non-velocity) ftable for original key of the samples
iorig table ifno1, giVibOrig
;ifilt table ivel, giVibVelocityFilt
;ifilt = icps + (ifilt*icps) + 1000
;ifilt = (ifilt > 21000 ? 21000 : ifilt)
;ifamp = (iVel < 50 ? 0.7 : 1.0)
;ifamp = (iVel > 100 ? 1.7 : ifamp)
a1 loscil amp, icps, ifno, iorig


2017-10-26 19:51 GMT+02:00 Richard <zappfinger@gmail.com>:
I wonder: has anyone ever built a decent sampler with csound? I'm thinking of multiple samples per octave (horizontal), multiple samples for loudness per note (vertical)?

Richard

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
       https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here



--
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here