Rotating an Array: Seeking Help with Maths Skills

  • Context: Undergrad 
  • Thread starter Thread starter MM2758
  • Start date Start date
  • Tags Tags
    Array Rotating Skills
Click For Summary
SUMMARY

The discussion centers on the mathematical approach to rotating an array for controlling a Digital-to-Analog Converter (DAC) in an ADSR (Attack, Decay, Sustain, Release) context. The user seeks assistance in deriving a function to calculate the rotation and adjustment values based on desired entry and exit voltages. Key formulas provided include f(t) = Q/P for scaling, and more complex variations for different exit points. The challenge lies in managing the data size and ensuring signal values remain within the DAC's range of 0-4095.

PREREQUISITES
  • Understanding of basic mathematical functions and operations
  • Familiarity with Digital-to-Analog Converters (DAC)
  • Knowledge of ADSR envelope generation
  • Experience with spreadsheet tools like Microsoft Excel for data manipulation
NEXT STEPS
  • Research mathematical functions for scaling and transforming data sets
  • Explore Digital-to-Analog Converter (DAC) specifications and limitations
  • Learn about ADSR envelope generation techniques in audio programming
  • Investigate advanced Excel functions for data analysis and visualization
USEFUL FOR

Audio engineers, DSP (Digital Signal Processing) developers, and anyone involved in sound synthesis or signal manipulation will benefit from this discussion.

MM2758
Messages
5
Reaction score
0
Rotate an array
hi everyone

I'm hoping someone maybe able to help me/ point me in the right direction with the rotation of data from an array. I'll try to keep it short but my maths skills are seriously not good due to my old age and inexperience. I maybe approaching it from the wrong angle and punching well above my weight. I'm pretty good at addition and subtraction even though sometimes I get stuck on division.
icon_wink.gif


Here is a link to a spreadsheet I’m working on which hopefully will eventually end up in a program controlling a DAC for a ADSR

http://imgur.com/nAPHS3j

Column A represents a wave in voltage x being time y being voltage.
It is irrelevant what shape this is for it might be a straight line ..etc. etc.
What interests me is its entry and exit voltage which are normally 100
I have found through a lot of trial and error if I use the charts on the right (Rotate Chart & Add to F Chart) I can look up values and determine a different entry and exit voltage by rotating the wave.
So for example if I wanted a entry of 300 and an exit of 200. I would use the value in cell L5 for Rotate which is 3.3 and the value in cell L18 for the Add to F which is 150.
Now normally with a problem like this I would code a kinda lookup 3 dimensional array to get these values. But the real DAC has a voltage number range of 0-4095 which would mean an array size of 4095 raised to power 3. I think …..which is to much data for the processor I am using to store.

In this example I reduced it to 0-100 so I could see what is going on.

So my question is in an ideal world I would enter a value for the entry point and enter a value for the exit point and there would be some sort of equation which could work out from those 2 values the Rotate number and hopefully the Add to F number.

I've been stuck on this for a while hence the plea for help.

I think i tried all the functions in excel and watch you tube videos on rotation . but most of the ones i understand involve an extension of reflection

I'm not to interested in the distortion of the wave as I quiet like it (if that makes sense)thanks for reading
thanking you in advance for any guidance you can give
 
Mathematics news on Phys.org
Your original function is y(t) and the new function is z(t),
so you need a function f(t) so that z(t) = y(t)*f(t)

If the initial entry and exit points are P and desired entry and exit points are Q
then ##f(t)= \frac{Q}{P}##

If the desired exit points are different, Q0 and QT,
## f(t) = \frac{1}{P} (Q_0+ (Q_T-Q_0)\frac{t}{T})##

and if the initial entry and exit points are not equal, so P0 and PT, then the general function is
## f(t) = \frac{TQ_0 +(Q_T -Q_0)t}{TP_0 +(P_T - P_0)t}##

The main snag with this method that I can see is, if you increase the value of the entry ot exit point and there are signal values above this level, then after scaling there could be signal points above your maximum 4096. Provided you are scaling down, or using maxima as entry and exit points, then it should work.
I've not yet checked what happens if polarity changes, but I did not notice any issues where this would matter.

E&OE because my maths is very poor as well!
 
  • Like
Likes   Reactions: MM2758
Thanks Merlin for your reply

Now I'm going to spend the next day or so trying to understand it. and implement it ...gulp

thank you againI may well be back ...if that's ok
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 25 ·
Replies
25
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 0 ·
Replies
0
Views
3K