David Akbari wrote:
> How very interesting. I was able to reproduce this idea on the mac os by
> creating a disk image file of samples (a filesystem in memory like you
> said, *.dmg, which contained linear PCM encoded samples (.aiff, .wav))
> and buffersizes (-bx -Bx) of both x=128 and x=1024.
When referring to smaller buffer size, I meant the buffer size for
the soundin or diskin2 opcode, which is 2048 and 4096 mono samples
by default, respectively. Reducing the buffer size does not improve
the overall CPU usage, but makes it more evenly distributed and
possibly more friendly to low latency real time usage. However, on
a machine with very fast memory, this may not actually make a
> Would the comparison have been more accurate if tablei was used instead?
> (In other words, which type of interpolation is diskin2 using ... linear?)
diskin2 can use several interpolation types, including linear, cubic,
and sinc (with anti-aliasing) with number of samples ranging from 8 to
1024, as well as no interpolation. The default is cubic interpolation.
> I think it may be useful to see how diskin2 performs without
> interpolation. Perhaps appending an o-arg to diskin2 which is a boolean
> (default=1) to whether or not to use interpolation ?
It already has the "window size" parameter that selects interpolation
8 to 1024: sinc
However, for simple, fast non-interpolated reading of sound files,
soundin is preferred, unless you need resampling or the "wrap" feature
of the diskin opcodes.
> In what ways is it now possible to use S-variables and
> diskin2/soundin(s) to achieve a variable loading mechanism? Is it legal
> to just use:
> Sfile = "filename"
> aOut diskin2 Sfile, 1, 0, 1
Yes. soundin, diskin, and diskin2 evaluate the file name at i-time only,
though, so if you change it at k-rate you may need to use reinit to
make the opcodes switch to the new file.
In general, you can use a string variable as input argument to any
opcode that would require a "quoted string" according to the manual,
just remember that some opcodes may not respond well to the string
being changed at k-rate and using reinit may be needed.
> Are there currently any GEN routines that deal with the
> storage/retrieval of S-vars? Is it problematic to use GEN23 for this
Not yet, but the idea sounds interesting. Do you mean loading and
storing characters of a string from/to a function table (that is,
"foo" would translate to the four table values 102, 111, 111, 0) ?
Of course, you already have strset that is basically a global table
(rather like ZAK) of string values which can be read and written
with strget and strset, and sound I/O opcodes can also access the
strset table by specifying a number index instead of a string name.