Results 1 to 8 of 8
Like Tree2Likes
  • 1 Post By Roberto
  • 1 Post By Roberto

Thread: Algorithms for music: real-time parameter modification

  1. #1
    Member
    Join Date
    May 2013
    Posts
    78

    Algorithms for music: real-time parameter modification

    Hi everybody,

    I don't know how many people use rack fx these days, and how many dig into them to catch new sounds, but I would like to share with you what I obtained as complex waveforms to control parameters on my fx units.

    Basically, as you probably know, rack fxs have the possibility to assign some parameters to CC midi signals, or voltage on specific inlets, or volume pedals and so on. Lexicons (at least my lexicons) limit them to 5 per each unit.

    On Mesa Boogie Triaxis you can assign any of the stored values (gain, mid, lows, highs, volume, etc...) to an external information, in order to change it while playing.

    Same can be applied to the parameters of all rack fxs compatible with CC signals.
    Some of them are just a 1 bit signals (0-63 and 64-127), some have full dynamic on the 128 values.

    You can then change in real time the shape of the chorus, the decay of a reverb, the pan, etc...

    After being in contact with Professor John Chowning of the Stanford University, the inventor of the FM modulation on the synths to emulate the real sound of the instruments, I came out with some algorythms to change in real time the parameters of my rack fxs.

    Here below you can find the code.

    I've done it in matlab to speed-up the plots, but I've intentionally used the same commands that can be used in Arduino, that is the platform I'll use to send commands to the fxs.

    Code:
    % #1 funzione per Chorus con AM ed FM
    fc = 0.29; % Carrier Freq (Hz)
    fm = 0.085; % Modulating Signal Freq (Hz)
    m = 9; % Modulation Index
    t = linspace(0, 10, 2^14); % Number of samples
    y = -0.45*sin(2*pi*fc*t*0.96) + 0.45*cos(2*pi*fc*t - (m*sin(2*pi*fm*t))) + 0.1*cos(2*pi*fc*t*2.8);
    subplot (3,2,1), plot(t,y);
    
    % #2 funzione per panning
    fc = 0.69; % Carrier Freq (Hz)
    fm = 0.23; % Modulating Signal Freq (Hz)
    m = 9; % Modulation Index
    t = linspace(0, 10, 2^14); % Number of samples
    y = - 0.5*sin(2*pi*fc*t - (m*cos(2*pi*fm*t*0.618))) + 0.5*cos(2*pi*fc*t*2.8 + (m*sin(2*pi*fm*t*0.618)));
    subplot (3,2,2), plot(t,y);
    
    % #3 funzione per psycho-flanger
    fc = 0.69; % Carrier Freq (Hz)
    fm = 0.23; % Modulating Signal Freq (Hz)
    m = 1; % Modulation Index
    t = linspace(0, 10, 2^14); % Number of samples
    y = - 0.5*sin(2*pi*fc*t - (m*cos(2*pi*fm*t*1.32))) -0.5 + abs(cos(2*pi*fc*t*1.32 + (m*sin(2*pi*fm*t*0.618))));
    subplot (3,2,3), plot(t,y);
    
    % #4 funzione per dimensione riverbero
    fc = 0.69; % Carrier Freq (Hz)
    fm = 0.23; % Modulating Signal Freq (Hz)
    m = 19; % Modulation Index
    p = 0; %numero del plot
    t = linspace(0, 10, 2^14); % Number of samples
    y = - 0.6*sin(2*pi*fc*t - (m*cos(2*pi*fm*t*1.32))) + 0.4*cos(2*pi*fc*t*3 - (m*sin(2*pi*fm*t*1.32)));
    subplot (3,2,4), plot(t,y);
    
    % #5 funzione per chorus lento
    fc = 0.069; % Carrier Freq (Hz)
    fm = 0.023; % Modulating Signal Freq (Hz)
    m = 19; % Modulation Index
    t = linspace(0, 10, 2^14); % Number of samples
    y = - abs(sin(2*pi*fc*t - (m*cos(2*pi*fm*t*1.32)))) + abs(cos(2*pi*fc*t*3 - (m*sin(2*pi*fm*t*1.32))));
    subplot (3,2,5), plot(t,y);
    
    % #6 funzione per chorus lento
    fc = 1.29; % Carrier Freq (Hz)
    fm = 0.385; % Modulating Signal Freq (Hz)
    m = 18; % Modulation Index
    t = linspace(0, 20, 2^14); % Number of samples
    y = cos(2*pi*fc*t - (m*sin(2*pi*fm*t*0.26))) ;
    subplot (3,2,6), plot(t,y);

    Has anyone done something similar to his rack?
    Attached Files Attached Files
    nickb likes this.

  2. #2
    Member
    Join Date
    May 2013
    Posts
    78
    Same concept can be applied to Rhythms too (see attached recent research).
    Attached Files Attached Files
    Mark Lavelle likes this.

  3. #3
    Member
    Join Date
    May 2013
    Posts
    78
    The Matlab code I've developed to see the effect of each parameter in 25 different plots is the following:

    Code:
    % Plot funzioni con AM ed FM
    fc = 1.29; % Carrier Freq (Hz)
    fm = 0.385; % Modulating Signal Freq (Hz)
    m = 9; % Modulation Index
    p = 0; %numero del plot
    for fi = 0.1:0.04:1.06;
    p = p+1;
    t = linspace(0, 20, 2^14); % Number of samples
    y = cos(2*pi*fc*t - (m*sin(2*pi*fm*t*fi))) + 0.1*cos(2*pi*fc*t*2.8);
    subplot(5,5,p), plot(t,y);
    end
    To switch from the [-1,+1] range of the plots to the [0,127] midi range, you can use the map function in Arduino: https://www.arduino.cc/en/reference/map

  4. #4
    Member
    Join Date
    May 2013
    Posts
    78
    This is what the previous lines plot. I like to plot the parameters this way, in order to understand how they'll affect the function.
    Attached Files Attached Files

  5. #5
    "Thermionic Apocalypse" -JT nickb's Avatar
    Join Date
    Dec 2009
    Location
    Devon, UK
    Posts
    2,333
    It's nice of you to share what you have learned and refreshing to see something new
    Experience is something you get, just after you really needed it.

  6. #6
    Member
    Join Date
    May 2013
    Posts
    78
    Thanks nickb,
    I would also like to see if this can lead new people to experiment, and see new results.

  7. #7
    Member
    Join Date
    May 2013
    Posts
    78
    Well, the basic code is really simple.
    I modulate the frequency of a sine or cosine wave by varying the value of the radiants during the time:
    Code:
    y = cos(2*pi*fc*t - (m*sin(2*pi*fm*t*0.26)))
    This can be splitted in:
    Code:
    y = cos(2*pi*fc*t)
    That is nothing else than a simple cosine wave of the carrier frequency fc.

    Then I modulate the radiants of the funcion, so I change the speed of the radiants, so the frequency.
    Code:
     - (m*sin(2*pi*fm*t*0.26))
    It's a frequency modulation of the carrier frequency fc at the modulation frequency fm.
    The amount of modulation is set by the parameter m.

    This is the very basic one, then you can do whatever you want:
    - square waves by adding nth order harmonics at the amplitude 1/n;
    - absolute values of the sinewaves;
    - odd roots of the sine waves;
    - triangular waves;
    - sawtooth waves;
    - etc...

  8. #8
    Member
    Join Date
    May 2013
    Posts
    78
    For example, do you want to do an AM modulation of a FM modulated sine?

    Code:
    y = cos(2*pi*am*t) * cos(2*pi*fc*t - (m*sin(2*pi*fm*t))) ;
    Where:
    - am is the amplitude modulating frequency;
    - fm is the frequency modulation frequency.

    Do you want to modulate only from 0 to 50% of the total swing?
    Code:
    y = 0.5*cos(2*pi*am*t) * cos(2*pi*fc*t - (m*sin(2*pi*fm*t)))
    Otherwise you can use the map function in Arduino and change the destination range to 32-96 omitting the 0.5.

    Best way, is to keep the full range on the midi and reduce the range when assigning the midi cc to the effect parameter. This way you do not reduce the resolution in the transmission of the parameter while obtaining the same result.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Akai lpd8 overview (synth knobs parameter)
    By Junglehood in forum Music Electronics
    Replies: 0
    Last Post: 01-28-2016, 02:46 PM
  2. Real Time SPICE Simulation
    By jazbo8 in forum Theory & Design
    Replies: 7
    Last Post: 03-22-2014, 05:57 AM
  3. First time post, first time building cabinets
    By csparks75 in forum Cabinetry
    Replies: 3
    Last Post: 02-22-2008, 03:13 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •