SpinCAD Designer

Algorithm development and general DSP issues

Moderator: frank

Post Reply

Look interesting?

Poll ended at Tue May 07, 2013 10:43 am

Yes
7
100%
No
0
No votes
 
Total votes: 7

Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

SpinCAD Designer

Post by Digital Larry »

Hello everyone,

Thought I would let you know that I have been working on a program that should make developing programs for the FV-1 a lot more approachable for many people. Even though I have an electrical engineering degree and did actually study DSP theory for more than a year I still find myself scratching my head when muddling through how the algorithms work.

Here's a screenshot of the main screen of SpinCAD Designer:

Image

Uploaded with ImageShack.us

There are a bunch of menus which allow you to select predefined functional blocks. So far I have single and multitap delays, reverbs, chorus, phaser, a few distortions, etc. which I have taken from various examples and postings in this forum.

You link the blocks together and click on a button and it generates the program for you. At the bottom you have an indication of how many instructions, registers, and how much delay memory is consumed by the current program.

I must give a major shout out to Andrew Kilpatrick, who wrote the ElmGen DSP Java library upon which the SpinCAD Designer is based. Andrew's open-source library can be found here:

http://www.andrewkilpatrick.org/?p=elmgen

Andrew's work started by recreating Spin ASM as a set of Java functions. After I used it for awhile I realized that the object oriented nature of Java would work really well for building this type of CAD program on top of it. Andrew's program also features a simulator, so that you can preview the effect on your PC first (I haven't tried it on Mac yet).

One drawback as it stands is that you'd need to hack together an Arduino as Andrew has shown in order to program the Spin FV-1 dev board (or one presumes, one of the SKRM modules) using I2C. However, the CAD system can also spit out code which could be run through the Spin Assembler so those of you who are already programming using Spin ASM could still do it, although with a 2 step process.

For example, the algorithm shown above generated the ElmGen code:

Code: Select all

80200011 - Skip(10,1)
200FFFF2 - LoadSinLFO(1,0,32767)
40000244 - ReadRegister(18,1.0)
39990584 - ReadRegister(44,0.9)
00000586 - WriteRegister(44,0.0)
40000224 - ReadRegister(17,1.0)
0000022A - Mulx(17)
0CCC028D - ScaleOffset(0.2,0.02)
00000046 - WriteRegister(2,0.0)
C2200014 - ChorusReadValue(1)
2000400D - ScaleOffset(0.5,0.5)
2000000B - Log(0.5,0.0)
4000000C - Exp(1.0,0.0)
4000C00D - ScaleOffset(1.0,-0.5)
7FEF000D - ScaleOffset(1.999,0.0)
0000024A - Mulx(18)
06666CCD - ScaleOffset(0.1,0.85)
00000406 - WriteRegister(32,0.0)
40000444 - ReadRegister(34,1.0)
40000546 - WriteRegister(42,1.0)
0000040A - Mulx(32)
01000284 - ReadRegister(20,0.015625)
C0000446 - WriteRegister(34,-1.0)
0000040A - Mulx(32)
40000544 - ReadRegister(42,1.0)
00000566 - WriteRegister(43,0.0)
40000464 - ReadRegister(35,1.0)
40000546 - WriteRegister(42,1.0)
0000040A - Mulx(32)
40000564 - ReadRegister(43,1.0)
C0000466 - WriteRegister(35,-1.0)
0000040A - Mulx(32)
40000544 - ReadRegister(42,1.0)
00000566 - WriteRegister(43,0.0)
40000484 - ReadRegister(36,1.0)
40000546 - WriteRegister(42,1.0)
0000040A - Mulx(32)
40000564 - ReadRegister(43,1.0)
C0000486 - WriteRegister(36,-1.0)
0000040A - Mulx(32)
40000544 - ReadRegister(42,1.0)
00000566 - WriteRegister(43,0.0)
400004A4 - ReadRegister(37,1.0)
40000546 - WriteRegister(42,1.0)
0000040A - Mulx(32)
40000564 - ReadRegister(43,1.0)
C00004A6 - WriteRegister(37,-1.0)
0000040A - Mulx(32)
40000544 - ReadRegister(42,1.0)
00000566 - WriteRegister(43,0.0)
400004C4 - ReadRegister(38,1.0)
40000546 - WriteRegister(42,1.0)
0000040A - Mulx(32)
40000564 - ReadRegister(43,1.0)
C00004C6 - WriteRegister(38,-1.0)
0000040A - Mulx(32)
40000544 - ReadRegister(42,1.0)
00000566 - WriteRegister(43,0.0)
400004E4 - ReadRegister(39,1.0)
40000546 - WriteRegister(42,1.0)
0000040A - Mulx(32)
40000564 - ReadRegister(43,1.0)
C00004E6 - WriteRegister(39,-1.0)
0000040A - Mulx(32)
40000544 - ReadRegister(42,1.0)
00000566 - WriteRegister(43,0.0)
40000504 - ReadRegister(40,1.0)
40000546 - WriteRegister(42,1.0)
0000040A - Mulx(32)
40000564 - ReadRegister(43,1.0)
C0000506 - WriteRegister(40,-1.0)
0000040A - Mulx(32)
40000544 - ReadRegister(42,1.0)
00000566 - WriteRegister(43,0.0)
40000524 - ReadRegister(41,1.0)
40000546 - WriteRegister(42,1.0)
0000040A - Mulx(32)
40000564 - ReadRegister(43,1.0)
C0000526 - WriteRegister(41,-1.0)
0000040A - Mulx(32)
40000544 - ReadRegister(42,1.0)
8000000D - ScaleOffset(-2.0,0.0)
8000000D - ScaleOffset(-2.0,0.0)
8000000D - ScaleOffset(-2.0,0.0)
8000000D - ScaleOffset(-2.0,0.0)
8000000D - ScaleOffset(-2.0,0.0)
8000000D - ScaleOffset(-2.0,0.0)
0000058A - Mulx(44)
40000284 - ReadRegister(20,1.0)
40000426 - WriteRegister(33,1.0)
400002A4 - ReadRegister(21,1.0)
0000024A - Mulx(18)
1CCC02A4 - ReadRegister(21,0.45)
400005C6 - WriteRegister(46,1.0)
100005A4 - ReadRegister(45,0.25)
500005E5 - ReadRegisterFilter(47,1.25)
400005E7 - WriteRegisterHighshelf(47,1.0)
30000002 - WriteDelay(0,0.75)
16609240 - ReadDelay(1170,0.35)
1660F460 - ReadDelay(1955,0.35)
1661B8E0 - ReadDelay(3527,0.35)
03427D40 - ReadDelay(5098,0.051)
03440620 - ReadDelay(8241,0.051)
0344CCE0 - ReadDelay(9831,0.051)
000005A6 - WriteRegister(45,0.0)
400005A4 - ReadRegister(45,1.0)
0000024A - Mulx(18)
400005C4 - ReadRegister(46,1.0)
40000626 - WriteRegister(49,1.0)
00000606 - WriteRegister(48,0.0)
40000424 - ReadRegister(33,1.0)
000002C6 - WriteRegister(22,0.0)
40000624 - ReadRegister(49,1.0)
000002E6 - WriteRegister(23,0.0)
And instead of taking hours, developing this program took only a few minutes. As it stands, the program is incomplete and quite buggy. It also doesn't take the place of creative algorithm development. But once you have developed some cool functions, it DOES really help to put those together into different configurations really easily.
slacker
Posts: 116
Joined: Tue Feb 01, 2011 1:13 pm

Post by slacker »

That's brilliant, nice work. I'd imagined something like that but completely lack the skills to actually make it happen.
Sweetalk
Posts: 141
Joined: Thu Oct 15, 2009 5:13 am

Post by Sweetalk »

That's really nice idea, with the option to load some custom algorithms also will be great!
sbcssbcs
Posts: 7
Joined: Wed Jan 09, 2013 1:47 pm

Post by sbcssbcs »

This is a great tool, I'd love to find out how to create own blocks...do I have to work with ElmGen and write in Java?
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Post by Digital Larry »

Hi sbcssbcs,

If you are really interested in doing some of your own development, please drop a request over at the other forum for the SpinCAD Designer GPL code, and I will put it up at GitHub or similar.

You should be familiar with Spin ASM and understand how to program the chip, or be willing to learn. Same applies to Java. I didn't know any Java when I started although I was familiar with C++ and Python and OOP in general. Knowing Java Swing (UI library) will also help a lot.

ElmGen FV-1 instructions have a 1-to-1 correspondence with Spin ASM, although ElmGen does a few things slightly differently. For example, when you use the "Skip" instruction you have to tell it how many instructions to skip instead of targeting a label.

You should install the Eclipse Java development environment and import the SpinCAD code into it. Then take a look at some of the example blocks and see if you can figure the pattern out.

The GPL license doesn't offer any guarantee of support, but just between you and me, at this particular moment in time I am willing to help you a bit. But I can't teach you Java. I learned it the hard way (making lots of mistakes and asking for help on the Forums).

I have recently been considering a couple helpful tools, but not sure how long it would take to develop them.

#1 Spin ASM to SpinCAD code translator. This would take a lot of the drudgery out of converting Spin code to working with SD.

#2 Some way to allow people to create "custom" blocks that were based on loading Spin ASM files while you were working with the tool (rather than creating code to be included in the tool). The main drawback here is that it would be quite difficult to create control panels which help make the "magic numbers" in the code.

Ciao,

DL
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Post by Digital Larry »

Hi everyone, here's a little news on SpinCAD Designer. I've released a couple updates in the past few months, but nothing major. I have been working on the approach whereby regular people (that's you) will be able to add their own blocks to SpinCAD Designer. It's probably going to be early next year before this approach is available to try out. So to create some interest, let me tell you how it will work.

First, supposing you start with a chunk of sample code:

Code: Select all

rdax	outr,1
rdax	inr,-1
mulx	pot0
rdax	inr,1
First you need to give the block a name, as shown by the @name line. Then you define the audio inputs and outputs as well as any control inputs, as shown.

Code: Select all

@name Crossfade
@audioInput inp1 Input_1 
@audioInput inp2 Input_2 
@audioOutput output1 Audio_Output  
@controlInput input0 Fade

; from Spin Knowledge base
; http://www.spinsemi.com/knowledge_base/coding_examples.html#Cross_fading

; assign a register to any registers which the program requires.
; this is not needed for input references or for control inputs.

equ output1 REG0

rdax	inp1,1
rdax	inp2,-1
; during parsing, "pot0" gets converted to "input0" automatically
mulx	pot0
rdax	inp2,1

; each block needs to end with the accumulator being set to zero
wrax	output1,0
Run this through the magical SpinCAD compiler, and (a few other things which aren't very difficult) and this function will now be available as a block within SpinCAD Designer!

I've been working with this to convert all of the Guitar Amp application demo programs to blocks (a good debugging approach also). It really speeds up creating blocks from existing Spin DSP code. I'm pretty stoked!
Post Reply