Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 11 of 11

Thread: Array handling in the audio tool.

  1. #1
    Senior Member
    Join Date
    Dec 2019
    Posts
    121

    Array handling in the audio tool.

    Is array declaration on the roadmap for audio tool development? It would be of some use for more complicated designs, as currently you can't declare arrays of wavetables and fill that array with declared wavetables and have it work... the only workaround I have found is to manually instantiate the arrays and patch chords, which when you have hundreds of these connections can be quite tedious.

  2. #2
    Junior Member
    Join Date
    Sep 2019
    Location
    Sevilla, Spain
    Posts
    11
    the audio tool does not support arrays of objects, but you could manage anything done with the design tool making an array of pointers,

    Code:
    AudioSynthSimpleDrum     drum0;          //xy=219,42
    AudioSynthSimpleDrum     drum1;          //xy=219,162
    AudioSynthSimpleDrum     drum2;          //xy=219,282
    AudioSynthSimpleDrum     drum3;          //xy=219,402
    AudioSynthSimpleDrum     drum4;          //xy=219,522
    AudioSynthSimpleDrum     drum5;          //xy=219,642
    AudioSynthSimpleDrum     drum6;          //xy=219,762
    AudioSynthSimpleDrum     drum7;          //xy=219,882
    
    AudioSynthSimpleDrum     *drum[8] = {
      &drum0, &drum1, &drum2, &drum3, &drum4, &drum5, &drum6, &drum7 };
    and then use it like this

    Code:
      drum[x]->frequency( y );
      drum[x]->noteOn();
    does it help?

  3. #3
    Senior Member
    Join Date
    Dec 2019
    Posts
    121
    Yes, ty. I realized this the other day when I started working on my wavetable project again. It would be nice to add this info somewhere in the audio tool documentation because it seems a common issue. Given the processing power of the t4 4.1 platforms array support would be nice but the workarounds presented on the forum are helpful. IDK why I'm always asking the forum for things I could prob do my lazy self, lol. I imagine PJRC has their hands full with well designing teensy and writing large swathes of the library. Ty for your reply and cheers!

  4. #4
    Member
    Join Date
    Apr 2020
    Location
    Tucson
    Posts
    43
    In the designer tool you can declare names like mixer[1] instead of mixer1, mixer2, etc. The design tool still sucks for this when copying and pasting, requiring you to manually go back and change all the mixer[0]1 (for example) to mixer[2] because the copy paste doesn't understand the notation. Aside form this limitation, the design tool will properly create all the wire connections and such. However, when I tried this I could not get it to work even after a MyControlArray* = new MyControlArray[n] declaration. If you could make a simple sketch that shows this working I can build a python script to handle the rest of the automation. Python and bash are my forte.

  5. #5
    Senior Member
    Join Date
    Dec 2019
    Posts
    121
    Quote Originally Posted by boxxofrobots View Post
    In the designer tool you can declare names like mixer[1] instead of mixer1, mixer2, etc. The design tool still sucks for this when copying and pasting, requiring you to manually go back and change all the mixer[0]1 (for example) to mixer[2] because the copy paste doesn't understand the notation. Aside form this limitation, the design tool will properly create all the wire connections and such. However, when I tried this I could not get it to work even after a MyControlArray* = new MyControlArray[n] declaration. If you could make a simple sketch that shows this working I can build a python script to handle the rest of the automation. Python and bash are my forte.
    So like this:

    in audio tool you make mixer[1] mixer[2] mixer[3] mixer[4]

    comment out the auto gui declared mixer[1] mixer[2] mixer[3] mixer[4]

    do not comment out the patchchord connections, only the variable declarations

    then right below your */*/ block

    declare the pointer array like this: AudioMixer4* mixer = new AudioMixer4[4];

    it must have the same name as the dummy audio tool declarations.

    Hope that clarifies it!

  6. #6

  7. #7
    Senior Member
    Join Date
    Dec 2019
    Posts
    121
    if you still have difficulty pls post your code and I will help correct it

  8. #8
    Senior Member
    Join Date
    May 2019
    Location
    Brisbane, QLD
    Posts
    104
    Quote Originally Posted by RABB17 View Post
    Is array declaration on the roadmap for audio tool development? It would be of some use for more complicated designs, as currently you can't declare arrays of wavetables and fill that array with declared wavetables and have it work... the only workaround I have found is to manually instantiate the arrays and patch chords, which when you have hundreds of these connections can be quite tedious.
    There's nothing inherently different dealing with arrays inside vs outside audio library from my experience.
    I find it's easier to declare and initialize the array in the .cpp file of your audio object, and reference it outside with extern.

    i.e inside audio object .cpp;

    Code:
    float variable1[16];
    outside;

    Code:
    extern float variable1[];

  9. #9
    Senior Member
    Join Date
    Dec 2019
    Posts
    121
    extern? my god c++ is so ugly XD

  10. #10
    Senior Member
    Join Date
    Dec 2019
    Posts
    121
    frankenlanguage. idk whats worse, garbage syntax or garbage collectors

  11. #11
    Junior Member
    Join Date
    Jun 2020
    Posts
    4
    You can check my code at github https://github.com/manicken/teensy4.0polysynth
    It have 3 osc + wavetable player for each "voice" and also have one mixer in the class, note the pointer use for the Audioconnection, without this pointer-use the audio dont work.

Posting Permissions

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