Jump to content

Recommended Posts

Posted

now available at http://www.ucapps.de/mios_download.html

from the README.txt


Analog Toolbox V1.1                    (C) 2005 Thorsten Klose (tk@midibox.org)
===============================================================================

This application allows to output analog values at the AOUT module
depending on analog values, MIDI events and internally generated waveforms

It's definitely not a professional tool, but just a toy for having
some fun!

Everybody is welcome for sharing additional modules and/or processing
algorithms to the MIDIbox community!

===============================================================================

A precompiled binary is already part of this package:
  o project.hex (can be loaded into MIOS Studio)
  o project.syx (can be loaded into any SysEx upload tool)

Following tools are required to recompile the code:
  o SDCC v2.5.0
  o gputils
  o perl

The details are described under http://www.ucapps.de/mios_c.html

===============================================================================

Required hardware:
  o one MBHP_CORE module
  o one MBHP_AOUT module

Optional hardware (not supported by default, but provided by MIOS):
  o up to 2*AINX4 for up to 64 analog inputs (reduces the sampling frequency!)
  o up to 4*DOUTX4 for up to 128 digital outputs
  o up to 4*DINX4 for up to 128 digital inputs
  o LCD - but note that it affects the realtime performance!
  o up to 8 BankSticks to store waveforms or other tables

===============================================================================

Configuration steps:

  o check the "general application settings" in main.h if changes are
    required for your hardware setup
    By default 8 analog inputs are used in "UnMuxed mode" (direct
    connection to CORE:J5 without AINX4 modules)

    Remember: unusued analog pins on the CORE module should be
    clamped to ground!

  o check the pin configuration for the AOUT module in aout.h
    The default pinning is equal to the pinning used by MIDIbox CV
 
  o open map.c and adapt the "signal processing" for your needs

  o the application can be rebuilt with the "make.bat" file
    (type "make" in a DOS command shell)

===============================================================================

Description about the most important files:

  - mios_wrapper\mios_wrapper.asm and mios_wrapper\mios_tables.inc:
    The MIOS wrapper code and MIOS specific configuration tables

  - pic18f452.c: exports PIC18F452 specific SFRs

  - main.c: the main program with all MIOS hooks

  - aout.c: the AOUT module driver (1)

  - midi.c: the MIDI processing module (2)

  - lfo.c: provides two digital LFOs (3)

  - eg.c: provides an envelope generator (4)

  - map.c: handles the "signal processing" (analog output values are
    determined here) (5)

There are additional .h files for all .c files which contain
general definitions and the declaration of global functions/variables
These .h files must be included into the program parts which
get use of these globals


-------------------------------------------------------------------------------
(1) aout.c

this module provides following global variables:
 
  unsigned int aout_value[8]  (12bit value)

  accessible with:
      aout_value[0]    for the first AOUT
      aout_value[1]    for the second AOUT
      ...
      aout_value[7]    for the 8th AOUT



  aout_gates_t aout_gates    (union with two elements: G0 and G1)

  accessible with:
      aout_gates.G0    for the first gate on the AOUT module
      aout_gates.G1    for the second gate on the AOUT module


  value changes will lead to an automatic update on the AOUT module


-------------------------------------------------------------------------------
(2) midi.c

this module provides following global variables:

  midi_note_t midi_note[16]  (union with two elements: NOTE and GATE)

  midi_note[0]  for the first MIDI channel
  midi_note[1]  for the second MIDI channel
  ...
  midi_note[15]  for the 16th MIDI channel


  Union usage:
    midi_note[x].NOTE returns the note number (0-127),
    midi_note[x].GATE returns the gate state (0 or 1)


  unsigned char midi_cc_chn0[128]  for CC values received on MIDI channel #1

  Examples:
    midi_cc_chn0[1]  returns the ModWheel Value
    midi_cc_chn0[7]  returns the Volume
    midi_cc_chn0[10]  returns the Pan position
    midi_cc_chn0[11]  returns the expression value


  unsigned int midi_pitch_bender[16]    for Pitch Bender values


-------------------------------------------------------------------------------
(3) lfo.c

By default two digital LFOs are provided, the selectable rate goes
from 0.016 Hz to 97.4 Hz (see lfo_table.inc) - however, above 20 Hz
the generated waveform doesn't look so nice anymore on the scope due
to quantisation effects (on the other hands: some people drool for
such effects ;-)

The LFOs generate a sawtooth waveform, which can be easily transformed
into other waveforms by using a waveform table (map.c contains an
example, how to convert this saw into a sinewave)

The LFOs are clocked from the USER_Timer() process each 1 mS (see
timer configuration in main.c)

Following global variables are available:
  unsigned char lfo0_rate,  lfo1_rate    the LFO rate from 0..255
  unsigned int  lfo0_value, lfo1_value  the LFO waveform from 0..65535 (16 bit)

-------------------------------------------------------------------------------
(4) eg.c

By default one digital ADSR envelope generator is provided, the selectable
attack/decay/release rate goes from 1 mS to 2731 mS (see eg_table.inc)

The EGs is clocked from the USER_Timer() process each 1 mS (see
timer configuration in main.c)

Following global variables are available:

  eg_state_t    eg0          provides the gate: eg0.GATE = 1 to set, = 0 to clear
  unsigned int  eg0_value    the EG value from 0..65535 (16bit)
  unsigned char eg0_attack, eg0_decay, eg0_sustain, eg0_release  the ADSR values from 0..255

-------------------------------------------------------------------------------
(5) map.c

Thats the central file where incoming and internal values are
routed to outgoing values (aout_value[0..7], ...)

Please read the file to get some inspirations

Note that sometimes values need to be converted depending on the
resolution. For better readability, some macros have been defined
which can be found in aout.h

Example: aout_value[0] is a 12bit value, MIOS_AIN_PinGet(0) delivers
a 10-bit value. In order to convert this to a 12bit value, just use
the CONV_10BIT_TO_12BIT macro:

  aout_value[0] = CONV_10BIT_TO_12BIT(MIOS_AIN_PinGet(0));

so that the most significant bit of the 10bit value is aligned to the
most significant bit of the 12bit value (in fact the value is
multiplicated by 4, resp. it is leftshifted 2 times)


Additional notes to digital inputs and outputs: if DINX4 and/or DOUTX4
modules are connected, the number of shift registers have to be
defined in main.c, function USER_Init() in the following way:
  MIOS_SRIO_NumberSet(4); // for 4 shift registers

Thereafter you can get digital values with:
  MIOS_DIN_PinGet(<pin-number>)
and set values with:
  MIOS_DOUT_PinSet(<pin-number>, <value>)


Additional notes to module extensions: MIOS provides some hooks which
could be useful for some special jobs, e.g. MIDI clock processing.
This example demonstrates, how to add a MIDI clock handler:

a) open main.c, search for the MPROC_NotifyReceivedByte function and
add following lines:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MPROC_NotifyReceivedByte(unsigned char byte) __wparam
{
  if( byte == 0xf8 ) // MIDI clock has been received
    MAP_MIDIClock(); // call MAP_MIDIClock to notify this
}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


b) open map.h, search for "prototypes", and add the function
declaration here:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MAP_MIDIClock(void);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


c) open map.c, go to the bottom and add following lines:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MAP_MIDIClock(void)
{
  // do anything here
}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

===============================================================================
[/code]

Best Regards, Thorsten.

Posted

it's strange ,any time i'm looking for something more , it's appear! ;)

are the 8 additionnal gate output from the core usable with this analog toolbox?

here is a C programmer to provide us envellope? (i just start to understand the pic assembler ,so....)

or maybe it's possible to add programmation in assembler (but how to mix the two language?)

thanks TK, it's a lot of people that plane to drive analog gear with their MB on the forum...

Posted

This implimentation looks great TK.  I have been saving funds to purchase parts for analog lfo's, and this solves that problem (since I  am already running miciboxCV).

I like Moxi's question about envelopes also.  I would think somehow lfo could be set to one cycle that starts and ends on the gate signal..? does that make sense? 

oh well, I am going to play with the generic tools this weekend on my system.

THANX TK !!!

gb

Posted

Hi,

v1.1 is now available, it provides two 16bit LFOs (instead of 8bit), and an envelope generator.

My hope is, that the next additions are implemented by you! :)

Moxi: of course, you can add up to 128 gate outputs by using shift registers.

I don't want to support J5 outputs by myself, since this could lead to a short circuit if somebody enables such an option so long analog pots are connected to J5

Best Regards, Thorsten.

Posted

Well, I have the hardware mods done... 8 pots for J5.  However am not getting anything out.  The lcd displays "analog toolbox is running..." but events don't trigger the gates or output voltages from AOUT.  I recompiled with my working MIOS_TABLES file from midiboxCV (which intercepts keypress events).  no luck.  I will download v1.1 and see if I get any further.

C ya

gb

Posted

Step 2

It is actually working, kinda.

I recompiled v1.1 with my mios_tables.inc

- I do get CV out from AOUT1, tracks the keyboard.  Not getting a gate output .

-getting ramp lfo from AOUT5.

-getting sine lfo from AOUT6.

-envelope from AOUT7.  (verrrry kewl)

is this all correct, or am I missing something with the gate outputs?

gb

p.s. this really is a neat addon!

Posted

it's not required to alter the (default) tables of mios_tables.inc, you can let it like it is.

I guess that it's a different problem that I noticed today during the programming of the EG

see also the comment in eg.c:


  // eg0_int.LAST_GATE = eg0.GATE; // doesn't work with SDCC v2.5.0
[/code] it seems that a direct bit copy won't be handled properly by the compiler. This means, that also following line in map.c:
[code]
  aout_gates.G0 = midi_note[0].GATE;
cannot work. Could you please try the following modification (in map.c)

  aout_gates.G0 = midi_note[0].GATE ? 1 : 0;
[/code] and if this doesn't work, try:
[code]
  if( midi_note[0].GATE ) aout_gates.G0 = 1; else aout_gates.G0 = 0;

Best Regards, Thorsten.

P.S.: I must admit that I'm currently not able to test the gate function by myself, since my AOUT board is within a screwless box, which cannot be opened so easily. I've no external plugs for the gate outputs...

Posted

no, and no.  :(

but now that i kinda know where to look.....i'll do some digging on my own.

Thanx TK!!

think I will play with the waveforms and eg stuff too...

this is gonna be a fun weekend!!!

gb

Posted

even if the gate thing can not be resolved....

i am thinking of making a second core/AOUT module...

have one do midiboxCV, have the other one do AnalogTools.  sounds/looks  like the best of both worlds to me.

;D

gb

Posted

Thank you !

ok, back to messing with this gizmo.  Ramp and Sine LFO's appear to be functional... tho I must switch my analog modules (vcf/vca)  to exponential to get good response... that's not a problem. and I believe I will be able to play with the waveforms and customize to my system.

however, the EG is still kind of a mystery to me.  without a trigger, I get 10.63volts out of the jack for AOUT7, when I trigger the module the voltage drops down to about 5.6volts, it does seem that the shape of the output is tracking the knobs/pots on AIN0-3, but after envelope finishes or I release trigger the output goes back up to 10.63volts again.  I am unsure of the relationship of the numbers in the eg_table.inc to what voltage is coming out of  AOUT7.  but I am gonna play with that a bit also.

anyway.....

lfo samples available later today....

gb

Posted

The envelope looks very proplery on the scope, so long the gate is release, it outputs 0V, with the gate rises to the max. voltage, before it goes down to the selected sustain level. So long the gate is active, this sustain level will be hold. This means, when you are changing the sustain level, the voltage will track this setting (like in the analog world).

Yes, pot 0-3 are used by default, but this is only an example setup (which doesn't really make sense, since these pots also control other AOUTs!) - you should assign the envelope parameters to unused pots

Suggestion: remove all the code in map.c, and start to create your own setup.

The fun begins, once analog input values and digitally generated waveforms are modulated together.

This should result into very interesting effects! :)

Example: write:


  aout_value[0] = CONV_16BIT_TO_12BIT(lfo0_value);
  lfo0_rate = CONV_16BIT_TO_8BIT(eg0_value);
  // for direct pot Control
  eg0_attack  = CONV_10BIT_TO_8BIT(MIOS_AIN_PinGet(0));
  eg0_decay  = CONV_10BIT_TO_8BIT(MIOS_AIN_PinGet(1));
  eg0_sustain = CONV_10BIT_TO_8BIT(MIOS_AIN_PinGet(2));
  eg0_release = CONV_10BIT_TO_8BIT(MIOS_AIN_PinGet(3));
  eg0.GATE = midi_note[0].GATE; // EG triggered with MIDI note at Channel #1
[/code] this will output the LFO0 value at AOUT0, and it will modulate the LFO frequency with the envelope Then you could modulate the eg0_decay with another LFO:
[code]
  eg0_decay  = CONV_16BIT_TO_8BIT(lfo1_value);
And the LFO1 frequency with an analog input:

  lfo1_rate = CONV_10BIT_TO_8BIT(MIOS_AIN_PinGet(1)); // modulated with second AIN
[/code]

Hope to hear more samples soon :)

Best Regards, Thorsten.

  • 11 months later...
Posted

It is, but the aout.c file needs some modifications - an existing application like MBSID or MBCV includes a "template", how to access the AOUT_LC module

Best Regards, Thorsten.

Posted

ok, i will see what is possible to do with my knowledge, if that's too complicate i will simply take the mbsid app to generate env and lfo..

also:

i've tested the aout-lc with my cem3378 filter :that's rock!

Posted

hi,

i've tried to integrated the asm code from the file Aout_lc of the midiboxCV app into the analog tool box app, then run the "make bat" script.

after that, i've uploaded the application, the cv react right at incoming midi event but when nothing is send to the box, the voltages at my cv out goes up and down in a range of ca. 1v

where i've done something wrong, it's the first time i try to compile C app, have i missed something, or change have to be done in other files of the C app?

Posted

it's the compilation that don't work, it stop before the end, there is an error message but the script windows is closed before i can read anything....:(

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...