Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

just one thing bothering me ..

For general discussion related FlowStone

just one thing bothering me ..

Postby HughBanton » Mon Nov 20, 2017 11:28 am

.. as Columbo used to say ;)

Can someone explain something to me .. ?

Attached is an fsm illustrating two methods or reading waves stored in an array. The top one I've used successfully in a project, and I was wondering yesterday if the bottom one would give the same result.

Needless to say for audio waves it doesn't, but I don't understand why not. I've used this exact arrangemnent elsewhere in the same project for extracting floats from arrays.

So I guess my question boils down to .. what exactly does the Array_to_Mem prim do to the numbers? What's the difference between a mem and a float_array and why is it needed for waves & samples?

Thanks in advance to Those Who Know These Things!

read_waves.fsm
(348 Bytes) Downloaded 1124 times
User avatar
HughBanton
 
Posts: 265
Joined: Sat Apr 12, 2008 3:10 pm
Location: Evesham, Worcestershire

Re: just one thing bothering me ..

Postby Spogg » Mon Nov 20, 2017 5:30 pm

I used to love Columbo, because you didn’t have to guess who dunnit, with all that complicated yet formulaic detective crap you get in normal crime dramas. And nobody could beat Peter Falk in that role.

Anyway, I’m not sure about the answer, but I think it’s because once you convert an array into a memory block you can then use other prims etc. to process the contents of the mem. It becomes a sort of common currency for the schematic, without having loads of green. If you don’t need this then the Array to Poly may be adequate and possibly faster.

I now wait for confirmation/clarification from others…

Cheers

Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: just one thing bothering me ..

Postby martinvicanek » Tue Nov 21, 2017 9:14 am

Differences:
- wave read will work in both poly and stream while float array to poly will only work in poly
- wave read can do stereo
- rounding seems to be different if you supply a fractional index
- also different behavior for index out of bounds
- float array to poly uses less CPU

Other than that they seem to be interchangeable (in poly).
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: just one thing bothering me ..

Postby HughBanton » Wed Nov 22, 2017 10:49 am

Thanks Martin.

CPU% improvement is what I'm after (inspired by your very own 'organ-proof-of-concept', which leaves everything I've ever done standing!!)(Oh .. I'll get back to that project some time soon .. winter nights incoming. If people ever let me return to my semi-retirement. Whatever that is).

I tried a direct substitution (FA2P in place of Wave Read) the other day, in my HB3 project, but got waveshape errors that I couldn't track down, but if you say it should be possible I will certainly try again. Every 0.1% helps - I've had considerable success in recent days elsewhere in the schematic substituting Assem modules - then pruning them; improved the CPU efficiency by at least 25% so far. Eventually I might even understand what I'm doing :-)

Question .. Stereo. So is Wave Read using MS Wave format, with a header?? Do I assume then that Wave Read looks for a header and does stereo/mono accordingly? My own wave data is just a string of 72 (mono) waveforms, butted end-to-end in a Float Array, 1 wave for each keyboard note. Different lengths, but that's all taken care of and has worked fine using Wave Read. But screws up with FA2P substitution; gets worse up the keybaoard, which is doubtless a clue.

Grateful for any more insights!
User avatar
HughBanton
 
Posts: 265
Joined: Sat Apr 12, 2008 3:10 pm
Location: Evesham, Worcestershire

Re: just one thing bothering me ..

Postby HughBanton » Wed Nov 22, 2017 6:03 pm

Possibly I have discovered another important difference between FA2P and Wave Read ..

I've had another go at the Wave Read >> FA2P substitution and concluded that the latter was only correctly playing waveforms from the bottom octave.

I then rigged up a test, and as far as I can tell FA2P will only read an array of maximum 2048 array entries. Who knew. Above that you get the array entry from address %2048 .. so presumably it's simply ignoring higher address bits.

My lower octave notes are all either 1024, 512, or 128 bytes in length each (depending on footage), so now all becomes clear.

In my quest for speed, Martin, would I gain from writing a dsp module with a memin input? I'm currently using a pair of Wave Reads with fractional interpolation (usual method), so I could incorporate that as well. Or would the pair of Wave Read prims perform as fast anyway?

Itza journey :shock:
User avatar
HughBanton
 
Posts: 265
Joined: Sat Apr 12, 2008 3:10 pm
Location: Evesham, Worcestershire

Re: just one thing bothering me ..

Postby Spogg » Thu Nov 23, 2017 9:29 am

Just to clarify…

Did you configure two FA2Ps for interpolation and get tuning errors? In fact exactly what was the issue with the “readout”?
It may be that the FA2P was intended for slower readout. The manual rarely says stuff like that. Maybe the prim has to re-evaluate the array for each step.
I can see a use for this, for example reading out a modulation shape like a special envelope or LFO. Dunno.

Cheers

Spogg
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: just one thing bothering me ..

Postby HughBanton » Thu Nov 23, 2017 11:52 pm

Hi Spogg,

No, as far as I can tell there's no problem with the speed of FA2P. (Martin states that FA2P uses less CPU than Wave Read, and can generally be subtituted). I did try configuring a pair of FA2Ps, interpolated, replacing my pair of Wave Reads, just as a simplification experiment.

But the problem was not tuning. Rather, I could see that I was only getting segments of my waves rather than the complete cycle - first 1/2 of it, 1/4 of it, 1/8 etc .. apart from in the bottom octave or so where it looked fine. (My CRT 'scope is usually attached!) And so I rigged up a test, which proved that FA2P can only read arrays up to 2048 entries .. so all is now explained. Evidently higher up the keyboard all I was getting was segments of those waves actually intended for the bottom notes, i.e. within the first 2048 enties.

I'm using FA2P all over 'HB3' without any problems, but in every case I'm using them just for extracting from arrays of length 72, indexed from my note number (0-71), one entry for each note. So no array size problem with that.

Yesterday I was working on a dsp module for the wave-read element, with a memin input, replaces the pair of Wave Reads and does the interpolation as well. Looking good.

Anyway ... yes I'm pretty sure you'd successfully maked an LFO or any other wave shape with FA2P, up to length 2048.

(Not of direct concern to me but I'm still wondering how Wave Read knows about Stereo & Mono wav files ...? )

later 8-)
User avatar
HughBanton
 
Posts: 265
Joined: Sat Apr 12, 2008 3:10 pm
Location: Evesham, Worcestershire

Re: just one thing bothering me ..

Postby martinvicanek » Fri Nov 24, 2017 2:01 am

HughBanton wrote:In my quest for speed, Martin, would I gain from writing a dsp module with a memin input? I'm currently using a pair of Wave Reads with fractional interpolation (usual method), so I could incorporate that as well. Or would the pair of Wave Read prims perform as fast anyway?

We have done something of that sort here. Yes, that method is faster, however those crashes remain. I got so frustrated that I stopped using memin entirely. Perhaps the forthcomming release will have some improvements there.
You can use a stereo wave read with the right channel delayed by one sample.That way you can retrieve the two consecutive values for linear interpolation in one go. ;) Or better still, store the values in the left channel and the slopes in the right channellike in the (attached schematic.
Attachments
Interpolated Wave Reader.fsm
(1.53 KiB) Downloaded 1059 times
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: just one thing bothering me ..

Postby HughBanton » Fri Nov 24, 2017 1:32 pm

Or better still, store the values in the left channel and the slopes in the right channellike in the (attached schematic.


Martin, that's really neat, I didn't know of that interp architecture. (Why didn't I think of that :o ) I glued your module into my HB3 and was easily able to make it work. I can now get rid of my more complicated int/fraction splitter.

'Slope' is actually the value difference between adjacent samples, yes? My 72 waveforms are generated within my own dll modules, so I can easily add a few lines to my C code to calculate all the difference values, and then interleave them to output an array exactly like this.

So my sole remaining question .. what's in a 'stereo' wav file that defines it as stereo or mono, so the Wave Read knows its format?

A million thanks
User avatar
HughBanton
 
Posts: 265
Joined: Sat Apr 12, 2008 3:10 pm
Location: Evesham, Worcestershire

Re: just one thing bothering me ..

Postby martinvicanek » Sat Nov 25, 2017 6:41 pm

HughBanton wrote:My 72 waveforms are generated within my own dll modules, so I can easily add a few lines to my C code to calculate all the difference values, and then interleave them to output an array exactly like this.
When you compute the slopes, make sure you get the ends of each waveform right. ;)
.. what's in a 'stereo' wav file that defines it as stereo or mono, so the Wave Read knows its format?
According to Wikipedia there is a <fmt-ck> format chunk in the file header which contains, among other things, the number of channels. Unless you want to generate wav files from your code, you don't have to bother. You can generate stereo mems within FS, refer to my post above.
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Next

Return to General

Who is online

Users browsing this forum: No registered users and 63 guests