Csound Csound-dev Csound-tekno Search About

[Cs-dev] sfplay issue

Date2010-07-26 12:19
Frommenno
Subject[Cs-dev] sfplay issue
Hello all,

i have a question about the soundfont instrument sfplay.
According to the text about the velocity:

"sfplay plays a preset, generating a stereo sound. ivel does not directly
affect the amplitude of the output, but informs sfplay about which sample
should be chosen in multi-sample, velocity-split presets. "

Normally playing a keyboard giving a velocity of 10 would be a lot less loud
than a velocity of 100, that it would have an effect on the amplitude. And
perhaps, when there are velocity-splits, the appropriate sample should be
chosen.
I guess it is not in its design and perhaps the Fluidopcodes are the ones to
be chosen for this kind of work, but is there a way to redesign sfplay and
friends so that when playing a keyboard it reacts to its velocity?

thank you,
Menno




; Select audio/midi flags here according to platform
; Audio out   Audio in    No messages
-odac           -iadc     -d   -M0     ;;;RT audio I/O, midi in
; For Non-realtime ouput leave only the line below:
; -o sfplay.wav -W ;;; for file output any platform



sr         = 44100
ksmps = 100
nchnls = 2

isf	sfload	"/manual/examples/01hpschd.sf2"
	sfilist		isf
	sfplist	isf
	sfpassign	0, isf

	instr 1
; play from score and midi keyboard
	mididefault		60, p3
	midinoteonkey	p4, p5
inum	init	p4
ivel	init	p5
print	ivel

iamp	init	15							; pre-amplify
kamp	linsegr	1,1,1,.1,0
kfreq	init	1							;do not change freq from sf
a1,a2	sfplay	ivel, inum, kamp*iamp, kfreq, 0, 0
	outs	a1, a2
	
	endin
	


f0  60				; stay active for 1 minute

;i1 0 1 60 100
;i1 + 1 62 100
;i1 2 .5 65 80
;i1 2 .5 69 80
i1 0 1 60 100
i1 + 1 60 <
i1 + 1 60 <
i1 + 1 60 10



-- 
View this message in context: http://csound.1045644.n5.nabble.com/sfplay-issue-tp2227902p2227902.html
Sent from the Csound - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-07-26 12:31
FromVictor Lazzarini
SubjectRe: [Cs-dev] sfplay issue
You just add some code to scale the amplitude of the signal  
accordingly. Maybe your
envelope can do that:

iamp = 15*(ivel/127)   ; not sure why '15' but there you go


Victor

On 26 Jul 2010, at 12:19, menno wrote:

>
> Hello all,
>
> i have a question about the soundfont instrument sfplay.
> According to the text about the velocity:
>
> "sfplay plays a preset, generating a stereo sound. ivel does not  
> directly
> affect the amplitude of the output, but informs sfplay about which  
> sample
> should be chosen in multi-sample, velocity-split presets. "
>
> Normally playing a keyboard giving a velocity of 10 would be a lot  
> less loud
> than a velocity of 100, that it would have an effect on the  
> amplitude. And
> perhaps, when there are velocity-splits, the appropriate sample  
> should be
> chosen.
> I guess it is not in its design and perhaps the Fluidopcodes are the  
> ones to
> be chosen for this kind of work, but is there a way to redesign  
> sfplay and
> friends so that when playing a keyboard it reacts to its velocity?
>
> thank you,
> Menno
>
>
> 
> 
> ; Select audio/midi flags here according to platform
> ; Audio out   Audio in    No messages
> -odac           -iadc     -d   -M0     ;;;RT audio I/O, midi in
> ; For Non-realtime ouput leave only the line below:
> ; -o sfplay.wav -W ;;; for file output any platform
> 
> 
>
> sr         = 44100
> ksmps = 100
> nchnls = 2
>
> isf	sfload	"/manual/examples/01hpschd.sf2"
> 	sfilist		isf
> 	sfplist	isf
> 	sfpassign	0, isf
>
> 	instr 1
> ; play from score and midi keyboard
> 	mididefault		60, p3
> 	midinoteonkey	p4, p5
> inum	init	p4
> ivel	init	p5
> print	ivel
>
> iamp	init	15							; pre-amplify
> kamp	linsegr	1,1,1,.1,0
> kfreq	init	1							;do not change freq from sf
> a1,a2	sfplay	ivel, inum, kamp*iamp, kfreq, 0, 0
> 	outs	a1, a2
> 	
> 	endin
> 	
> 
> 
> f0  60				; stay active for 1 minute
>
> ;i1 0 1 60 100
> ;i1 + 1 62 100
> ;i1 2 .5 65 80
> ;i1 2 .5 69 80
> i1 0 1 60 100
> i1 + 1 60 <
> i1 + 1 60 <
> i1 + 1 60 10
> 
> 
>
> -- 
> View this message in context: http://csound.1045644.n5.nabble.com/sfplay-issue-tp2227902p2227902.html
> Sent from the Csound - Dev mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://ad.doubleclick.net/clk;226879339;13503038;l?
> http://clk.atdmt.com/CRS/go/247765532/direct/01/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-07-26 12:39
Frommenno
SubjectRe: [Cs-dev] sfplay issue
yes of course, i see. I learn a lot these days, thank you.
And i had to make iamp = 15 because even with a BIG chord the overall amps
were still not near 30000.

bye,
Menno

-- 
View this message in context: http://csound.1045644.n5.nabble.com/sfplay-issue-tp2227902p2227923.html
Sent from the Csound - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net