Csound Csound-dev Csound-tekno Search About

[Csnd] empty string

Date2017-11-22 18:57
FromMenno Knevel
Subject[Csnd] empty string
Goode evening,
i'm using Blue - hence the  you see in the code here and there; they
are values of Blue widgets. The text however is all Csound.

I think my question is a more general one, so i ask it here.

I've made a effect, using Blue that is in the form of a UDO.
it is a ringmodulator i can choose between 5 options:
- sine
- saw
- square
- pulse
- soundfile

When i open the effect, there is not yet a soundfile present, so 'isamp' is
empty. Thing is, when i run it, i get no error, but the sine, square  etc.
don't work either. Result is complete silence...
I am looking for a trick that allows the soundfile to be empty but the other
waves should work.

I've tried with filevalid and srtlen >0 as you can see here, but it does not
do what i want.
This is the line that calls for the soundfile: 
elseif ( == 4) && (strlen("") > 0) then

here is part of the code:
isine	ftgentmp 0, 0, 16384, 10, 1
isaw	ftgentmp 0, 0, 16384, 10, 1, 0.5, 0.3, 0.25, 0.2, 0.167, 0.14, 0.125,
.111
isquare	ftgentmp 0, 0, 16384, 10, 1, 0, 0.3, 0, 0.2, 0, 0.14, 0, .111
ipulse  	ftgentmp 0, 0, 16384, 10, 1, 1, 1, 1, 0.7, 0.5, 0.3, 0.1
isamp	ftgentmp 0, 0, 0, 1, "", 0, 0, 0

kcarcoarse  =  * 1000                                          
;coarse tuning of freq
kcarrier    =    + kcarcoarse                                    
;add coarse and fine tuning together

if ( == 0) then                                                          
;provide sinoid for modulation
    acarrierL    poscil .5, kcarrier, isine, 0
    acarrierR    poscil .5, kcarrier, isine, .5
elseif ( == 1) then
    acarrierL    poscil .5, kcarrier, isaw, 0 
    acarrierR    poscil .5, kcarrier, isaw, .5                                         
elseif ( == 2) then
    acarrierL    poscil .5, kcarrier, isquare, 0
    acarrierR    poscil .5, kcarrier, isquare, .5
elseif ( == 3) then
    acarrierL    poscil .5, kcarrier, ipulse, 0
    acarrierR    poscil .5, kcarrier, ipulse, .5
elseif ( == 4) && (strlen("") > 0) then
    ichn filenchnls ""
    ilen filelen ""
    kbegin  =    * ilen + 0.05                                      
    kend    =    * ilen
        if (ichn == 1) then
            if (kbegin < kend) then
                acarrierL    flooper2 .8, , kbegin, kend, .1, isamp, 
i() * ilen
                acarrierR   =   acarrierL
            else
                acarrierL   =   0
                acarrierR   =   0
            endif
        else
            if (kbegin < kend) then
                ar1, ar2    flooper2 .8, , kbegin, kend, .1, isamp, 
i() * ilen
                acarrierL    =   (ar1 + ar2) * .6
                acarrierR   =   acarrierL
            else
                acarrierL   =   0
                acarrierR   =   0
            endif
        endif
;else
;                acarrierL   =   0
;                acarrierR   =   0
;endif

endif

Is there a nice solution so that the soundfile can remain empty and still
the other waves can do their ringmodulate stuff?



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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-11-22 20:57
FromJohn ff
SubjectRe: [Csnd] empty string
All outside my experience but filling a table with a nonexistent file should give an error, perhaps reflected in the value of isamp?
Quick read of code suggests it just gives an error.

⁣Sent from TypeApp ​

On Nov 22, 2017, 18:57, at 18:57, Menno Knevel  wrote:
>Goode evening,
>i'm using Blue - hence the  you see in the code here and there;
>they
>are values of Blue widgets. The text however is all Csound.
>
>I think my question is a more general one, so i ask it here.
>
>I've made a effect, using Blue that is in the form of a UDO.
>it is a ringmodulator i can choose between 5 options:
>- sine
>- saw
>- square
>- pulse
>- soundfile
>
>When i open the effect, there is not yet a soundfile present, so
>'isamp' is
>empty. Thing is, when i run it, i get no error, but the sine, square 
>etc.
>don't work either. Result is complete silence...
>I am looking for a trick that allows the soundfile to be empty but the
>other
>waves should work.
>
>I've tried with filevalid and srtlen >0 as you can see here, but it
>does not
>do what i want.
>This is the line that calls for the soundfile: 
>elseif ( == 4) && (strlen("") > 0) then
>
>here is part of the code:
>isine	ftgentmp 0, 0, 16384, 10, 1
>isaw	ftgentmp 0, 0, 16384, 10, 1, 0.5, 0.3, 0.25, 0.2, 0.167, 0.14,
>0.125,
>.111
>isquare	ftgentmp 0, 0, 16384, 10, 1, 0, 0.3, 0, 0.2, 0, 0.14, 0, .111
>ipulse  	ftgentmp 0, 0, 16384, 10, 1, 1, 1, 1, 0.7, 0.5, 0.3, 0.1
>isamp	ftgentmp 0, 0, 0, 1, "", 0, 0, 0
>
>kcarcoarse  =  * 1000                                  
>       
>;coarse tuning of freq
>kcarrier    =    + kcarcoarse                            
>       
>;add coarse and fine tuning together
>
>if ( == 0) then                                                  
>       
>;provide sinoid for modulation
>    acarrierL    poscil .5, kcarrier, isine, 0
>    acarrierR    poscil .5, kcarrier, isine, .5
>elseif ( == 1) then
>    acarrierL    poscil .5, kcarrier, isaw, 0 
>acarrierR    poscil .5, kcarrier, isaw, .5                             
>           
>elseif ( == 2) then
>    acarrierL    poscil .5, kcarrier, isquare, 0
>    acarrierR    poscil .5, kcarrier, isquare, .5
>elseif ( == 3) then
>    acarrierL    poscil .5, kcarrier, ipulse, 0
>    acarrierR    poscil .5, kcarrier, ipulse, .5
>elseif ( == 4) && (strlen("") > 0) then
>    ichn filenchnls ""
>    ilen filelen ""
>kbegin  =    * ilen + 0.05                                      
>    kend    =    * ilen
>        if (ichn == 1) then
>            if (kbegin < kend) then
>           acarrierL    flooper2 .8, , kbegin, kend, .1, isamp, 
>i() * ilen
>                acarrierR   =   acarrierL
>            else
>                acarrierL   =   0
>                acarrierR   =   0
>            endif
>        else
>            if (kbegin < kend) then
>            ar1, ar2    flooper2 .8, , kbegin, kend, .1, isamp, 
>i() * ilen
>                acarrierL    =   (ar1 + ar2) * .6
>                acarrierR   =   acarrierL
>            else
>                acarrierL   =   0
>                acarrierR   =   0
>            endif
>        endif
>;else
>;                acarrierL   =   0
>;                acarrierR   =   0
>;endif
>
>endif
>
>Is there a nice solution so that the soundfile can remain empty and
>still
>the other waves can do their ringmodulate stuff?
>
>
>
>--
>Sent from:
>http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
>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-11-23 18:46
FromMenno Knevel
SubjectRe: [Csnd] empty string
yes John, you are right. With no soundfile there is an error and the note is
deleted. isamp turns out to be zero in this case.
Have not found a way around this yet.



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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-11-23 18:52
FromJohn ff
SubjectRe: [Csnd] empty string
I thought there was an opcode to indicate a file's existence.  Not near the manual of sources just now to check.

⁣Sent from TypeApp ​

On Nov 23, 2017, 18:47, at 18:47, Menno Knevel  wrote:
>yes John, you are right. With no soundfile there is an error and the
>note is
>deleted. isamp turns out to be zero in this case.
>Have not found a way around this yet.
>
>
>
>--
>Sent from:
>http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
>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-11-23 18:55
FromMenno Knevel
SubjectRe: [Csnd] empty string
i think you mean filevalid.
I tried to implement this one as well, but to no avail...




--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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-11-23 19:23
FromRory Walsh
SubjectRe: [Csnd] empty string
Hi Menno. I usually use the filevalid opcode to check for the existence of a file, if it's valid I will use it with diskin, if not I just mute my audio variables. Is filevalid not working for you?

On 23 November 2017 at 18:55, Menno Knevel <magknevel@gmail.com> wrote:
i think you mean filevalid.
I tried to implement this one as well, but to no avail...




--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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-11-30 13:05
FromMenno Knevel
SubjectRe: [Csnd] empty string
Hi Rory. Yes, i think filevalid works well with diskin but i am using
flooper2.
Advantage of flooper2 is the fact that one can set a (tiny) looprange, so as
to avoid clicks in the loop. diskin does not have such a setting.
flooper2 refers to a soundfile that is present in a table so it must be
loaded beforehand. Checking with filvalid would always too late when a
soundfile is not there - at least, that is what i think i going on here.
And thus produce an error. Is my reasoning correct?




--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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-11-30 13:20
FromJohn ff
SubjectRe: [Csnd] empty string
Surely if you create the table in the orchestra you can use file valid before it to skip the table and set a variable to avoid the flooper2?  

⁣Sent from TypeApp ​

On Nov 30, 2017, 13:05, at 13:05, Menno Knevel  wrote:
>Hi Rory. Yes, i think filevalid works well with diskin but i am using
>flooper2.
>Advantage of flooper2 is the fact that one can set a (tiny) looprange,
>so as
>to avoid clicks in the loop. diskin does not have such a setting.
>flooper2 refers to a soundfile that is present in a table so it must be
>loaded beforehand. Checking with filvalid would always too late when a
>soundfile is not there - at least, that is what i think i going on
>here.
>And thus produce an error. Is my reasoning correct?
>
>
>
>
>--
>Sent from:
>http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
>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