Hi!
pixilang cannot feed audio into the 'input'-module or any module inside a sunvox module
It's possible too :)
See the file examples/c/test5.c (using SunVox as a filter for some user-generated signa) in the SunVox library archive.
Pixilang-version of this example will look very similar.
Unfortunately, I don't have time yet to port this example to Pixilang, but I will definitely do it soon.
So that leaves me to process audio input using the native `audio_callback`-approach.
Is this approach fast enough?
No and yes :)
It will not be very fast (with a lot of CPU usage, especially on the mobile devices) if you write signal processing in the "bare" Pixilang, using built-in operators. For example:
Code: Select all
$i = 0 while $i < $frames
{
$out[ $i ] = $in[ $i ] * $volume
$i + 1
}
Such code will be translated to the Pixilang bytecode, which will be executed in the Pixilang virtual machine.
Pixilang bytecode speed is much slower (from 10 to 150 times) the speed of the same code generated by the C/C++ compiler.
But...
You can use the block data processing functions, like op_cn, op_cc, op_ccn, sampler, fft, apply_filter, etc.
In this case, most of the load will fall on these built-in functions, which will execute at the native speed of machine code.
And the execution speed will be close to the speed of the same C/C++ code.
Example:
Code: Select all
copy( $out, $in, 0, 0, $frames )
op_cn( OP_MUL, $out, $volume, 0, $frames )
Block data processing functions:
https://warmplace.ru/soft/pixilang/manual.php#dataproc
List of data processing operations for op_cn(), op_cc() and op_ccn():
https://warmplace.ru/soft/pixilang/manual.php#cdproc