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

Thread: Vocoders, inverse FFTs, and custom audio objects/blocks in the Audio library?

  1. #1
    Junior Member
    Join Date
    Oct 2019
    Posts
    14

    Vocoders, inverse FFTs, and custom audio objects/blocks in the Audio library?

    Hi All,

    Still on the Halloween kick, looking for cool voice modulations.

    I'd love to get something like this vocoder example (details below).

    I have a couple of Dalek voices working, including this one from the PRJC site and from the forum.

    I've found this C implementation (which generated the sample above) that I seems to be meant to be run offline. I'm wondering how feasible it would be to [re]-implement it in/using the Audio library. Seems like the inputs (mic for modulator, SD wav file for carrier) are taken care of, FFT's exist, "all" that's left is combining the inputs and an inverse FFT.

    I still need to investigate these two:



    I'm naive about audio and am certain that I'm glossing over a lot. Before I embark on trying to do something that Just Won't Work, I'd appreciate any ideas, feedback, and/or alternative ideas.

    Thanks,

    g.

  2. #2
    Well, are you wanting to create your own implementation from scratch just for the sake of it? You've linked to 2 different ways of doing it on a Teensy, so it is indeed possible.

    I've not tried Duffy's but that is definitely the one I would start with. It certainly looks like a nice solution, just pull the source files into your environment, and you should be able to use it.

    Revalogics' implementation is an interesting idea, he's constructed the vocoder entirely out of existing objects in the Audio library. Interesting as a proof of concept, but probably too inconvenient for my tastes.

  3. #3
    Junior Member
    Join Date
    Oct 2019
    Posts
    14
    Quote Originally Posted by wcalvert View Post
    Well, are you wanting to create your own implementation from scratch just for the sake of it? You've linked to 2 different ways of doing it on a Teensy, so it is indeed possible.
    I'd definitely prefer to use something that exists (at least for *this* costume season). I included the two that I found as a down payment on doing my own homework and with the hope that someone might wave me off if e.g. the implementations no longer work or only work on the 3.6 (unlikely, but...) or .... My first try at Reveallogic's version was a bust, but I need to poke at it more before I call for help.

    Thanks!

  4. #4
    Junior Member
    Join Date
    Oct 2019
    Posts
    14
    I've gotten duff2013's implementation working: copied the repository into `~/Documents/Arduino/Vocoder, cd'ed into a copy of the "wet" example, and reworked (using various other bits I've been cargo-culting)) the `.ino` file into this:

    Code:
    /* hartzell --- Mon Oct 21 13:19:01 PDT 2019
     * Phase Vocoder example Female Voice Wet Mix.
     */
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include "effect_vocoder.h"
    
    const int myInput = AUDIO_INPUT_MIC;
    //const int myInput = AUDIO_INPUT_LINEIN;
    
    AudioInputI2S        audioInput;
    AudioEffectVocoder   vocoder;
    AudioMixer4          mix;
    AudioOutputI2S       i2s1;
    
    AudioConnection patch1    (audioInput, vocoder);
    AudioConnection patch2    (vocoder, 0, mix, 0);
    AudioConnection patch3    (audioInput, 0, mix, 1);
    AudioConnection patch4a   (mix, 0, i2s1, 0);
    AudioConnection patch4b   (mix, 0, i2s1, 1);
    
    AudioControlSGTL5000 audioShield;
    
    void setup() {
      AudioMemory(16);
      audioShield.enable();
      audioShield.inputSelect(myInput);
      audioShield.micGain(42);
      audioShield.volume(.8);
      mix.gain(0, 0.6);   // vocoder
      mix.gain(1, 0.2);   // mic
    
      vocoder.setPitchShift(10);
    }
    
    void loop() {
    }
    This does a fairly good job of making me sound like Gollum breathing helium, but isn't nearly as robotic as my holy grail (as demo'ed by this sample). Apparently (audio neophyte here...) that effect comes from blending together multiple inputs. Revalogic's implementation *does* do that, it's next on my test drive list.

  5. #5
    Junior Member
    Join Date
    Oct 2019
    Posts
    14
    Quote Originally Posted by hartzell View Post
    I still need to investigate these two:

    I have revalogics' vocoder working on my Teensy4 w/ audio shield, though I'm not sure it's doing what it's supposed to do. I can't find his supplementary material on either the download site or the Google site. I've sent him a direct message.

    I needed to rework it a bit to use my microphone input, replace the usb input with a SD file, disable the unused USB output, and set up the audioshield.

    I've stuffed it all into a GitHub repository, you can review the changes that I made to get it going on this compare page.

    Based on the original post's description, I expected a PeterFrampton-esque blending of the "instrument" (Star Wars saber sound, in my case) and my voice.

    What I'm getting sounds more like a simple mixing of my voice and the saber sound.

    I'm not sure if it's working as intended or if my "modifications" aren't equivalent to the original code.

    I'd welcome feedback.

Posting Permissions

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