How to add granular to audio playback to control speed in Realtime without affect pitch of sample??

charnjit

Well-known member
i want to do playback speed slower/faster in realtime without affect pitch. by search in google i found it is possible thru granular.
as below simple sketch i wrote my 2sec audio files are loaded to PSRAM . Then they are played well by playArray from serial INPUT.

C++:
#include <Arduino.h>
#include <Audio.h>
#include <SD.h>
#include <TeensyVariablePlayback.h>       
#include <SPI.h>
#include <Wire.h>

AudioPlaySdResmp        playSdWav1;
AudioPlaySdResmp        playSdWav2;
AudioPlayArrayResmp  playArrayWav1;
AudioPlayArrayResmp  playArrayWav2;
AudioPlayArrayResmp  playArrayWav3;
AudioPlayArrayResmp  playArrayWav4;

AudioPlayArrayResmp *playArray[] = {
                                       &playArrayWav1,
                                       &playArrayWav2,
                                       &playArrayWav3,
                                       &playArrayWav4};

  AudioMixer4            mixer1;
  AudioMixer4              mixer2;

  AudioOutputI2S i2s2;

  AudioConnection          patchCord1(playSdWav1, 0, mixer2, 0);
AudioConnection          patchCord2(playSdWav1, 0, mixer2, 1);

AudioConnection          patchCord3(playArrayWav1, 0, mixer1, 0);
AudioConnection          patchCord4(playArrayWav2, 0, mixer1, 1);
AudioConnection          patchCord5(playArrayWav3, 0, mixer1, 2);
AudioConnection          patchCord6(playArrayWav4, 0, mixer1, 3);
AudioConnection          patchCord7(mixer1, 0, i2s2, 1);
AudioConnection          patchCord8(mixer1, 0, i2s2, 0);

AudioControlSGTL5000 audioShield;

#define NUM_WAVS 16 // avoid silly mistakes

float Speed = 1.00;

const char *SMP_WAV[NUM_WAVS] = { "01.WAV", "02.WAV", "03.WAV", "04.WAV", "05.WAV", "06.WAV", "07.WAV", "08.WAV", "09.WAV", "10.WAV", "11.WAV", "12.WAV", "13.WAV", "14.WAV", "15.WAV", "16.WAV" };
File x_File;
int16_t *SMP_addr[NUM_WAVS];
uint32_t sizes[NUM_WAVS];

void setup()       {
                       Serial.begin(57600);
                         if (!(SD.begin(BUILTIN_SDCARD))) {
    while (1) {
      Serial.println("Unable to access the SD card");
      delay(500);
    }
  }
          AudioMemory(128);
         audioShield.enable();                                                   
         audioShield.volume(0.5);
             for (int i = 0; i < 4; i++)  {
                                           playArray[i]->enableInterpolation(true);
                                           }
                  RAM_LOAD ();
                    }

                    void loop() {

                      //----------------------SERIAL.AVALABLE CODE-------------------------
  if (Serial.available() > 0) {
    String incomingByte = Serial.readString();                           
                           incomingByte.trim();       //
        if ( incomingByte == "1")    {       playArray[1]->playWav(SMP_addr[1]);
                                           playArray[1]->setLoopType(looptype_repeat); 
                                        } 
        if ( incomingByte == "2")    {       playArray[2]->playWav(SMP_addr[2]);    }
         if ( incomingByte == "0")    {     playArray[1]->stop();   playArray[2]->stop();    }
          if ( incomingByte == "8")    {   
                                      Speed = Speed+0.05;
                                      // APPLY GRANULAR  SPEED
                                       }
           if ( incomingByte == "9")    {   
                                      Speed = Speed-0.05;
                                      // APPLY GRANULAR SPEED 
                                       } 
                            }
                           //----------------------SERIAL.AVALABLE-CODE------------------------
                    }



                void RAM_LOAD ()  {                   
  int SMP_FILE_NUM=0;
  for (int i = 0; i < NUM_WAVS; i++) {
                              x_File = SD.open(SMP_WAV[i], FILE_READ);
                             if (x_File)
                                         {
      sizes[i] = x_File.size();
      SMP_addr[i] = (int16_t*) extmem_malloc(sizes[i]);
      if (nullptr == SMP_addr[i])
        Serial.printf("Failed to allocate %d in EXTMEM for %s\n", sizes[i], SMP_WAV[i]);
      else     {
        if (sizes[i] != x_File.read(SMP_addr[i], sizes[i]))
        {
          Serial.printf("Failed to read in %s - wrong length\n", SMP_WAV[i]);
          extmem_free(SMP_addr[i]); // free memory
          SMP_addr[i] = nullptr;    // mark as "not loaded"
        }
        else
          Serial.printf("Read %s into memory at %08X; %d bytes\n", SMP_WAV[i], SMP_addr[i], sizes[i]); 
      }
      x_File.close();
    }
    else
      Serial.printf("Failed to open %s\n", SMP_WAV[i]);
  }
}
i tried very much to find simple use of granular in Arrayplayback . but i could not found simple or not understand complex use of this object
could you please reply how to add Granular object in my code to get playback slower / faster with variable Speed in my code.
thank you.....
 
i add granular code to above code by mobile google search result.
C++:
#include <Arduino.h>
#include <Audio.h>
#include <SD.h>
#include <TeensyVariablePlayback.h>       
#include <SPI.h>
#include <Wire.h>

AudioPlaySdResmp        playSdWav1;
AudioPlaySdResmp        playSdWav2;
AudioPlayArrayResmp  playArrayWav1;
AudioPlayArrayResmp  playArrayWav2;
AudioPlayArrayResmp  playArrayWav3;
AudioPlayArrayResmp  playArrayWav4;

AudioEffectGranular granular1;      //  GR

AudioPlayArrayResmp *playArray[] = {
                                       &playArrayWav1,
                                       &playArrayWav2,
                                       &playArrayWav3,
                                       &playArrayWav4};

  AudioMixer4            mixer1;
  AudioMixer4              mixer2;

  AudioOutputI2S i2s2;

  AudioConnection          patchCord1(playSdWav1, 0, mixer2, 0);
AudioConnection          patchCord2(playSdWav1, 0, mixer2, 1);

AudioConnection          patchCord3(playArrayWav1, 0, granular1, 0);
AudioConnection          patchCord9(granular1,0,mixer1,0);
AudioConnection          patchCord4(playArrayWav2, 0, mixer1, 1);
AudioConnection          patchCord5(playArrayWav3, 0, mixer1, 2);
AudioConnection          patchCord6(playArrayWav4, 0, mixer1, 3);
AudioConnection          patchCord7(mixer1, 0, i2s2, 1);
AudioConnection          patchCord8(mixer1, 0, i2s2, 0);

AudioControlSGTL5000 audioShield;

#define NUM_WAVS 16 // avoid silly mistakes

float Speed = 1.00;

const char *SMP_WAV[NUM_WAVS] = { "01.WAV", "02.WAV", "03.WAV", "04.WAV", "05.WAV", "06.WAV", "07.WAV", "08.WAV", "09.WAV", "10.WAV", "11.WAV", "12.WAV", "13.WAV", "14.WAV", "15.WAV", "16.WAV" };
File x_File;
int16_t *SMP_addr[NUM_WAVS];
uint32_t sizes[NUM_WAVS];

        #define GR_BUF_SIZE 176400  //  GR
        int16_t granularBuffer[GR_BUF_SIZE]; // gr
      
void setup()       {
                       Serial.begin(57600);
                         if (!(SD.begin(BUILTIN_SDCARD))) {
    while (1) {
      Serial.println("Unable to access the SD card");
      delay(500);
    }
  }
          AudioMemory(128);
        
         audioShield.enable();                                                 
         audioShield.volume(0.5);
          granular1.begin(granularBuffer,GR_BUF_SIZE); // gr
             for (int i = 0; i < 4; i++)  {
                                           playArray[i]->enableInterpolation(true);
                                           }
                                            Serial.println("RAM LOAD START...");
                  RAM_LOAD ();
                 Serial.println("PLAYING SMP_addr_0");   playArray[0]->playWav(SMP_addr[0]);
                    }

                    void loop() {

                      //----------------------SERIAL.AVALABLE-------------------------
  if (Serial.available() > 0) {
    String incomingByte = Serial.readString();                           
                           incomingByte.trim();       //
        if ( incomingByte == "1")    {       playArray[0]->playWav(SMP_addr[0]);
                                           playArray[0]->setLoopType(looptype_repeat); 
                                        } 
        if ( incomingByte == "2")    {       playArray[1]->playWav(SMP_addr[1]);    }
         if ( incomingByte == "0")    {     playArray[0]->stop();   playArray[1]->stop();    }
          if ( incomingByte == "8")    {   
                                      Speed = Speed+0.05;
                                      // APPLY GRANULAR  SPEED
                                      granular1.setSpeed(Speed);
                                        Serial.println(Speed);
                                       }
           if ( incomingByte == "9")    {   
                                      Speed = Speed-0.05;
                                      // APPLY GRANULAR SPEED 
                                       } 
                            }
                           //----------------------SERIAL.AVALABLE-------------------------
                    }



                void RAM_LOAD ()  {                 
 
  int SMP_FILE_NUM=0;
  for (int i = 0; i < NUM_WAVS; i++) {
                              x_File = SD.open(SMP_WAV[i], FILE_READ);
                             if (x_File)
                                         {
      sizes[i] = x_File.size();
      SMP_addr[i] = (int16_t*) extmem_malloc(sizes[i]);
      if (nullptr == SMP_addr[i])
        Serial.printf("Failed to allocate %d in EXTMEM for %s\n", sizes[i], SMP_WAV[i]);
      else     {
        if (sizes[i] != x_File.read(SMP_addr[i], sizes[i]))
        {
          Serial.printf("Failed to read in %s - wrong length\n", SMP_WAV[i]);
          extmem_free(SMP_addr[i]); // free memory
          SMP_addr[i] = nullptr;    // mark as "not loaded"
        }
        else
          Serial.printf("Read %s into memory at %08X; %d bytes\n", SMP_WAV[i], SMP_addr[i], sizes[i]); 
      }
      x_File.close();
    }
    else
      Serial.printf("Failed to open %s\n", SMP_WAV[i]);
  }
}
Audio is being played in Seamless looped on Serial input. Also being changed Variable Speed in Serial monitor. but not getting changes in playback speed of Audio file . my Audio file is 3-4sec long. what method i am missing???
 
i seemed granular start works. but i am don't understand what should be used with granular1.setSpeed(Speed);
NOTE: my audio drum beat being loaded to psram is 2sec (390kb). it is played in loop mode seamlessly .
i start playback in loop mode
then i call Speed= 1.5; granular1.setSpeed(Speed); there is no changes in playback.
then i call granular1.beginFreeze(200); it start giving small pitch_up effect in begining & looping disturbed.
then i cal granular1.stop(); No changes.
then i call granular1.beginFreeze(200); again . i got a Small another changes in begining playback.
then i s stop playback playArray[0]->stop(); & play again it by playArray[0]->playWav(SMP_addr[0]); playArray[0]->setLoopType(looptype_repeat);
i got audio not begin And in Serial monitor
expected RIFF (was U�0H���gq�\eb��")
please reply how it is use on short audio(1-6 sec long) in loop mode whitout affect qualiy etc.
thank you
 
i am very puzzled in functions of Granular. i explored & tried very much . but could not success. i am not getting slower/faster playback @ all efforts.
speed slower/faster inputs are affecting pitch and distroyed audio quality of audio.
if i stop playback once, i can not replay it again ,,,,, getting in Serial Monitor
expected RIFF (was wB����C���) again showing my trying code
Code:
#include <Arduino.h>
#include <Audio.h>
#include <SD.h>
#include <TeensyVariablePlayback.h>       
#include <SPI.h>
#include <Wire.h>                                   //  SERIAL+AUDIO+MIDI

AudioPlaySdResmp        playSdWav1;
AudioPlaySdResmp        playSdWav2;

AudioEffectGranular   granular1;

AudioPlayArrayResmp  playArrayWav1;
AudioPlayArrayResmp  playArrayWav2;
AudioPlayArrayResmp  playArrayWav3;
AudioPlayArrayResmp  playArrayWav4;

AudioPlayArrayResmp *playArray[] = {
                                       &playArrayWav1,
                                       &playArrayWav2,
                                       &playArrayWav3,
                                       &playArrayWav4};

  AudioMixer4            mixer1;
  AudioMixer4              mixer2;

  AudioOutputI2S i2s2;

  AudioConnection          patchCord1(playSdWav1, 0, mixer2, 0);
AudioConnection          patchCord2(playSdWav1, 0, mixer2, 1);

AudioConnection          patchCord3(playArrayWav1, 0,granular1,0 );
AudioConnection          patchCord9(granular1,0,mixer1,0);
 
AudioConnection          patchCord4(playArrayWav2, 0, mixer1, 1);
AudioConnection          patchCord5(playArrayWav3, 0, mixer1, 2);
AudioConnection          patchCord6(playArrayWav4, 0, mixer1, 3);
AudioConnection          patchCord7(mixer1, 0, i2s2, 1);
AudioConnection          patchCord8(mixer1, 0, i2s2, 0);

AudioControlSGTL5000 audioShield;

#define NUM_WAVS 16 // avoid silly mistakes

float Speed = 1.00;
int GR_PitchShift = 20;
int GR_Freeze = 50;

const char *SMP_WAV[NUM_WAVS] = { "01.WAV", "02.WAV", "03.WAV", "04.WAV", "05.WAV", "06.WAV", "07.WAV", "08.WAV", "09.WAV", "10.WAV", "11.WAV", "12.WAV", "13.WAV", "14.WAV", "15.WAV", "16.WAV" };
File x_File;
int16_t *SMP_addr[NUM_WAVS];
uint32_t sizes[NUM_WAVS];

void setup()       {
                       Serial.begin(57600);
                         if (!(SD.begin(BUILTIN_SDCARD))) {
    while (1) {
      Serial.println("Unable to access the SD card");
      delay(500);
    }
  }
          AudioMemory(128);
         audioShield.enable();                                               
         audioShield.volume(0.5);
             for (int i = 0; i < 4; i++)  {
                                           playArray[i]->enableInterpolation(true);
                                           }
                  RAM_LOAD ();
                   granular1.begin(SMP_addr[0], sizes[0]);
                  granular1.beginFreeze(200);   
                 Serial.println("PLAYING SMP_addr_0");   
                 playArray[0]->playWav(SMP_addr[0]);
                  playArray[0]->setLoopType(looptype_repeat);
                      usbMIDI.setHandleControlChange(myControlChange);
                    }

                    void loop() {
                       usbMIDI.read();

                      //----------------------SERIAL.AVALABLE-------------------------
  if (Serial.available() > 0) {
    String incomingByte = Serial.readString();                           
                           incomingByte.trim();       //
                         if (incomingByte=="1") {
                                           granular1.stop();
                                           playArray[0]->playWav(SMP_addr[0]);
                                           playArray[0]->setLoopType(looptype_repeat); 
                                                }
      
                          if (incomingByte=="0") {
                                           granular1.stop();   
                                           playArray[0]->stop();   
                                           playArray[1]->stop();
                                                }
                           if (incomingByte=="9") {
                                           Speed = Speed+0.05;
                                           Serial.println(Speed);
                                           granular1.setSpeed(Speed);
                                           granular1.beginFreeze(GR_PitchShift); 
                                                }
                            if (incomingByte=="8") {   
                                           Speed = Speed-0.05;
                                           Serial.println(Speed);
                                           granular1.setSpeed(Speed);
                                           granular1.beginFreeze(GR_PitchShift); 
                                                  } 
                              if (incomingByte=="S") {
                                           granular1.stop();
                                                    }
                               if (incomingByte=="M") {
                                           Speed= 1.5;   
                                           granular1.setSpeed(Speed);   
                                           Serial.println(Speed);
                                                    }
                            }
                           //----------------------SERIAL.AVALABLE-------------------------
                             granular1.setSpeed(Speed);
                    }



                void RAM_LOAD ()  {                 
              
  int SMP_FILE_NUM=0;
  for (int i = 0; i < NUM_WAVS; i++) {
                              x_File = SD.open(SMP_WAV[i], FILE_READ);
                             if (x_File)
                                         {
      sizes[i] = x_File.size();
      SMP_addr[i] = (int16_t*) extmem_malloc(sizes[i]);
      if (nullptr == SMP_addr[i])
        Serial.printf("Failed to allocate %d in EXTMEM for %s\n", sizes[i], SMP_WAV[i]);
      else     {
        if (sizes[i] != x_File.read(SMP_addr[i], sizes[i]))     
        {
          Serial.printf("Failed to read in %s - wrong length\n", SMP_WAV[i]);
          extmem_free(SMP_addr[i]); // free memory
          SMP_addr[i] = nullptr;    // mark as "not loaded"
        }
        else
          Serial.printf("Read %s into memory at %08X; %d bytes\n", SMP_WAV[i], SMP_addr[i], sizes[i]); 
      }
      x_File.close();
    }
    else
      Serial.printf("Failed to open %s\n", SMP_WAV[i]);
  }
}


 void  myControlChange() {    // -------------------PD-------------------------------------------------------------------------------------
            byte CC_NUMBER = usbMIDI.getData1();
            int CC_VALUE = usbMIDI.getData2();
             byte CC_CHANNEL = usbMIDI.getChannel();
           if (CC_NUMBER==1)   {
                                 byte val= map (CC_VALUE,0,127,20,50);
                                     GR_PitchShift = val;     // GR_Freeze = 0; 
                                   Serial.print("beginPitchShift: ");  Serial.println(GR_PitchShift);   
                                      } 
               if (CC_NUMBER==2)   {
                                 byte val= map (CC_VALUE,0,127,50,200);
                                    GR_Freeze = val;   
                                    Serial.println("GR_Freeze: ");  Serial.println(GR_Freeze);
                                      
                                      } 
                  if (CC_NUMBER==3)   {
                                 float val= map (CC_VALUE,0,127,30,160);
                                  Speed = val/100;
                                     granular1.setSpeed(Speed); 
                                    granular1.beginPitchShift(GR_PitchShift);
                                    Serial.print("Speed  =  ");  Serial.println(Speed);     
                                      } 

          
              //     
                  }
Code:
Target updates fro granular : Assign 16 drum loops to 16 buttons to play on Master Speed and Master Pitch (play only one audio one time ) in seamlessly repeat mode. 2 buttons to slower/faster placyback . able to free Psram and re-load new audio files, when need.
but yet i could not play a single drum loop in right way . i think i am wrong here , if any one has been done this kind of or know some hint. please reply something or the other. i have attach wav file and pure data file to contol . in my sketch used files (02.wav ... to.. ...16.wav) are same copy of "01.wav". plaese guide me , how to use granular to achieve my Target updates:
THANK YOU.........
 

Attachments

  • Granular Control.zip
    418 bytes · Views: 12
  • 01.zip
    292.7 KB · Views: 12
i tried to follow Paul's example
https://github.com/PaulStoffregen/Audio/blob/master/examples/Effects/Granular/Granular.ino
as i don't have soldered button/knobs , i control it by Pure Data's Slider/buttons [file Attached below]
code is:
C++:
#include <Arduino.h>
#include <Audio.h>
#include <SD.h>
#include <TeensyVariablePlayback.h>       
#include <SPI.h>
#include <Wire.h>                                   //  SERIAL+AUDIO+MIDI

AudioPlaySdResmp        playSdWav1;
AudioPlaySdResmp        playSdWav2;

AudioEffectGranular   granular1;

AudioPlayArrayResmp  playArrayWav1;
AudioPlayArrayResmp  playArrayWav2;
AudioPlayArrayResmp  playArrayWav3;
AudioPlayArrayResmp  playArrayWav4;

AudioPlayArrayResmp *playArray[] = {
                                       &playArrayWav1,
                                       &playArrayWav2,
                                       &playArrayWav3,
                                       &playArrayWav4};

  AudioMixer4            mixer1;
  AudioMixer4              mixer2;

  AudioOutputI2S i2s2;

  AudioConnection          patchCord1(playSdWav1, 0, mixer2, 0);
AudioConnection          patchCord2(playSdWav1, 0, mixer2, 1);

AudioConnection          patchCord3(playArrayWav1, 0,granular1,0 );
AudioConnection          patchCord9(granular1,0,mixer1,0);
 
AudioConnection          patchCord4(playArrayWav2, 0, mixer1, 1);
AudioConnection          patchCord5(playArrayWav3, 0, mixer1, 2);
AudioConnection          patchCord6(playArrayWav4, 0, mixer1, 3);
AudioConnection          patchCord7(mixer1, 0, i2s2, 1);
AudioConnection          patchCord8(mixer1, 0, i2s2, 0);

AudioControlSGTL5000 audioShield;

#define NUM_WAVS 16 // avoid silly mistakes

float Speed = 1.00;
int GR_PitchShift = 20;
int GR_Freeze = 50;
float knobA1 = 512.0;
float knobA2 = 512.0;
float knobA3 = 512.0;

const char *SMP_WAV[NUM_WAVS] = { "01.WAV", "02.WAV", "03.WAV", "04.WAV", "05.WAV", "06.WAV", "07.WAV", "08.WAV", "09.WAV", "10.WAV", "11.WAV", "12.WAV", "13.WAV", "14.WAV", "15.WAV", "16.WAV" };
File x_File;
int16_t *SMP_addr[NUM_WAVS];
uint32_t sizes[NUM_WAVS];

void setup()       {
                       Serial.begin(57600);
                         if (!(SD.begin(BUILTIN_SDCARD))) {
    while (1) {
      Serial.println("Unable to access the SD card");
      delay(500);
    }
  }
          AudioMemory(128);
         audioShield.enable();                                               
         audioShield.volume(0.5);
             for (int i = 0; i < 4; i++)  {
                                           playArray[i]->enableInterpolation(true);
                                           }
                  RAM_LOAD ();
                   granular1.begin(SMP_addr[0], sizes[0]);
                 // granular1.beginFreeze(200);   
                 Serial.println("PLAYING SMP_addr_0");   
                 playArray[0]->playWav(SMP_addr[0]);
                  playArray[0]->setLoopType(looptype_repeat);
                      usbMIDI.setHandleControlChange(myControlChange);
                      
                    }

                    void loop() {
                       usbMIDI.read();

                      //----------------------SERIAL.AVALABLE-------------------------
  if (Serial.available() > 0) {
    String incomingByte = Serial.readString();                           
                           incomingByte.trim();       //
                         if (incomingByte=="1") {
                                           granular1.stop();
                                           playArray[0]->playWav(SMP_addr[0]);
                                           playArray[0]->setLoopType(looptype_repeat);
                                                }
      
                          if (incomingByte=="0") {
                                           granular1.stop();   
                                           playArray[0]->stop();   
                                           playArray[1]->stop();
                                                }
                          

                            }
                           //----------------------SERIAL.AVALABLE-------------------------
                               float ratio;
                              ratio = powf(2.0, knobA2 * 2.0 - 1.0); // 0.5 to 2.0
                             //ratio = powf(2.0, knobA2 * 6.0 - 3.0); // 0.125 to 8.0 -- uncomment for far too much range!
                              granular1.setSpeed(ratio);
                    }



                void RAM_LOAD ()  {                 
              
  int SMP_FILE_NUM=0;
  for (int i = 0; i < NUM_WAVS; i++) {
                              x_File = SD.open(SMP_WAV[i], FILE_READ);
                             if (x_File)
                                         {
      sizes[i] = x_File.size();
      SMP_addr[i] = (int16_t*) extmem_malloc(sizes[i]);
      if (nullptr == SMP_addr[i])
        Serial.printf("Failed to allocate %d in EXTMEM for %s\n", sizes[i], SMP_WAV[i]);
      else     {
        if (sizes[i] != x_File.read(SMP_addr[i], sizes[i]))     
        {
          Serial.printf("Failed to read in %s - wrong length\n", SMP_WAV[i]);
          extmem_free(SMP_addr[i]); // free memory
          SMP_addr[i] = nullptr;    // mark as "not loaded"
        }
        else
          Serial.printf("Read %s into memory at %08X; %d bytes\n", SMP_WAV[i], SMP_addr[i], sizes[i]);
      }
      x_File.close();
    }
    else
      Serial.printf("Failed to open %s\n", SMP_WAV[i]);
  }
}


 void  myControlChange() {    // -------------------PD-------------------------------------------------------------------------------------
            byte CC_NUMBER = usbMIDI.getData1();
            int CC_VALUE = usbMIDI.getData2();
             byte CC_CHANNEL = usbMIDI.getChannel();
           if (CC_NUMBER==1)   {    // knobA3
                                 knobA3=CC_VALUE*8.00;
                                      } 
                  if (CC_NUMBER==3)   {  //knobA2
                                      knobA2= CC_VALUE*8;
                                      Serial.print("Speed");   Serial.println(powf(2.0, knobA2 * 2.0 - 1.0));
                                      }
                   if (CC_NUMBER==11)   {  // BUTTON 0
                                     if (CC_VALUE==1){
                                                   float msec = 100.0 + (knobA3 * 190.0);
                                                   granular1.beginFreeze(msec);
                                                   Serial.print("Begin granular freeze using ");
                                                   Serial.print(msec);
                                                   Serial.println(" grains");
                                                   }
                                        if (CC_VALUE==0) {
                                                       granular1.stop();
                                                         }
                                      }
                     if (CC_NUMBER==12)   {  // BUTTON 1
                                        if (CC_VALUE==1) {
                                                     float msec = 25.0 + (knobA3 * 75.0);
                                                     granular1.beginPitchShift(msec);
                                                     Serial.print("Begin granular pitch phift using ");
                                                     Serial.print(msec);
                                                     Serial.println(" grains");
                                                       }
                                        if (CC_VALUE==0)  {
                                                        granular1.stop();
                                                   }
                                      }

          
              //     
                  }
No good result about neither for playback speed nor for pitch ....
pauls can check . please reply, if there is no reply ,where can ask for teensy's granular. ???
  • It would be very kind of you.....Thank you
 

Attachments

  • Granular Control for Pauls example.zip
    504 bytes · Views: 10
Back
Top