Changing Pitch of Voice

Status
Not open for further replies.

lerxstrulz

Well-known member
Hi All,

I have a project where I would like to be able to adjust the pitch of a person's voice. I have tried using the Filter and different values for octaveControl and resonance, but it seems to just end up sounding kinda muffled at the same pitch (I'm probably doing it wrong ;) )

Is there are way with one of the filters (or another method) to take someone's voice and either raise or lower the pitch on output?

Thanks!

- Brent
 
I'm very new to the Audio Library. so could be very wrong here..

Wouldn't the SINE_FM object in the Audio Library achieve this effect?
by modulating the incoming voice waveform against a sine wav?

This should increase/decrease the pitch i think.
 
My pitch shifter is running on the Teensy 3.2 in real time, with gobs of cycles to spare. So it is certainly doable...
 
I don't understand your question. It is for the teensy, I've had to create lots of custom audio functions since the library was lacking.
 
I don't understand your question. It is for the teensy, I've had to create lots of custom audio functions since the library was lacking.

I was asking whether you had written custom code (software) for the Teensy or if you had implemented a hardware solution to accomplish the pitch change. Thank you for the answer.
 
Any chance you might share some of these improvements?

As of right now I have a full band audio compressor that is ready for public consumption. Are you interested in that? I use it to compress the audio output when multiple sounds are being played out so you dont get that nasty overflow popping.
 
Ok here is the full-band compressor. It can also act as a limiter if you make compression ratio P large (like P>=40)

Also you can use the peak or rms block to regularly update the compression gain.
 

Attachments

  • effect_compressor_fb.zip
    2.6 KB · Views: 357
Here is a simple vocal compressor ex using the input mic. Comp ratio set to 4.


Code:
/*
c
* Vocal compression example
* Author:  J. Shima
* 
  - released

The audio board uses the following pins.
 6 - MEMCS
 7 - MOSI
 9 - BCLK
10 - SDCS
11 - MCLK
12 - MISO
13 - RX
14 - SCLK
15 - VOL
18 - SDA
19 - SCL
22 - TX
23 - 
*/

#include <Audio.h>
#include <Wire.h>
#include <SD.h>
#include <SPI.h>
#include <SerialFlash.h>

// Use these with the audio adaptor board
#define SDCARD_CS_PIN    10
#define SDCARD_MOSI_PIN  7
#define SDCARD_SCK_PIN   14

const int myInput = AUDIO_INPUT_MIC;
//const int myInput = AUDIO_INPUT_LINEIN;

// GUItool: begin automatically generated code
AudioInputI2S            audioInput;    
AudioAnalyzeRMS          rms;           
AudioEffectCompressor    compress;
AudioOutputI2S           audioOutput;   

AudioConnection          patchCord1(audioInput, 0, rms, 0);
AudioConnection          patchCord2(audioInput, 0, compress, 0);
AudioConnection          patchCord3(compress, 0, audioOutput, 0);
AudioConnection          patchCord4(compress, 0, audioOutput, 1);
AudioControlSGTL5000     audioShield;  

#define ALPHA  0.8 // time constant of 45ms

//
//---- Global variables -----
float rms_cur;
float env = 0;
unsigned long last_time = millis();
int cnt = 0;

//================ main loop ==============================
void loop()
{
  
  // timer loop at 10ms
  while(millis() - last_time < 10);

  last_time = millis(); 

  //update env (pwr) for compressor
  if(rms.available())
  {
      rms_cur = rms.read();
      env = rms_cur + ALPHA*(env - rms_cur);
         
      compress.update_pwr( env );  //update compressor cN est
  }

  if(++cnt >= 100)  //every sec
  {
      cnt = 0;
      Serial.print("Comp gain: ");
      Serial.println(compress.get_gain());
  }
  
}  //loop


//------------ Init routine ---------------
void setup()
{
  int waitcnt;
  
  Serial.begin(9600);
  delay(300);
  
  // ----------------------
  AudioMemory(10);
  audioShield.enable();
  audioShield.inputSelect(myInput);
  audioShield.volume(0.5);

  compress.begin(1, 0.5, 4);  //en, thresh c0, comp ratio p
    
  SPI.setMOSI(SDCARD_MOSI_PIN);
  SPI.setSCK(SDCARD_SCK_PIN);
  if (!(SD.begin(SDCARD_CS_PIN))) 
  {
      waitcnt = 0;
      // stop here, but print a message repetitively
      while (1)
      {
          Serial.println("Unable to access the SD card");
          
          if(++waitcnt >= 5)
          {  
              Serial.println("Could not find SD card, continuing....");
              break;
          }
      }
  }
    
  Serial.println("setup done");
  
} //setup()
 
Hi Paul, i'm totally new to Teensy and it would really help me if you could explain some questions here regarding this project.
Is the teensy audio library referring to the functions on audio design tool?
Has the audio library been updated with a pitch shifting code yet?
thank you so much!!
 
Status
Not open for further replies.
Back
Top