Hello Mícheál, The ChucK language has a cast operator '$' which might come in handy in this situation
(pctPosInit/100*myBuf.samples()) $ int => myBuf.pos; Cheers, michael > On Jan 21, 2020, at 7:08 AM, Mícheál Ó Catháin <micheal.ocath...@gmail.com> > wrote: > > Hi > What is the best way to convert a float to int in the following please? > > //I want to set myBuf.pos to a percentage of myBuf.samples()... > //Start playing at say 40% through the total number of samples. > > 40.0 => float pctPosInit; > pctPosInit/100*myBuf.samples() => myBuf.pos; > > > This throws the error argument types don't match. > I'm not seeing how to convert the float to an int here. > Thanks for your help! > > Micheal > _______________________________________________ > chuck-users mailing list > chuck-users@lists.cs.princeton.edu > https://lists.cs.princeton.edu/mailman/listinfo/chuck-users _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users