Possible to get the detected pitch from pitch detector?

Pixilang programming language
Post Reply
philipbergwerf
Posts: 174
Joined: Sat Mar 17, 2018 4:23 pm

Possible to get the detected pitch from pitch detector?

Post by philipbergwerf »

Possible to get the detected pitch from pitch detector? and how?

Code: Select all

// create sunvox object
sv = sv_new()

// place and connect modules
sv_lock(sv)
sv_new_module(sv,"Input","Input",300,512) // 1
sv_new_module(sv,"Pitch Detector","Pitch Detector",400,512) // 2
sv_connect_module(sv,1,2)
sv_unlock(sv)


input = 1
pitch_detector = 2

while 1
{
    // Wait for the EVT_QUIT event
    while( get_event() ) 
    { 
        if EVT[ EVT_TYPE ] == EVT_QUIT 
        { 
            breakall
        } 
    }

    // get the detected pitch from the pitch detector module
    // $pitch = ??
}

sv_remove(sv)
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: Possible to get the detected pitch from pitch detector?

Post by NightRadio »

No direct way, but you can use the following trick :)
Pitch Detector -> Pitch2Ctl (mode=0;OUT controller=1) -> MultiCtl
then use sv_get_module_ctl_value( slot, multictl_mod, 0, 0 ) to get the value of controller 1 of the MultiCtl module
Post Reply