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

Thread: Hardware Serial makes my PT 8211output sounds very low

  1. #1
    Junior Member
    Join Date
    May 2022
    Posts
    3

    Hardware Serial makes my PT 8211output sounds very low

    Hi,

    I am using the Teensy 3.2 and I want to receive 3 values via hardware Serial (serial1, serial2, serial3) that i want to use to modulate my sound.

    However, it seems like hardware Serial makes my sound very low.

    I have tried the example code "PT 8211 Sine"

    Code:
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    
    // GUItool: begin automatically generated code
    AudioSynthWaveform       waveform1;      //xy=110,75
    AudioOutputPT8211        pt8211_1;          //xy=303,78
    AudioConnection          patchCord1(waveform1, 0, pt8211_1, 0);
    AudioConnection          patchCord2(waveform1, 0, pt8211_1, 1);
    // GUItool: end automatically generated code
    
    void setup() {
      AudioMemory(15);
      waveform1.begin(WAVEFORM_SINE);
      waveform1.frequency(440);
      waveform1.amplitude(0.99);
    }
    
    void loop() {
    }
    and sound is clear and loud. However, when I add :

    Code:
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    
    // GUItool: begin automatically generated code
    AudioSynthWaveform       waveform1;      //xy=110,75
    AudioOutputPT8211        pt8211_1;          //xy=303,78
    AudioConnection          patchCord1(waveform1, 0, pt8211_1, 0);
    AudioConnection          patchCord2(waveform1, 0, pt8211_1, 1);
    // GUItool: end automatically generated code
    
    
    // set this to the hardware serial port you wish to use
    #define SERIAL_S1 Serial1 //0 1 
    #define SERIAL_S2 Serial2 // 9 10 
    
    bool S1 = false;
    bool S2 = false; 
    int rssi_S1 =0;
    int rssi_S2 =0;
    
    
    
    void setup() {
      AudioMemory(15);
      waveform1.begin(WAVEFORM_SINE);
      waveform1.frequency(440);
      waveform1.amplitude(0.99);
    
     //SERIAL_S1.begin(9600);
     // SERIAL_S2.begin(9600);
    
      Serial.begin(9600);
      Serial.print("teensy ready");
    }
    
    void loop() {
    
    
    }
    The sound becomes very faint. I don't know what to do, any ideas?

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,398
    Serial2 on Teensy 3.2 uses pin 9 & 10.

    PT8211 uses pins 9, 22, 23.

    To solve this conflict over pin 9, use Serial.setRX(26) before Serial.begin(9600). It is not so convenient because pin 26 is a bottom side pad. But if you must use all 3 hardware serial ports on Teensy 3.2 while also using PT8211, I'm afraid that is the only solution.

    If you switch to Teensy 4.0, the hardware offers 7 serial ports and can connect 2 PT8211, so more options.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,398
    One other possible solution would be to use AltSoftSerial. It uses pins 20, 21 on Teensy 3.2. But it is not nearly as efficient as normal hardware serial. The extra overhead might be ok at a slower baud rate like 9600, but higher baud rates might eat into the CPU power needed for whatever audio processing you're doing.

  4. #4
    Junior Member
    Join Date
    May 2022
    Posts
    3
    thank you! that worked out!

Posting Permissions

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