BASICally: a new module for writing code within Rack

I’ve lost track. Do we have a system time ability in BASICally now?

Would be nice to have a function thingie there. Like in C. Function {}. So we could refer to function when needed. But that’s C stuff, not basic, I totally understand

I don’t think so… I usually use the timer modules by Nysthi. It works perfect and also there’s a big timer that you can see without zooming in too much

Are you sending the Nysthi times into BASICally inputs?

Nope. I am sending them to MindMeld mutes OR to the clock or something…

I think for timing purposes with basically the slow ramp could be useful. Like Rampage with expremely slow attack. And then you check the input value. Like if in1 > 0.2 do this… I forgot if there’s elseif. But if not, it’s like again checking the value. if in1 >0.5 do that. Blah blah. Or counting the beats. But that’s silly

You know what. There is a time thingie. But it’s in samples, I think… So you could convert it to seconds by multiplication. Like wait x where x = sample rate. That should be 1 second…

***I might be wrong about it though

******I wrote bitrate first. Sorry! I mean sample rate

@StochasticTelegraph

Hi Mahlen. Would it be possible to add a current and/or elapsed since start/reset system time? I’m playing around with creating an event scheduler and handler with BASICally. Having the system time to as high of resolution and precision as is available would be great. Whereas some events could be handled at 1ms resolution and precision, I can imagine a sample based event that could be handy.

Also, if I use arrays for an event queue, the array size is dynamic as elements are accessed. Can the array ever get smaller by deleting the last element? I’m not sure this makes sense. In Javascript I think I used lists for event handlers, but we do not have anything like lists here, do we?

Thanks for considering this.

I think this is a straighforward elapsed-since-start time indicator:

ALSO
sample = sample + 1
sec = sample / sample_rate()
END ALSO

If you want this to be aware of RESETs (or any other condition), then just set sample = 0 before doing in that condition.

...
sample = 0
RESET
...

With regard to arrays, there is no notion of “deleting” or “length”, really. This springs from the design goal of “not having runtime failures”, i.e., BASICally can never say, “whoa, your program is wrong, I’m going to stop”. In practice, this means that a[foo] will return something no matter what foo is, but it may not be the something the programmer wanted.

If the size of an array has meaning in your context, then I would either track it in a separate variable (a_size = …) or put a semaphore value where ever you deem the end of the queue to be.

StopValue = -123456  ' Not a valid event value.
...
for i = 0 to 1000
  ' Process events.
  if a[i] == StopValue THEN
    EXIT FOR
  ELSE
.....

@Andre_M I’ve considered functions, because, yeah, they’re pretty great, buuut…I’ve been working on BASICally daily for 3+ months now, and after this next release I’ve promised myself that I’m going to set it aside for a long while to do other things. Maybe someone else will make that Lua module? EvaLUAtor, anyone?

4 Likes

Yeah! Sure! Take a rest. It works nice, I haven’t seen any bugs or anything, so you probably can put it on the shelf for few months at least if not forever, haha. Functions are great and all, but maybe it wouldn’t be Basic anymore and therefore it wouldn’t be as simple as it is now

Thanks. I will play with the sample count method for time and your suggested semaphore array end indicator.

As I was experimenting with sample counts and time, I chased an issue for about an hour until I finally read the manual and see that outputs 1-4 are clamped to ±10.0 , whereas the inputs are not clamped. I understand why you did this, but it does limit the ability of BASICally to share it’s calculations with other modules. I was just trying to output calculation results to debug what I was doing in the script.

In an ideal world, it would be great if there could be at least one unclamped output, perhaps labeled as such for volume safety.

Am I overlooking some way to get unclamped values out of BASICally?

You know, I’ve been surprised by that as well! I’ll likely add OUT5 and OUT6 soon, and maybe OUT6 will be unclamped?

Also, regarding that sample-counting thing I suggested, there is an upper bound on the significant digits in C++ floats, so at some point I think that will manifest as an inability to accurately add ‘1’ to it? I’m not sure how many seconds out that would be, but I also don’t know how long this would be running (if you figure it out, I’d be curious). An alternative time-keeping system might be.

ALSO
sample = sample + 1
IF sample == sample_rate() THEN
  second = second + 1
  sample = 0
END IF
END ALSO
...

And if you care about sub-second times, then second + sample / sample_rate() is the full measure.

1 Like

I think that would be great.

Perhaps even better would be options to let the user pick which outputs are clamped, regardless how many you choose to support.

Most modules I have seen do this via the module context menu. But with a module like BASICally you can add syntax to your language to configure the port in user supplied “BASIC” code.

1 Like

In the meantime while waiting for an unclamped output does LOG(x) work so you could send out the log of the value and in another module do 10^x?

2 Likes

Good idea! I will have to check. I was considering scaling the value but did not specifically think of using LOG(x) and 10^x .

Thanks!

Cool idea.

I think the Submarine AO-101 is a good candidate to perform the 10^x operation. If I remember correctly, those arithmetic operator modules do not clamp the output (but I’m not positive)

Or AO-106 if you need up to 6 unclamped outputs

1 Like

Yes, those are my go-to math modules. Thanks for reminding me.

Oops. BASICally has no LOG() function.

Ha! Yes, perhaps divide by 1,000,000? (or whatever scales your output below +10V). I assume you’re going to be reading the value by mousing over the cable? If that’s the case, then mentally shifting six places over might be easier than doing e^x.

Or are there visualization tools that can accept super high voltages?

Volt Meter can handle super high voltages, as can NYSTHI MULTIVOLTIMETRO.