Close

All that Glitters

A project log for Rubidium 2.0

This is an all in one spectrum and logic analyzer, robotics control platform, and modular synthesizer with audio in and sheet music out!

glgormanglgorman 10/27/2021 at 11:470 Comments

Streaming hexadecimal data from the P2 Eval board which is using multiple DAC and ADC pins to generate various waveforms, which are being converted to analog and back, and then streamed at 2 Mbits/sec over USB to the application, which now has a "sheet music" style display which will be used to take a log-log plot of spectrum analyzer data which will (more or less) pick out any new peaks in each newly rendered frame.  Lots of work still remains, like having BPM detection would be nice, but is not a requirement, as BPM can simply be entered via a menu, so as to be able to get things running.  For example, as I demonstrated earlier, I showed how Bohemian Rhapsody has a second harmonic component of the British power line frequency in it at about -60db near the beginning of the song! 

 Once some of the code that does THAT sort of analysis is properly integrated into the Propeller Debug Terminal, then it will be possible to use the P2 as a real time audio analyzer, on the one hand, and as whatever else on the other - with an eye toward not just making another oscilloscope (64 channels at 200Mhz for digital signals in logic mode anyone?), but as an eventual platform for a Euro-Rack compatible PC or not-PC based modular synthesizer. 

 This is of course once again why it would be so nice to have C++, or Object Pascal on the P2 - for "self-hosting" purposes, which is certainly doable, but implementing a GUI in assembly language is not my cup of tea.  Much better therefore to simply write a compiler that will be able to generate code that has all of the required features.  As mentioned earlier - UCSD Pascal is mostly done, so that when I finish the body part I can look into either implementing a p-machine on the P2, now that I have most of what I need to do floating point, sets, and the various other intrinsic functions (such as mass storage, WRITELN, etc.)  that aren't a part of the UCSD distribution, and which need to be written or compiled to native form; whether I end up going the p-code route or entirely native or not.

 There is something very interesting that has come out of my digression into porting UCSD pascal, however, and that is something that is going to turn out to be very useful in the long run, now matter what high-level language I eventually use for building more aggressive applications that run directly on the P2 - and that is something that I discovered while porting the WRITELN function, so as to be able to run more of the Pascal compiler code relatively "unmodified",  by doing mostly simple find and replace conversion of Pascal keywords to C. 

 Where that will turn out to be useful will be because although the C language "var_args" function does not pass type information; I was able to implement a proxy class that automatically construct a "debug_param" object, where I eventually renamed the object's class: "s_param" in order to have a hint of LISP like s-expressions in the type name.  Thus, the s_param objects capture type information, allowing WRITELN to in effect be used not just for printing, but for PARSING - for example, streams of English commands like MOVETO, LINETO or ELLIPSE, such as the commands are spelled out in the Parallax Debug protocol, (or in OpenGL!) so that instead of trying to link the now converted Delphi code against some obscure '386 assembly, rather - why not use a TREESEARCH variant to identify tokens in the debug stream? 

 Even though I had to implement this myself. since it wasn't in the Pascal 'distro, it is clear now how the method can be extended (by which WRITELN was implemented) so as to specify which device is to be written to, i.e., by assigning each terminal window its own unique ID, which can be separate from its Microsoft based Window Handle or Window pointer. This would turn the old fashioned lowly Pascal WRITLEN command into a powerful asynchronous IO pipeline redirector with a built in command processor.  Therefore, by solving the problem of de-multiplexing the debug output from the Propeller chip (over USB!) this will also allow the creation of programs that can have multiple debug windows, oscilloscope displays, MIDI editors, sheet music, OpenGL, interactive text and so on - with an eye toward, as I said implementing a full GUI on the P2, or allowing Arduino programs that have multiple windows, and which otherwise work like other "GUI" based applications, even if the GUI part of those "aps" (in the Arduino case anyway) would be running on a PC, Tablet, Bluetooth or WIFI.

Now the Propeller or Arduino will actually do "something", and not just sit there and blink.

Discussions