Forum Rule: Always post complete source code & details to reproduce any issue!
Page 3 of 8 FirstFirst 1 2 3 4 5 ... LastLast
Results 51 to 75 of 191

Thread: Teensy 4.0 - based Audio Guestbook

  1. #51
    Member
    Join Date
    Jun 2022
    Location
    Ann Arbor, Michigan USA
    Posts
    40
    Quote Originally Posted by meganul View Post
    Hi everyone! I’m looking to troubleshoot a problem I’m having with my guestbook. I’m using a decotel cradle phone (pictured).

    I’ve successfully wired everything to the phone and the code works seamlessly. My issue is that when I replace the handset to the cradle, it doesn’t trigger continuity between the hook switch contacts, so the code never shuts off. I can manually depress the hook switch plunger and trigger the handset to be “replaced”. This leads me to believe my issue is related to the hook switch itself - likely to the spring on the cradle. I have tried tightening the existing spring, and also tried replacing the spring with 4 different new springs without any luck. Not sure if there is a separate issue with the hook switch contacts, or if I’m just not yet successful in the right spring tension that will allow the phone to depress the hook switch to just the right spot. Does anyone have a similar phone they’re using or have any idea what I can do to fix my problem? Any advice would be greatly appreciated !
    Yep. it sure sounds like you have a wonky or badly adjusted switchhook / hook switch. Try bending the metal parts that operate the switch and maybe change the bounce value to be bigger.

  2. #52
    Junior Member
    Join Date
    Jul 2022
    Posts
    10
    Hi, I am trying to fix an issue I am having with the phone/code. The code works, apart from it only records 3 seconds of audio or so... Then just stops. I checked the serial monitor and using the serial prints I have been able to ensure it's not a switch problem - it is not, the program runs as it should and even says recording stopped at the correct point. However, clearly it is not actually recording for the entire duration it should be. The mic works and the raw audio can be heard for the few seconds recorded. The only thing I could think of is if I have an SD that is not compatible - could that be the case? I am using a SanDisk Extreme 64GB. Any suggestions would be great. Thank you.

  3. #53
    Senior Member BriComp's Avatar
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    943
    I have no done anything with Audio yet but could it be a buffer not large enough?

  4. #54
    Junior Member
    Join Date
    Jul 2022
    Posts
    10
    I did think about that but then again, seems strage given my hardware setup is the same - the only unknown is the SD card. So I would be reluctant to try and modify the code, even more so the parameters for the audio recording.

  5. #55
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    704
    Here is my working version:

    * tweaked for a telephone with closing contact when lifting up the handheld
    * saving recorded messages as WAV files to the SD card, eliminating the need to convert RAW files after the party
    * greeting message is "greeting.wav": it has to be recorded with a sample rate of 44100sps, otherwise it will NOT be played
    * this compiles well and works well with Arduino version 1.8.19 and the latest Teensyduino version 1.57
    * recording works reasonably well, but has the same problems as the Record example of the Audio lib: sometimes dropping samples or chunks of audio because of the latency of the SD card

    Code:
    /**
     * Audio Guestbook, Copyright (c) 2022 Playful Technology
     * 
     * Tested using a Teensy 4.0 with Teensy Audio Shield, although should work 
     * with minor modifications on other similar hardware
     * 
     * When handset is lifted, a pre-recorded greeting message is played, followed by a tone.
     * Then, recording starts, and continues until the handset is replaced.
     * Playback button allows all messages currently saved on SD card through earpiece 
     * 
     * Files are saved on SD card as 44.1kHz, 16-bit, mono signed integer RAW audio format
     * These can be loaded directly into Audacity (https://www.audacityteam.org/). Or else, converted to WAV/MP3 format using SOX (https://sourceforge.net/projects/sox/)
     * 
     * 
     * Frank DD4WH, July, 31st 2022 
     * for a DBP 611 telephone & with recording to WAV file
     * contact for switch button 0 is closed when handheld is lifted
     * 
     */
    
    #include <Bounce.h>
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <TimeLib.h>
    
    // DEFINES
    // Define pins used by Teensy Audio Shield
    #define SDCARD_CS_PIN    10
    #define SDCARD_MOSI_PIN  7
    #define SDCARD_SCK_PIN   14
    // And those used for inputs
    #define HOOK_PIN 0
    #define PLAYBACK_BUTTON_PIN 1
    
    // GLOBALS
    // Audio initialisation code can be generated using the GUI interface at https://www.pjrc.com/teensy/gui/
    // Inputs
    AudioSynthWaveform      waveform1; // To create the "beep" sfx
    AudioInputI2S           i2s2; // I2S input from microphone on audio shield
    AudioPlaySdWav          playWav1; // Play 44.1kHz 16-bit PCM greeting WAV file
    AudioRecordQueue         queue1; // Creating an audio buffer in memory before saving to SD
    AudioMixer4              mixer; // Allows merging several inputs to same output
    AudioOutputI2S           i2s1; // I2S interface to Speaker/Line Out on Audio shield
    AudioConnection patchCord1(waveform1, 0, mixer, 0); // wave to mixer 
    AudioConnection patchCord3(playWav1, 0, mixer, 1); // wav file playback mixer
    AudioConnection patchCord4(mixer, 0, i2s1, 0); // mixer output to speaker (L)
    AudioConnection patchCord6(mixer, 0, i2s1, 1); // mixer output to speaker (R)
    AudioConnection patchCord5(i2s2, 0, queue1, 0); // mic input to queue (L)
    AudioControlSGTL5000     sgtl5000_1;
    
    // Filename to save audio recording on SD card
    char filename[15];
    // The file object itself
    File frec;
    
    // Use long 40ms debounce time on both switches
    Bounce buttonRecord = Bounce(HOOK_PIN, 40);
    Bounce buttonPlay = Bounce(PLAYBACK_BUTTON_PIN, 40);
    
    // Keep track of current state of the device
    enum Mode {Initialising, Ready, Prompting, Recording, Playing};
    Mode mode = Mode::Initialising;
    
    float beep_volume = 0.02f;
    
    // variables for writing to WAV file
    unsigned long ChunkSize = 0L;
    unsigned long Subchunk1Size = 16;
    unsigned int AudioFormat = 1;
    unsigned int numChannels = 1;
    unsigned long sampleRate = 44100;
    unsigned int bitsPerSample = 16;
    unsigned long byteRate = sampleRate*numChannels*(bitsPerSample/8);// samplerate x channels x (bitspersample / 8)
    unsigned int blockAlign = numChannels*bitsPerSample/8;
    unsigned long Subchunk2Size = 0L;
    unsigned long recByteSaved = 0L;
    unsigned long NumSamples = 0L;
    byte byte1, byte2, byte3, byte4;
    //elapsedMicros usec = 0;
    //unsigned int lastTime=0;
    
    void setup() {
    
      // Note that Serial.begin() is not required for Teensy - 
      // by default it initialises serial communication at full USB speed
      // See https://www.pjrc.com/teensy/td_serial.html
      // Serial.begin()
      Serial.println(__FILE__ __DATE__);
      
      // Configure the input pins
      pinMode(HOOK_PIN, INPUT_PULLUP);
      pinMode(PLAYBACK_BUTTON_PIN, INPUT_PULLUP);
    
      // Audio connections require memory, and the record queue
      // uses this memory to buffer incoming audio.
      AudioMemory(60);
    
      // Enable the audio shield, select input, and enable output
      sgtl5000_1.enable();
      // Define which input on the audio shield to use (AUDIO_INPUT_LINEIN / AUDIO_INPUT_MIC)
      sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
      //sgtl5000_1.adcHighPassFilterDisable(); //
      sgtl5000_1.volume(0.95);
    
      mixer.gain(0, 1.0f);
      mixer.gain(1, 1.0f);
    //  mixer.gain(2, 1.0f);
    
      // Play a beep to indicate system is online
      waveform1.begin(beep_volume, 440, WAVEFORM_SINE);
      wait(1000);
      waveform1.amplitude(0);
      delay(1000);
    
      // Initialize the SD card
      SPI.setMOSI(SDCARD_MOSI_PIN);
      SPI.setSCK(SDCARD_SCK_PIN);
      if (!(SD.begin(SDCARD_CS_PIN))) {
        // stop here if no SD card, but print a message
        while (1) {
          Serial.println("Unable to access the SD card");
          delay(500);
        }
      }
    
      // Value in dB
    //  sgtl5000_1.micGain(15);
      sgtl5000_1.micGain(5); // much lower gain is required for the AOM5024 electret capsule
    
      // Synchronise the Time object used in the program code with the RTC time provider.
      // See https://github.com/PaulStoffregen/Time
      setSyncProvider(getTeensy3Time);
      
      // Define a callback that will assign the correct datetime for any file system operations
      // (i.e. saving a new audio recording onto the SD card)
      FsDateTime::setCallback(dateTime);
    
      mode = Mode::Ready;
    }
    
    void loop() {
      // First, read the buttons
      buttonRecord.update();
      buttonPlay.update();
    
      switch(mode){
        case Mode::Ready:
          // Falling edge occurs when the handset is lifted --> 611 telephone
          if (buttonRecord.fallingEdge()) {
            Serial.println("Handset lifted");
            mode = Mode::Prompting;
          }
          else if(buttonPlay.fallingEdge()) {
            playAllRecordings();
            //playLastRecording();
          }
          break;
    
        case Mode::Prompting:
          // Wait a second for users to put the handset to their ear
          wait(1000);
          // Play the greeting inviting them to record their message
          playWav1.play("greeting.wav");    
          // Wait until the  message has finished playing
          while (playWav1.isPlaying()) {
            // Check whether the handset is replaced
            buttonRecord.update();
            buttonPlay.update();
            // Handset is replaced
            if(buttonRecord.risingEdge()) {
              playWav1.stop();
              mode = Mode::Ready;
              return;
            }
            if(buttonPlay.fallingEdge()) {
              playWav1.stop();
              playAllRecordings();
              //playLastRecording();
              return;
            }
            
          }
          // Debug message
          Serial.println("Starting Recording");
          // Play the tone sound effect
          waveform1.begin(beep_volume, 440, WAVEFORM_SINE);
          wait(1250);
          waveform1.amplitude(0);
          // Start the recording function
          startRecording();
          break;
    
        case Mode::Recording:
          // Handset is replaced
          if(buttonRecord.risingEdge()){
            // Debug log
            Serial.println("Stopping Recording");
            // Stop recording
            stopRecording();
            // Play audio tone to confirm recording has ended
            waveform1.frequency(523.25);
            waveform1.amplitude(beep_volume);
            wait(250);
            waveform1.amplitude(0);
            wait(250);
            waveform1.amplitude(beep_volume);
            wait(250);
            waveform1.amplitude(0);
            wait(250);
            waveform1.amplitude(beep_volume);
            wait(250);
            waveform1.amplitude(0);
            wait(250);
            waveform1.amplitude(beep_volume);
            wait(250);
            waveform1.amplitude(0);
          }
          else {
            continueRecording();
          }
          break;
    
        case Mode::Playing:
          break;  
      }   
    }
    
    void startRecording() {
      // Find the first available file number
      for (uint8_t i=0; i<9999; i++) {
        // Format the counter as a five-digit number with leading zeroes, followed by file extension
    //    snprintf(filename, 11, " %05d.RAW", i);
        snprintf(filename, 11, " %05d.wav", i);
        // Create if does not exist, do not open existing, write, sync after write
        if (!SD.exists(filename)) {
          break;
        }
      }
      frec = SD.open(filename, FILE_WRITE);
      if(frec) {
        Serial.print("Recording to ");
        Serial.println(filename);
        queue1.begin();
        mode = Mode::Recording;
        recByteSaved = 0L;
      }
      else {
        Serial.println("Couldn't open file to record!");
      }
    }
    
    void continueRecording() {
      // Check if there is data in the queue
      if (queue1.available() >= 2) {
        byte buffer[512];
        // Fetch 2 blocks from the audio library and copy
        // into a 512 byte buffer.  The Arduino SD library
        // is most efficient when full 512 byte sector size
        // writes are used.
        memcpy(buffer, queue1.readBuffer(), 256);
        queue1.freeBuffer();
        memcpy(buffer+256, queue1.readBuffer(), 256);
        queue1.freeBuffer();
        // Write all 512 bytes to the SD card
        frec.write(buffer, 512);
        recByteSaved += 512;
      }
    }
    
    void stopRecording() {
      // Stop adding any new data to the queue
      queue1.end();
      // Flush all existing remaining data from the queue
      while (queue1.available() > 0) {
        // Save to open file
        frec.write((byte*)queue1.readBuffer(), 256);
        queue1.freeBuffer();
        recByteSaved += 256;
      }
      writeOutHeader();
      // Close the file
      frec.close();
      mode = Mode::Ready;
    }
    
    
    void playAllRecordings() {
      // Recording files are saved in the root directory
      File dir = SD.open("/");
      
      while (true) {
        File entry =  dir.openNextFile();
        if (strstr(entry.name(), "greeting"))
        {
           entry =  dir.openNextFile();
        }
        if (!entry) {
          // no more files
          entry.close();
          break;
        }
        int8_t len = strlen(entry.name());
    //    if (strstr(strlwr(entry.name() + (len - 4)), ".raw")) {
        if (strstr(strlwr(entry.name() + (len - 4)), ".wav")) {
          Serial.print("Now playing ");
          Serial.println(entry.name());
          // Play a short beep before each message
          waveform1.amplitude(beep_volume);
          wait(750);
          waveform1.amplitude(0);
          // Play the file
          playWav1.play(entry.name());
          mode = Mode::Playing;
        }
        entry.close();
    
    //    while (playWav1.isPlaying()) { // strangely enough, this works for playRaw, but it does not work properly for playWav
        while (!playWav1.isStopped()) { // this works for playWav
          buttonPlay.update();
          buttonRecord.update();
          // Button is pressed again
          if(buttonPlay.risingEdge() || buttonRecord.risingEdge()) {
            playWav1.stop();
            mode = Mode::Ready;
            return;
          }   
        }
      }
      // All files have been played
      mode = Mode::Ready;
    }
    
    // Retrieve the current time from Teensy built-in RTC
    time_t getTeensy3Time(){
      return Teensy3Clock.get();
    }
    
    // Callback to assign timestamps for file system operations
    void dateTime(uint16_t* date, uint16_t* time, uint8_t* ms10) {
    
      // Return date using FS_DATE macro to format fields.
      *date = FS_DATE(year(), month(), day());
    
      // Return time using FS_TIME macro to format fields.
      *time = FS_TIME(hour(), minute(), second());
    
      // Return low time bits in units of 10 ms.
      *ms10 = second() & 1 ? 100 : 0;
    }
    
    // Non-blocking delay, which pauses execution of main program logic,
    // but while still listening for input 
    void wait(unsigned int milliseconds) {
      elapsedMillis msec=0;
    
      while (msec <= milliseconds) {
        buttonRecord.update();
        buttonPlay.update();
        if (buttonRecord.fallingEdge()) Serial.println("Button (pin 0) Press");
        if (buttonPlay.fallingEdge()) Serial.println("Button (pin 1) Press");
        if (buttonRecord.risingEdge()) Serial.println("Button (pin 0) Release");
        if (buttonPlay.risingEdge()) Serial.println("Button (pin 1) Release");
      }
    }
    
    
    void writeOutHeader() { // update WAV header with final filesize/datasize
    
    //  NumSamples = (recByteSaved*8)/bitsPerSample/numChannels;
    //  Subchunk2Size = NumSamples*numChannels*bitsPerSample/8; // number of samples x number of channels x number of bytes per sample
      Subchunk2Size = recByteSaved;
      ChunkSize = Subchunk2Size + 36;
      frec.seek(0);
      frec.write("RIFF");
      byte1 = ChunkSize & 0xff;
      byte2 = (ChunkSize >> 8) & 0xff;
      byte3 = (ChunkSize >> 16) & 0xff;
      byte4 = (ChunkSize >> 24) & 0xff;  
      frec.write(byte1);  frec.write(byte2);  frec.write(byte3);  frec.write(byte4);
      frec.write("WAVE");
      frec.write("fmt ");
      byte1 = Subchunk1Size & 0xff;
      byte2 = (Subchunk1Size >> 8) & 0xff;
      byte3 = (Subchunk1Size >> 16) & 0xff;
      byte4 = (Subchunk1Size >> 24) & 0xff;  
      frec.write(byte1);  frec.write(byte2);  frec.write(byte3);  frec.write(byte4);
      byte1 = AudioFormat & 0xff;
      byte2 = (AudioFormat >> 8) & 0xff;
      frec.write(byte1);  frec.write(byte2); 
      byte1 = numChannels & 0xff;
      byte2 = (numChannels >> 8) & 0xff;
      frec.write(byte1);  frec.write(byte2); 
      byte1 = sampleRate & 0xff;
      byte2 = (sampleRate >> 8) & 0xff;
      byte3 = (sampleRate >> 16) & 0xff;
      byte4 = (sampleRate >> 24) & 0xff;  
      frec.write(byte1);  frec.write(byte2);  frec.write(byte3);  frec.write(byte4);
      byte1 = byteRate & 0xff;
      byte2 = (byteRate >> 8) & 0xff;
      byte3 = (byteRate >> 16) & 0xff;
      byte4 = (byteRate >> 24) & 0xff;  
      frec.write(byte1);  frec.write(byte2);  frec.write(byte3);  frec.write(byte4);
      byte1 = blockAlign & 0xff;
      byte2 = (blockAlign >> 8) & 0xff;
      frec.write(byte1);  frec.write(byte2); 
      byte1 = bitsPerSample & 0xff;
      byte2 = (bitsPerSample >> 8) & 0xff;
      frec.write(byte1);  frec.write(byte2); 
      frec.write("data");
      byte1 = Subchunk2Size & 0xff;
      byte2 = (Subchunk2Size >> 8) & 0xff;
      byte3 = (Subchunk2Size >> 16) & 0xff;
      byte4 = (Subchunk2Size >> 24) & 0xff;  
      frec.write(byte1);  frec.write(byte2);  frec.write(byte3);  frec.write(byte4);
      frec.close();
      Serial.println("header written"); 
      Serial.print("Subchunk2: "); 
      Serial.println(Subchunk2Size); 
    }

  6. #56
    Junior Member
    Join Date
    Jun 2022
    Posts
    17
    Does anyone experience getting words dropped after recording. my biggest issue is that after somone leaves a message, when I listen to it, some of the words have dropped off or sometimes the audio goes in fast mode. anyone esle knows why. I thought it might be the SD card

  7. #57
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    704
    Quote Originally Posted by ninja View Post
    Does anyone experience getting words dropped after recording. my biggest issue is that after somone leaves a message, when I listen to it, some of the words have dropped off or sometimes the audio goes in fast mode. anyone esle knows why. I thought it might be the SD card
    Yes. As stated in my previous message, this can be expected, if the standard Audio lib Record example is used. Most SD cards take too long to respond and have write latencies up to a few hundred ms, which leads to audio drops. This can be circumvented, if a large audio buffer is used, but for this, a different software is needed. Have a look at https://github.com/WMXZ-EU/microSoundRecorder which prevents this problem by using a very large audio buffer.

  8. #58
    Junior Member
    Join Date
    Jul 2022
    Posts
    10
    It turns out my issue was actually due to the SD card format. I used my mac to format the SD prior to use and despite using Fat format, it didn't clearly like it... Anyway, I switched to my windows PC and formated to Fat32 and now it works fine! There is definitely some sort of issue with the buffer not being large enough and cutting off the very end sometimes. However, I just ensure the handset is returned maybe a couple of seconds after the message is finished. That seems to give enough time to unload the buffer!

  9. #59
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    704
    Very good that you solved the SD card formatting issue!

    I modified the original code further:

    * added MTP support: now you can access the recorded WAV files on the SD card via USB, the SD card will appear as a separate drive on your computer and all the files can be accessed by USB, no need to take out the SD card and use an SD card adapter
    * only possible with the latest Teensyduino 1.57
    * download the following library and put it into your local Arduino folder: https://github.com/KurtE/MTP_Teensy
    * compile with option: "Serial + MTP Disk (Experimental)"

    You can find the modified code here:
    https://github.com/DD4WH/audio-guestbook

  10. #60
    Junior Member
    Join Date
    Jun 2022
    Posts
    17
    Quote Originally Posted by DD4WH View Post
    Yes. As stated in my previous message, this can be expected, if the standard Audio lib Record example is used. Most SD cards take too long to respond and have write latencies up to a few hundred ms, which leads to audio drops. This can be circumvented, if a large audio buffer is used, but for this, a different software is needed. Have a look at https://github.com/WMXZ-EU/microSoundRecorder which prevents this problem by using a very large audio buffer.
    Hey thank you for the reply. So I just ordered SanDisk 32GB Ultra MicroSDHC UHS-I Memory Card - SDSQUAR-032G-GN6MT
    hoping that was the issue and would solve it. but you are right its mostly the buffer. Do you have anything in your repository that would solve this? The microSoundRecorder is for Teensy 3.6. would it work on 4.0 and how do I use it. Also This is what I am using for wiring "ELEGOO 120pcs Multicolored Dupont Wire 40pin Male to Female, 40pin Male to Male, 40pin Female to Female Breadboard Jumper Wires Ribbon Cables Kit Compatible with Arduino ProjectsELEGOO 120pcs Multicolored Dupont Wire 40pin Male to Female, 40pin Male to Male, 40pin Female to Female Breadboard Jumper Wires Ribbon Cables Kit" . is this good? or do you guys use different kind of wires. One more question, When Saving with Wav file, the files are a lot larger than RAW files. correct?
    Last edited by ninja; 08-01-2022 at 04:57 PM.

  11. #61
    Junior Member
    Join Date
    Jun 2022
    Posts
    17
    how did you do that? can you show what you did? "I just ensure the handset is returned maybe a couple of seconds after the message is finished"

  12. #62
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    704
    Quote Originally Posted by ninja View Post
    Hey thank you for the reply. So I just ordered SanDisk 32GB Ultra MicroSDHC UHS-I Memory Card - SDSQUAR-032G-GN6MT
    hoping that was the issue and would solve it. but you are right its mostly the buffer. Do you have anything in your repository that would solve this? The microSoundRecorder is for Teensy 3.6. would it work on 4.0 and how do I use it. Also This is what I am using for wiring "ELEGOO 120pcs Multicolored Dupont Wire 40pin Male to Female, 40pin Male to Male, 40pin Female to Female Breadboard Jumper Wires Ribbon Cables Kit Compatible with Arduino ProjectsELEGOO 120pcs Multicolored Dupont Wire 40pin Male to Female, 40pin Male to Male, 40pin Female to Female Breadboard Jumper Wires Ribbon Cables Kit" . is this good? or do you guys use different kind of wires. One more question, When Saving with Wav file, the files are a lot larger than RAW files. correct?
    * Best connection of the Teensy and audio board is through headers. Do not use cables for that connection, the connections have to be as short as possible.
    * for the button connections every wire quality is OK !
    * No, WAV files are exactly 44bytes larger than RAW files. The audio data is coded exactly the same way. RAW and WAV files only differ by the header and that contains the sample rate and some other information. And that whole info is only 44bytes long.
    * the microSoundRecorder software is a complex piece of software and you would have to rebuild it a lot to make it suitable for the Audio guest book (and for the T4)
    * Bill Greiman did a review of the "best" SD cards for recording somewhere here on the forum, I think it is this thread: https://forum.pjrc.com/threads/68418...l=1#post293463

  13. #63
    Junior Member
    Join Date
    Jul 2022
    Posts
    6
    I fixed my hook switch problem (luckily it was a rising vs falling edge oversight in one line of code, not a mechanical switch problem). Was wondering if anyone here had edited their code to have the playback button to play back the recordings in reverse order, playing the most recent message first. Seems this would be more useful in real time, so you could continue to check that things were functioning without listening through every message. thanks!

  14. #64
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    704
    Quote Originally Posted by meganul View Post
    Was wondering if anyone here had edited their code to have the playback button to play back the recordings in reverse order, playing the most recent message first.
    Have a look here:
    https://github.com/DD4WH/audio-guestbook
    That code plays only the most recent message, not all the messages. It would be easy to modify it to play all the messages in reverse order.

  15. #65
    Junior Member
    Join Date
    Jun 2022
    Posts
    17
    Quote Originally Posted by DD4WH View Post
    * Best connection of the Teensy and audio board is through headers. Do not use cables for that connection, the connections have to be as short as possible.
    * for the button connections every wire quality is OK !
    * No, WAV files are exactly 44bytes larger than RAW files. The audio data is coded exactly the same way. RAW and WAV files only differ by the header and that contains the sample rate and some other information. And that whole info is only 44bytes long.
    * the microSoundRecorder software is a complex piece of software and you would have to rebuild it a lot to make it suitable for the Audio guest book (and for the T4)
    * Bill Greiman did a review of the "best" SD cards for recording somewhere here on the forum, I think it is this thread: https://forum.pjrc.com/threads/68418...l=1#post293463
    Thanks for the respond bud. couple of other questions. Do you know what i need to purchase in order to connect these boards to Battery? right now its hard to have the cable out. Also sometime when I hang up it doesnt detect it and still stays in the recording mode.
    Mode switched to: Recording
    I have to pick up the handset in order to stop the recording and that reverses the entire thing !!!
    Some how if it in reverse it needs to understand it and reset itself
    By the way MTP cant install the new version, Windows is not allowing me to do it

  16. #66
    Junior Member
    Join Date
    Jul 2022
    Posts
    10
    Quote Originally Posted by ninja View Post
    how did you do that? can you show what you did? "I just ensure the handset is returned maybe a couple of seconds after the message is finished"
    I just keep the handset in my hand for an extra second or so and it seemed to ensure the buffer was clear. Otherwise it seems as though the buffer didn't have time to clear if I instantly put the handset down. However, I changed SD card and the format and it's fine now. Not sure it could have been a latency issue with my SD.

  17. #67
    Junior Member
    Join Date
    Jul 2022
    Posts
    10
    Quote Originally Posted by ninja View Post
    Thanks for the respond bud. couple of other questions. Do you know what i need to purchase in order to connect these boards to Battery? right now its hard to have the cable out. Also sometime when I hang up it doesnt detect it and still stays in the recording mode.
    Mode switched to: Recording
    I have to pick up the handset in order to stop the recording and that reverses the entire thing !!!
    Some how if it in reverse it needs to understand it and reset itself
    By the way MTP cant install the new version, Windows is not allowing me to do it
    For battery power I used this guide: https://www.pjrc.com/teensy/external_power.html

    As for the picking up to stop recording, make sure your switch is closing on the handset properly and the debounce is set appropriately.
    I used the serial monitor when setting my debounce and testing the switch. As my contacts were a little rusty and needed cleaning so didn't get it perfect first time.

  18. #68
    Junior Member
    Join Date
    Jul 2022
    Posts
    6
    Quote Originally Posted by ninja View Post
    Thanks for the respond bud. couple of other questions. Do you know what i need to purchase in order to connect these boards to Battery? right now its hard to have the cable out. Also sometime when I hang up it doesnt detect it and still stays in the recording mode.
    Mode switched to: Recording
    I have to pick up the handset in order to stop the recording and that reverses the entire thing !!!
    Some how if it in reverse it needs to understand it and reset itself
    By the way MTP cant install the new version, Windows is not allowing me to do it
    ^ had a similar issue with the handset needing to be lifted to end the recording. As it turned out, my coding had risingEdge listed for starting AND stopping recording. Just switched to fallingEdge for the cue to stop recording and it worked perfectly. Maybe try that and itíll fix your issue!

  19. #69
    Junior Member
    Join Date
    Jun 2022
    Posts
    17
    Quote Originally Posted by meganul View Post
    ^ had a similar issue with the handset needing to be lifted to end the recording. As it turned out, my coding had risingEdge listed for starting AND stopping recording. Just switched to fallingEdge for the cue to stop recording and it worked perfectly. Maybe try that and itíll fix your issue!
    Nah I have that fixed. the issue is that at some point when you hang up it doesnt recognize it that its been hanged up

  20. #70
    Junior Member
    Join Date
    Jun 2022
    Posts
    17
    Quote Originally Posted by nachoman View Post
    For battery power I used this guide: https://www.pjrc.com/teensy/external_power.html

    As for the picking up to stop recording, make sure your switch is closing on the handset properly and the debounce is set appropriately.
    I used the serial monitor when setting my debounce and testing the switch. As my contacts were a little rusty and needed cleaning so didn't get it perfect first time.
    Bounce buttonRecord = Bounce(HOOK_PIN, 60); this was 40 do you think 60 would help or go down? Also " seemed to ensure the buffer was clear" do you put wait(3000) when recording stops?

  21. #71
    Junior Member
    Join Date
    Aug 2022
    Posts
    1
    Quote Originally Posted by DD4WH View Post
    Have a look here:
    https://github.com/DD4WH/audio-guestbook
    That code plays only the most recent message, not all the messages. It would be easy to modify it to play all the messages in reverse order.
    Hi, i am new to this and working on the same project.
    When I compile the project in arduino, it says i need the MTP_teensy.b library. where do i find it?

  22. #72
    Junior Member
    Join Date
    Jul 2022
    Posts
    8
    Quote Originally Posted by tedm View Post
    Ferrite bead might help, no harm in trying.
    Still struggling with getting rid of the buzzing. Thinking of reducing the wiring down to minimum length. Where else could i likely be having an issue? I doubt my solder joints are causing the problem?
    Is it likely to be from the power supply i am using? (i just cut an old micro USB cable and resoldered for it to be neater.

    Thanks

  23. #73
    Junior Member
    Join Date
    Jul 2022
    Posts
    6
    Quote Originally Posted by woster View Post
    Still struggling with getting rid of the buzzing. Thinking of reducing the wiring down to minimum length. Where else could i likely be having an issue? I doubt my solder joints are causing the problem?
    Is it likely to be from the power supply i am using? (i just cut an old micro USB cable and resoldered for it to be neater.

    Thanks
    I ended up switching out the origins condenser mic for an electret on Amazon. Before the switch, all was working well and sounded great (just wanted better quality recordings). Now that Iíve switched to the electret I have a constant buzzing that overtakes the greeting message, and the recording has a constant loud & fast ticking noise in the background. Iíve tried reversing the polarity on the microphone itself as well as changing the input for ground vs mix to the audio shield. Neither have been successful. Any additional ideas or suggestions? Thanks!

  24. #74
    Senior Member DD4WH's Avatar
    Join Date
    Oct 2015
    Location
    Central Europe
    Posts
    704
    Hi! I will adress some of the issues mentioned in the posts above and try to give some potential solutions:

    AUDIO Quality / microphone:
    * if you use a new electret microphone capsule (and not the original telephone mic capsule), I recommend to use a separate shielded mic cable and NOT the original cable (which -in most cases- will have no shielding at all). The shielded cable will have a shield and two internal wires (most often red and white wire) and should be soldered like this.

    MICROPHONE end of the cable:
    * solder the red cable to the + terminal of the microphone (Yes, polarity does really matter in this case :-))
    * solder the white cable to the - or GND terminal of the microphone
    * LEAVE THE SHIELD UNCONNECTED AT THIS END OF THE CABLE
    AUDIO BOARD end of the cable
    * solder the red cable to the "MIC" connector on the audio board
    * solder the shield to the white cable (YES, exactly) and solder the common connection to the GND connection of the audio board
    --> if you follow these steps EXACTLY, hum and other noise could be minimized

    COMPILING the code:
    * FOLLOW EXACTLY THE INSTRUCTIONS THAT ARE IN THIS THREAD (scroll up a few posts and you will find the information on the MTP library: https://forum.pjrc.com/threads/70553...l=1#post310300)

    "* the sketch with the MTP lib only works with the latest Teensyduino 1.57 version, so please update your Arduino IDE AND your Teensyduino
    * download the following library and put it into your local Arduino folder: https://github.com/KurtE/MTP_Teensy
    * compile with option: "Serial + MTP Disk (Experimental)"" and with option "CPU speed: 150MHz"


    * However, I think it would be good to have all of the info at one place, so I will put it on my github in the readme
    * it can be found on github: https://github.com/DD4WH/audio-guestbook


    BATTERY POWER:
    * it is a question of taste, but I think the easiest option to power the telephone is to just plug it into a USB power bank with a USB-A to micro-USB cable
    * after the party / recording session this same cable can be used to plug it into your computer and retrieve the files from the SD card via USB

    Have fun with building and tweaking !

    Frank DD4WH

  25. #75
    Junior Member
    Join Date
    Jul 2022
    Posts
    6
    Quote Originally Posted by DD4WH View Post
    Hi! I will adress some of the issues mentioned in the posts above and try to give some potential solutions:

    AUDIO Quality / microphone:
    * if you use a new electret microphone capsule (and not the original telephone mic capsule), I recommend to use a separate shielded mic cable and NOT the original cable (which -in most cases- will have no shielding at all). The shielded cable will have a shield and two internal wires (most often red and white wire) and should be soldered like this.

    MICROPHONE end of the cable:
    * solder the red cable to the + terminal of the microphone (Yes, polarity does really matter in this case :-))
    * solder the white cable to the - or GND terminal of the microphone
    * LEAVE THE SHIELD UNCONNECTED AT THIS END OF THE CABLE
    AUDIO BOARD end of the cable
    * solder the red cable to the "MIC" connector on the audio board
    * solder the shield to the white cable (YES, exactly) and solder the common connection to the GND connection of the audio board
    --> if you follow these steps EXACTLY, hum and other noise could be minimized

    COMPILING the code:
    * FOLLOW EXACTLY THE INSTRUCTIONS THAT ARE IN THIS THREAD (scroll up a few posts and you will find the information on the MTP library: https://forum.pjrc.com/threads/70553...l=1#post310300)

    "* the sketch with the MTP lib only works with the latest Teensyduino 1.57 version, so please update your Arduino IDE AND your Teensyduino
    * download the following library and put it into your local Arduino folder: https://github.com/KurtE/MTP_Teensy
    * compile with option: "Serial + MTP Disk (Experimental)"" and with option "CPU speed: 150MHz"


    * However, I think it would be good to have all of the info at one place, so I will put it on my github in the readme
    * it can be found on github: https://github.com/DD4WH/audio-guestbook


    BATTERY POWER:
    * it is a question of taste, but I think the easiest option to power the telephone is to just plug it into a USB power bank with a USB-A to micro-USB cable
    * after the party / recording session this same cable can be used to plug it into your computer and retrieve the files from the SD card via USB

    Have fun with building and tweaking !

    Frank DD4WH

    Appreciate your continued help with this project - really hoping I can get this to work perfectly for my sisters wedding in September.

    The above makes sense, just wondering how I would integrate a shielded cable into the mic when the wiring is run through the handset and the coiled telephone cable. Would I just shielded cable from mic to handset wiring and then again from screw terminals to audio shield? Starting to feel like I have a LOT of wiring going on lol. Thanks again!

Posting Permissions

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