Csound Csound-dev Csound-tekno Search About

Re: [Csnd] Porting Guitarix tube preamp models to Csound?

Date2014-04-07 20:16
From"vallste@libero.it"
SubjectRe: [Csnd] Porting Guitarix tube preamp models to Csound?
Yes, I was trying this but unfortunately it's still a noise generator.


>----Messaggio originale----
>Da: Victor.Lazzarini@nuim.ie
>Data: 07/04/2014 21.10
>A: 
>Ogg: Re: [Csnd] Porting Guitarix tube preamp models to Csound?
>
>In other words, removing the delayr/w,  we can have
>
>			aFtubeOld init 0
>			aIn_Ftube = aFtubeOld + aIn_tube - kVk0 
>				;
>				;itableValve;see table .cc
>				;ktablow see table .cc for the valve type
>				;ktabhigh see table .cc for the valve type
>				;ktabistep see table .cc for the valve type
>				;itabsize len of the table see table .cc for the valve type
>				aVgk = aIn_Ftube
>				af = (aVgk - ktablow) * ktabistep
>				ki = int(af)
>				if ki < 0 then
>					aFtube tab 0, itableValve
>				elseif ki >= itabsize then
>					aFtube tab itabsize - 1, itableValve
>				else
>					af = af - ki
>					kreadT1 tab ki, itableValve
>					kreadT2 tab ki + 1, itableValve
>					aFtube = kreadT1 * (1 - af) + kreadT2 * af
>				endif
>				;
>			aFtubeOut = (aFtube + aVkC - kvplus)
>			aFtubeOld butlp aFtubeOut * kRk/kRp, kfck
>
>
>On 7 Apr 2014, at 20:04, Victor Lazzarini wrote:
>
>> why the delay line? If it's a 1-sample delay you want to do, it's a bit 
cumbersome to use it for that.
>> It's simpler to do this (ksmps = 1), for example for a 1st order filter
>> 
>> adel init 0
>> ay = ain*ia + adel*ib
>> adel = ay
>> 
>> adel is a 1-sample feedback delay.
>> 
>> 
>> On 7 Apr 2014, at 18:07, vallste@libero.it wrote:
>> 
>>> Hello,
>>> I'm trying to port Gutarix tubes emulations to Csound ( I know that is 
possible to export as csound plugins but want to try the long way).
>>> Under Faust sources there are the examples
>>> http://sourceforge.net/p/faudiostream/code/ci/master/tree/examples/faust-
tubes/
>>> and data used for transfer functions for each tube model (files valve.h, 
tube.lib, preamp.dsp, and .cc files for tubes).
>>> 
>>> Attached here is my tentative udo (plus a couple tube emulations transfer 
funcions used by gen23) and a file to test it but everything I can obtain is a 
nice noise generator with only one stage of amplification, go figure what 
happen if you add more than one...Suspect that there is a problem on how I 
implemented recursion with delayw/r. 
>>> 
>>> Anyone would like to give a look to the code to see what I'm doing wrong?
>>> I've put output to disk in the tubetest.csd to avoid bad surpises to the 
speakers.
>>> 
>>> Bye
>>> Stefano
>>> <12ax7_250k.inc><12ax7_68k.inc><12at7_250k.
inc><12at7_68k.inc>
>> 
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> NUI Maynooth Ireland
>> tel.: +353 1 708 3545
>> Victor dot Lazzarini AT nuim dot ie
>> 
>> 
>> 
>> 
>> 
>> Send bugs reports to
>>        https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
csound"
>> 
>> 
>> 
>
>Dr Victor Lazzarini
>Senior Lecturer
>Dept. of Music
>NUI Maynooth Ireland
>tel.: +353 1 708 3545
>Victor dot Lazzarini AT nuim dot ie
>
>
>
>
>
>Send bugs reports to
>        https://github.com/csound/csound/issues
>Discussions of bugs and features can be posted here
>To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
csound"
>
>
>
>



Date2014-04-07 20:32
FromVictor Lazzarini
SubjectRe: [Csnd] Porting Guitarix tube preamp models to Csound?
Other areas that can be simplified:

Instead of implementing linear interpolation in the code, you can just use a linear
interp table reader, tabiei (in csound6  it accepts non-pow-of-two tables). 
All of these lines 

				ki = int(af)
				if ki < 0 then
					aFtube tab 0, itableValve
				elseif ki >= itabsize then
					aFtube tab itabsize - 1, itableValve
				else
					af = af - ki
					kreadT1 tab ki, itableValve
					kreadT2 tab ki + 1, itableValve
					aFtube = kreadT1 * (1 - af) + kreadT2 * af
				endif


get replaced by a single line

aFtube tablei af, itableValve


Victor
On 7 Apr 2014, at 20:16, vallste@libero.it wrote:

> Yes, I was trying this but unfortunately it's still a noise generator.
> 
> 
>> ----Messaggio originale----
>> Da: Victor.Lazzarini@nuim.ie
>> Data: 07/04/2014 21.10
>> A: 
>> Ogg: Re: [Csnd] Porting Guitarix tube preamp models to Csound?
>> 
>> In other words, removing the delayr/w,  we can have
>> 
>> 			aFtubeOld init 0
>> 			aIn_Ftube = aFtubeOld + aIn_tube - kVk0 
>> 				;
>> 				;itableValve;see table .cc
>> 				;ktablow see table .cc for the valve type
>> 				;ktabhigh see table .cc for the valve type
>> 				;ktabistep see table .cc for the valve type
>> 				;itabsize len of the table see table .cc for the valve type
>> 				aVgk = aIn_Ftube
>> 				af = (aVgk - ktablow) * ktabistep
>> 				ki = int(af)
>> 				if ki < 0 then
>> 					aFtube tab 0, itableValve
>> 				elseif ki >= itabsize then
>> 					aFtube tab itabsize - 1, itableValve
>> 				else
>> 					af = af - ki
>> 					kreadT1 tab ki, itableValve
>> 					kreadT2 tab ki + 1, itableValve
>> 					aFtube = kreadT1 * (1 - af) + kreadT2 * af
>> 				endif
>> 				;
>> 			aFtubeOut = (aFtube + aVkC - kvplus)
>> 			aFtubeOld butlp aFtubeOut * kRk/kRp, kfck
>> 
>> 
>> On 7 Apr 2014, at 20:04, Victor Lazzarini wrote:
>> 
>>> why the delay line? If it's a 1-sample delay you want to do, it's a bit 
> cumbersome to use it for that.
>>> It's simpler to do this (ksmps = 1), for example for a 1st order filter
>>> 
>>> adel init 0
>>> ay = ain*ia + adel*ib
>>> adel = ay
>>> 
>>> adel is a 1-sample feedback delay.
>>> 
>>> 
>>> On 7 Apr 2014, at 18:07, vallste@libero.it wrote:
>>> 
>>>> Hello,
>>>> I'm trying to port Gutarix tubes emulations to Csound ( I know that is 
> possible to export as csound plugins but want to try the long way).
>>>> Under Faust sources there are the examples
>>>> http://sourceforge.net/p/faudiostream/code/ci/master/tree/examples/faust-
> tubes/
>>>> and data used for transfer functions for each tube model (files valve.h, 
> tube.lib, preamp.dsp, and .cc files for tubes).
>>>> 
>>>> Attached here is my tentative udo (plus a couple tube emulations transfer 
> funcions used by gen23) and a file to test it but everything I can obtain is a 
> nice noise generator with only one stage of amplification, go figure what 
> happen if you add more than one...Suspect that there is a problem on how I 
> implemented recursion with delayw/r. 
>>>> 
>>>> Anyone would like to give a look to the code to see what I'm doing wrong?
>>>> I've put output to disk in the tubetest.csd to avoid bad surpises to the 
> speakers.
>>>> 
>>>> Bye
>>>> Stefano
>>>> <12ax7_250k.inc><12ax7_68k.inc><12at7_250k.
> inc><12at7_68k.inc>
>>> 
>>> Dr Victor Lazzarini
>>> Senior Lecturer
>>> Dept. of Music
>>> NUI Maynooth Ireland
>>> tel.: +353 1 708 3545
>>> Victor dot Lazzarini AT nuim dot ie
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Send bugs reports to
>>>       https://github.com/csound/csound/issues
>>> Discussions of bugs and features can be posted here
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
> csound"
>>> 
>>> 
>>> 
>> 
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> NUI Maynooth Ireland
>> tel.: +353 1 708 3545
>> Victor dot Lazzarini AT nuim dot ie
>> 
>> 
>> 
>> 
>> 
>> Send bugs reports to
>>       https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
> csound"
>> 
>> 
>> 
>> 
> 
> 
> 
> 
> Send bugs reports to
>        https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 
> 
> 

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie