electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » Microcontrollers and Programmable Logic
ElmGen DSP Tool for Spin FV-1
Post new topic   Reply to topic Moderators: State Machine
Page 1 of 2 [34 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Goto page: 1, 2 Next
Author Message
elmood



Joined: Sep 05, 2009
Posts: 22
Location: Toronto

PostPosted: Fri Jan 14, 2011 10:58 am    Post subject: ElmGen DSP Tool for Spin FV-1 Reply with quote  Mark this post and the followings unread

Hi! I just thought I'd stop by to tell you about a project that I've just released for free. It's a development tool for the FV-1 single-chip effects processor from Spin Semiconductors, and I've been using it for a few years to make effect units and so on. But I finally got around to cleaning up the code and making it available as open source software. (GPL3 license)

The key features are cross-platform support, (Windows, Mac and Linux) and a built-in hardware simulator. So if you're new to DSP, or thinking about trying the FV-1, you can test out your algorithm creations in real-time on your PC. It's optimized for hardware simulation accuracy, not high performance but still runs at much better than real-time on my PC.

Anyway, I don't spend much time on forums these days, so if you have questions, problems, ideas, please email me and I'll pop by if anyone wants help with it. If you know Java and want to help extend the software, I want to make it cross-compile DSP code for other architectures... I think a lot of these ARM and PIC-based signal processing projects that people are doing these days could benefit from ElmGen for algorithm creation, if it could emit efficient C code. (not too difficult with the current structure)

You can find all the details here:

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

Hope to hear from some of you soon!
Back to top
View user's profile Send private message Visit poster's website
cloudscapes



Joined: Feb 09, 2004
Posts: 100
Location: Montreal

PostPosted: Thu Jan 20, 2011 8:38 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thank you Andrew!

Unfortunatelly when I try to launch the .jar, absolutelly nothing happens (no error either).

_________________
Sonic Crayon DIY effects lab
Back to top
View user's profile Send private message Visit poster's website
elmood



Joined: Sep 05, 2009
Posts: 22
Location: Toronto

PostPosted: Fri Jan 21, 2011 8:41 am    Post subject: Reply with quote  Mark this post and the followings unread

Hi! I've heard from a few people now who are starting to use ElmGen... thanks for the questions and comments so far. I'm going to use this thread as a the "official" support thread.

I also updated my site with some handy tips for getting started.

To answer a few questions:

Can't run the JAR - The JAR is a library which you need to include in your own project... you can't run it directly. I use Eclipse for doing Java coding which is free. Import the ElmGen JAR into your project and add it to the classpath in the Project Properties. A simple project consists of a main class (see SimTest.java for an example) and at least one program (see Reverb.java) The main class sets up each program and then either adds it to an EEPROM image and flashes the chip, or runs it in a simulator.

Can ElmGen output HEX files? - Yes and no. Yes: You can read the raw bytes from the assembled EEPROM image after adding all your programs to it using the getBytes() method. A complete image is 4096 bytes made up of 512 bytes * 8 programs. Each program has 128 words (32 bits each) assembled in order with no headers or gaps in the ROM image. No: Intel-style HEX files usable with device programmers, etc. is not currently supported. I have worked with these formats before so I can add this if people want it. (do you want this?)

Are the SpinASM or other Tools Needed? - No. You can write programs, assemble them into a ROM image, flash an EEPROM and run the hardware simulator all with ElmGen. It produces ROM images that are byte for byte (tested) compatible with SpinASM, including bugs and undocumented bits.

Is the Compiled Output Correct? - Probably. Each instruction was tested against code generated by SpinASM using the same operands to ensure that the same code will produce the same outputs. Porting a SpinASM program ElmGen should produce identical ROM output.

Is the Simulator Accurate? - Hopefully. Because the FV-1 uses analog inputs and outputs, and because there appears to be no way to access the internal registers (that I know of) it is impossible to compare simulations bit-for-bit. However the simulator recreates the widths of the data path and resolutions of the adders and multipliers. No floating point math is used since the FV-1 does everything with integers only.

Please send your feedback to me or to this list and I'lll do my best to help you. For those of you (like me 3 years ago) afraid to jump into DSP due to the cost and complexity of the tools... I hope that this project will convince you to give it a try.
Back to top
View user's profile Send private message Visit poster's website
yusynth



Joined: Nov 24, 2005
Posts: 1314
Location: France

PostPosted: Sat Jan 22, 2011 1:46 am    Post subject: Reply with quote  Mark this post and the followings unread

Hi Andrew

And many thanks for making ElmGen available.
I gave it a test yesterday night on a Macintosh using the Netbeans IDE and I successfully compiled the example and simulation test and run them (the simulation I mean). It worked all fine. Cool
Now I am at the point to write my own programs for the FV-1 ( still have to read thoroughly the FV-1 docs though Rolling Eyes ) and I wont be able to test on hardware until a week or so because I have ordered FV-1 chips only yesterday...

_________________
Yves
Back to top
View user's profile Send private message Visit poster's website
yusynth



Joined: Nov 24, 2005
Posts: 1314
Location: France

PostPosted: Sat Jan 22, 2011 1:57 am    Post subject: Reply with quote  Mark this post and the followings unread

By the way in the example files Mute and Bypass you seem to have swapped the strings used in the super() function : super("Bypass") for Mute class and super("Mute") for Bypass class...
_________________
Yves
Back to top
View user's profile Send private message Visit poster's website
elmood



Joined: Sep 05, 2009
Posts: 22
Location: Toronto

PostPosted: Sat Jan 22, 2011 10:17 am    Post subject: Reply with quote  Mark this post and the followings unread

Good to see that you got it working!

As for those typos, I just copied the files for the examples at the last minute... will fix the ones on my site, and in the ZIP for the next release. It doesn't really affect anything though...
Back to top
View user's profile Send private message Visit poster's website
yusynth



Joined: Nov 24, 2005
Posts: 1314
Location: France

PostPosted: Tue Feb 01, 2011 6:37 am    Post subject: Reply with quote  Mark this post and the followings unread

Hi Andrew

I have received the FV-1s, still waiting for the EEPROMs and I am designing a PCB for the basic configuration (the one in the FV-1) datasheet. I now have an Arduino Uno board and I wanted to be sure about the way to connect the EEPROM to the Arduino to be able to program it through the ElmGen environment.

I gather that if I use a small piece of perfboard with a DIP8 socket I should connect A0,A1,A2,WP and Vss pins to the GND port of the Arduino board, the SCL pin to Analog port 5, the SDA pin to Analog port 4 and my question is :
must I power the Vcc pin from the +5V or the 3.3V POWER port of the Arduino ? Or may be either one or the other is OK ?

Thanks for your advices.

_________________
Yves
Back to top
View user's profile Send private message Visit poster's website
elmood



Joined: Sep 05, 2009
Posts: 22
Location: Toronto

PostPosted: Tue Feb 01, 2011 6:54 am    Post subject: Reply with quote  Mark this post and the followings unread

It is important to not power the FV-1 itself with more than +3.3V. In my setup the Arduino (a 5V type) only connects the I2C lines and ground. The FV-1 contains the pullup resistors for the I2C bus, so they float at +3.3V normally... Attaching the Arduino to do "in-circuit" programming doesn't cause any problems.

If you're programming the EEPROM by itself it doesn't matter what voltage it runs at. But in most cases the method described above will be most useful. The FV-1 works normally with the Arduino attached... However your computer may cause some ground loops through the USB and add noise to the audio signal. Maybe Unplug the I2C wires while doing careful listening or tests.

Does this make sense? I put 3 pin header pads on all my FV-1 boards for doing the programming and this has worked fine.
Back to top
View user's profile Send private message Visit poster's website
yusynth



Joined: Nov 24, 2005
Posts: 1314
Location: France

PostPosted: Tue Feb 01, 2011 7:59 am    Post subject: Reply with quote  Mark this post and the followings unread

OK, this makes sense.
_________________
Yves
Back to top
View user's profile Send private message Visit poster's website
yusynth



Joined: Nov 24, 2005
Posts: 1314
Location: France

PostPosted: Thu Mar 03, 2011 2:29 am    Post subject: Reply with quote  Mark this post and the followings unread

Just a short message to report my successful use with a MacOSX environment, of the ElmGen Program to generate an operational code for the FV-1 and burn it into a 24LC32A EEPROM .
For the java programming NetBeans, I installed the RXTX java library for MacOSX, there it is important to read the instructions at this address http://jlog.org/rxtx-mac.html and run the fixperm-217-leo.sh shell script which fixes some permissions. Next it is important to modify the serial port name in the SimTest program from "COM5" to the appropriate nport name as indicated in the Arduino menu : something ike "/dev/tty.usbmodem1d11" the suffix 1d11 may be different on your system depending on which usb socket your arduino is connected to (see http://www.arduino.cc/en/Guide/MacOSX ).

I have designed a PCB and built a special board for the FV-1 (based on the schemo in the datasheet + some ancillary circuits) and burned an EEPROM with the examples provided by Andrew and and it works (both the internal and external effects). I have started to program my own stuff and the first tests are very promising.

Thanks Andrew for making the use of FV-1 so easy !

_________________
Yves
Back to top
View user's profile Send private message Visit poster's website
yusynth



Joined: Nov 24, 2005
Posts: 1314
Location: France

PostPosted: Thu Mar 03, 2011 12:35 pm    Post subject: Reply with quote  Mark this post and the followings unread

Here are two photos of my prototype.


proto-D3-FX-1.jpg
 Description:
SMD component side
 Filesize:  175.61 KB
 Viewed:  1001 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

proto-D3-FX-1.jpg



proto-D3-FX-2.jpg
 Description:
Thru-hole component side
 Filesize:  187.3 KB
 Viewed:  877 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

proto-D3-FX-2.jpg



_________________
Yves
Back to top
View user's profile Send private message Visit poster's website
elmood



Joined: Sep 05, 2009
Posts: 22
Location: Toronto

PostPosted: Thu Mar 10, 2011 11:33 am    Post subject: Reply with quote  Mark this post and the followings unread

Hey Yves,

Great to see the pictures of your boards! I'm glad to know that my code is getting a workout. The FV-1 is truly a unique part and quite fun to use. I'm only now trying to implement the same kinds of algorithms on other more general purpose processors, and it's not nearly as much fun. Smile

Keep up the good work, and send me bug reports or feature ideas and I'll see about adding them.



Andrew
Back to top
View user's profile Send private message Visit poster's website
loss1234



Joined: Jul 24, 2007
Posts: 1536
Location: nyc
Audio files: 41

PostPosted: Fri May 06, 2011 9:42 am    Post subject: where to start Reply with quote  Mark this post and the followings unread

OK

Let me start by saying THANKS for creating this! I have had an FV-1 since last January and most of that time it has sat in the closet.

why? Because programming in pure assembly has been beyond me. However in the last few months I have started learning how to use ARDUINO and C, and I think this tool looks like something I could learn to use (i ordered some books on JAVA!)

SO..

Where to start?

besides downloading this program, I noticed I need to get RXTX as well.

So if anyone could help me I have OSX and WINDOWS but would prefer to keep it on OSX if possible


thanks so much

Dan

_________________
-------------------------------------------- check out various dan music at: http://www.myspace.com/lossnyc
http://www.myspace.com/snazelle
http://www.soundclick.com/lossnyc.htm http://www.indie911.com/dan-snazelle
Back to top
View user's profile Send private message
loss1234



Joined: Jul 24, 2007
Posts: 1536
Location: nyc
Audio files: 41

PostPosted: Fri May 06, 2011 9:58 am    Post subject: Reply with quote  Mark this post and the followings unread

Oh and OOPS
I also need to figure out what program will allow me to start coding in Java on osx. This seems to be one of the languages you can't use terminal for.

thanks

_________________
-------------------------------------------- check out various dan music at: http://www.myspace.com/lossnyc
http://www.myspace.com/snazelle
http://www.soundclick.com/lossnyc.htm http://www.indie911.com/dan-snazelle
Back to top
View user's profile Send private message
elmood



Joined: Sep 05, 2009
Posts: 22
Location: Toronto

PostPosted: Fri May 06, 2011 10:13 am    Post subject: Reply with quote  Mark this post and the followings unread

Rxtx is pretty easy to install. For development I like Eclipse. It's free and works well on OS X.
Back to top
View user's profile Send private message Visit poster's website
yusynth



Joined: Nov 24, 2005
Posts: 1314
Location: France

PostPosted: Fri May 06, 2011 10:47 am    Post subject: Reply with quote  Mark this post and the followings unread

loss1234 wrote:
Oh and OOPS
I also need to figure out what program will allow me to start coding in Java on osx. This seems to be one of the languages you can't use terminal for.

thanks


If you read my previous message you'll see that I am using ElmGen under OSX with NetBeans and it works nicely.

_________________
Yves
Back to top
View user's profile Send private message Visit poster's website
echotapper



Joined: Jan 22, 2012
Posts: 1
Location: netherlands

PostPosted: Sun Jan 22, 2012 4:26 am    Post subject: Reply with quote  Mark this post and the followings unread

I'm going to try this ElmGen for sure!! Debugging FV-1 DSP code is sometimes very difficult and it seems it could help me debugging particular area's of my code.

I've designed a general input/output board that takes the OCT daughterboard. I'm using it to develop a vintage echo emulation. The project is called eTAP2HW detailed information on my site www.echotapper.nl. The board's layout and design files are available on request.


-Piet
Back to top
View user's profile Send private message
elmood



Joined: Sep 05, 2009
Posts: 22
Location: Toronto

PostPosted: Mon Jan 23, 2012 9:45 am    Post subject: Reply with quote  Mark this post and the followings unread

echotapper wrote:
I'm going to try this ElmGen for sure!! Debugging FV-1 DSP code is sometimes very difficult and it seems it could help me debugging particular area's of my code.


That's excellent! I'm glad to hear more people are using this code. I expect that the simulator part of the code will be quite hackable as you need. Right now the main purpose is to just hear the resulting audio. But I think there are probably a lot of uses to graph things in the frequency domain like you have on your blog.

If you make improvements please let me know so that I can update it. If there is a lot of contribution I will put it on a source repository, but so far I haven't received any patches.
Back to top
View user's profile Send private message Visit poster's website
Digital Larry



Joined: Feb 19, 2013
Posts: 17
Location: Silicon Valley, CA

PostPosted: Tue Feb 19, 2013 9:15 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hi Andrew,

I just got ElmGen running this morning on Windows 7 and Eclipse. I'm a bit of a bozo Java wise and some of your instructions needed interpretation in this version of Eclipse. However experience is the best teacher and I think I will be able to handle it.

Thanks!

Digital Larry
Back to top
View user's profile Send private message
Digital Larry



Joined: Feb 19, 2013
Posts: 17
Location: Silicon Valley, CA

PostPosted: Thu Feb 21, 2013 2:34 am    Post subject: How to read from a delay line with a fixed offset? Reply with quote  Mark this post and the followings unread

Hi Andrew,

I hope this is not too annoying of a question, but I am trying to create a multi-tap delay and would like to be able to write something equivalent to Spin Assembler for:

rda Delay+20,Coeff

I looked into the code for memory allocation and name association but it didn't leap out at me how to write something equivalent using ReadDelay.

I start with:

allocDelayMem("delayline", 2000);


Then, if I write:

readDelay("delayline" + 100, 1.0, fb1);

or even:

readDelay(("delayline") + 100, 1.0, fb1);

I get:

Exception in thread "main" org.andrewkilpatrick.elmGen.ElmProgramException: segment not found: DELAYLINE100

I'm guessing it can be done with MemSegment.getStart() but just can't figure out how it should be written.

Thanks!

BTW echotapper, I have one of your modules and got it working. It is cool but not exactly what I am looking for so I wanted to experiment with my own multitap delay programs.

DL
Back to top
View user's profile Send private message
elmood



Joined: Sep 05, 2009
Posts: 22
Location: Toronto

PostPosted: Thu Feb 21, 2013 9:23 am    Post subject: Reply with quote  Mark this post and the followings unread

Digital Larry:

You can't do it like that because in Java the + operator concatenates Strings if one of the things being added is a String.

An easy way to do it is to use the address pointer: ADDR_PTR which is an actual register in the FV-1 that you can use to get at different places in the delay memory. Read the SpinAsm manual for how to do this. This is needed if you want delay times that are adjusted at run-time... like vibrato or a delay time control.

If you want to use RDA for hard-coded delay offsets, use getDelayMemByName() to look up your pre-defined delay memory. Then use MemStart's getStart() to find the offset, and then add your own offset. (+100) This all gets done at compile time, since this is all compiled into the program, and not calculated on the FV-1.

Keep in mind that you could also just stick any number from 0-32767 into RDA and keep track of the memory yourself. ElmGen helps you as a convenience, but it's not required if you prefer to use a pen and paper to set up the memory allocation.

Hope this helps!


Andrew
Back to top
View user's profile Send private message Visit poster's website
Digital Larry



Joined: Feb 19, 2013
Posts: 17
Location: Silicon Valley, CA

PostPosted: Thu Feb 21, 2013 1:10 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thanks Andrew. For now I am just using one delay line, so it starts at zero and the taps can simply be explicit offset constants. At some point I'm going to use one of the pots to adjust the taps, so I will also need to use the register offset method.

DL
Back to top
View user's profile Send private message
Digital Larry



Joined: Feb 19, 2013
Posts: 17
Location: Silicon Valley, CA

PostPosted: Thu Feb 21, 2013 3:46 pm    Post subject:  Now I got it! Reply with quote  Mark this post and the followings unread

I had to look into the ElmGen source to see how the readDelay() function worked when given the name of the memory segment rather than an integer value, as it's not documented in the Javadocs.

Anyway, here is my code, with the taps based on the tap spacing of the MN3011 BBD. Dry comes out of the left channel and the effect comes out of the right (just for testing). There's a few debug type statements in there also.

I should add an LPF prior to the delay line and possibly mild distortion to give it that authentic BBD sound.

This is wildly cool! Thanks Andrew.

Code:
/*
 * Digital Larry attempt at a multi tap delay.   
 */

package org.andrewkilpatrick.elmGen.test.simTest;

import org.andrewkilpatrick.elmGen.ElmProgram;

public class MultiTap extends ElmProgram {
   
   /**

    */
   public MultiTap() {
      super("MultiTap");
      setSamplerate(48000);
      clear();
      
      // coefficients
      double tap1level = 0.35;   // tap1 level
      double tap2level = 0.23;   // tap2 level
      double tap3level = 0.12;   // tap3 level
      double tap4level = 0.051;   // tap4 level
      double tap5level = 0.025;   // tap5 level
      double tap6level = 0.015;   // tap6 level

      double fb1 = 0.27;        // tap sum feedback
      double longtap = 0.625;      // this is the delay time associated with the longest tap
      
      // the following tap parameters are percentage of total, to be used with readDelay
      // these are based on the MN3011 BBD
      double tap1 = (396/3328.0);
      double tap2 = (662/3328.0);
      double tap3 = (1194/3328.0);
      double tap4 = (1726/3328.0);
      double tap5 = (2790/3328.0);
      double tap6 = (3328/3328.0);

      allocDelayMem("delayline", (int)(tap6 * longtap * 48000 + 1));

      System.out.println("Delay memory allocated: " + getDelayMemAllocated());
      System.out.println(getMemoryMap());
      
      // read left and right input
      readRegister(ADCL, 0.55);  // read left 55%
      writeRegister(REG0,1.0);
      readRegister(REG3, fb1);  // sum of tap delays
      writeRegister(REG1, 1.0);   // write input to REG1, scale ACC by 1.0  REG1 = INPUT+FB (not used currently)
      
      writeDelay("delayline", 0.0, 0.25);
      readDelay("delayline", tap1, tap1level);  //
      readDelay("delayline", tap2, tap2level);  //
      readDelay("delayline", tap3, tap3level);  //
      readDelay("delayline", tap4, tap4level);  //
      readDelay("delayline", tap5, tap5level);  //
      readDelay("delayline", tap6, tap6level);  //

      writeRegister(REG3, 0.0);   // write sum of taps to REG3, REG3 = SUM
      
      // write output
      readRegister(REG0, 1.0);   // get input back, leave ACC as is
      writeRegister(DACL, 0.0);   // write ACC to DACL and clear ACC

      readRegister(REG3, 1.0);   // now sum in taps, leave ACC as is
      writeRegister(DACR, 0.0);   // write ACC to DACR and clear ACC
      
      System.out.println("Code length = " + getCodeLen());
   }

}
Back to top
View user's profile Send private message
Digital Larry



Joined: Feb 19, 2013
Posts: 17
Location: Silicon Valley, CA

PostPosted: Sat Mar 02, 2013 8:29 am    Post subject: Reply with quote  Mark this post and the followings unread

elmood wrote:

If you want to use RDA for hard-coded delay offsets, use getDelayMemByName() to look up your pre-defined delay memory. Then use MemStart's getStart() to find the offset, and then add your own offset.
Andrew


Hi Andrew,

I want to use this getDelayMemByName() function, however within class ElmProgram it is defined as a private method. Any problem you see making it public?

For example I'm trying to port this reference pitch shifter code into ElmGen:

Code:

// cho rda,RMP0,RPTR2|CHO_COMPC,delayd + 1
   chorusReadDelay(CHO_LFO_RMP0, CHO_RPTR2 | CHO_COMPC, "delayd",1);


For some reason this chorusReadDelay() function wants to insist on an additional int parameter after the String? Don't quite understand this as the source file doesn't show it that way.
Back to top
View user's profile Send private message
elmood



Joined: Sep 05, 2009
Posts: 22
Location: Toronto

PostPosted: Sat Mar 02, 2013 9:51 am    Post subject: Reply with quote  Mark this post and the followings unread

Digital Larry wrote:


I want to use this getDelayMemByName() function, however within class ElmProgram it is defined as a private method. Any problem you see making it public?



Sorry... I didn't refresh my memory enough before my last reply... it's been many years since I worked on this code. I'm quite sure what you want to do is already available in the public methods.

Check out:

public void chorusReadDelay(int lfo, int flags, String memName, int offset)

You call the memory segment by name, which internally finds the segment by its address. Then you can add an offset of some number of samples.

The comment on the "offset" shows the read position as 0.0 to 1.0, which I think might be incorrect. It should be actually be 0-segLen-1... I've made a note to fix this in a future release.

If you want to use the segment without any offset, set offset to 0.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: State Machine
Page 1 of 2 [34 Posts]
View unread posts
View new posts in the last week
Goto page: 1, 2 Next
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Microcontrollers and Programmable Logic
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use