Forum Rule: Always post complete source code & details to reproduce any issue!
Page 15 of 18 FirstFirst ... 5 13 14 15 16 17 ... LastLast
Results 351 to 375 of 450

Thread: Teensy 4.0 - based Audio Guestbook

  1. #351
    Senior Member h4yn0nnym0u5e's Avatar
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    901
    OK, I've tested with a Kingston 16Gb card I happen to have, and which performs pretty badly on tests. The read and write speeds are OK, but it can have horrible internal delays at times, up to 1.4 seconds. I did a re-format using the official tool, which seems to have got the delays down to "only" 0.8 seconds - still really poor.

    I then took a look at what might be done about this, and I think I found a pretty obscure bug in the SPI library, which I've posted about elsewhere on the forum, in case I'm wrong ... has been known to happen

    Fortunately I think there's a fix (OK, horrible bodge) you could try, without digging into the library code. You need to change two files in the sketch:

    In play_sd_wav.cpp, add the following lines:
    Code:
    #include <Arduino.h>
    #include "play_sd_wav.h"
    // ***** bodge round possible bug *****
    #define SPI_HAS_NOTUSINGINTERRUPT 1 
    unsigned short AudioUsingSPICount;
    // ************************************
    #include "spi_interrupt.h"
    In audio-guestbook.ino, increase the audio buffers from 60 to 600:
    Code:
      // Audio connections require memory, and the record queue
      // uses this memory to buffer incoming audio.
      AudioMemory(600);
    This should, if my calculations are correct, allow audio interrupts to continue while the slow SD card writes are taking place, and massively increase the buffer available so that incoming audio can be stored during that time. 600 blocks is enough for 1.74 seconds of audio - if your card is slower than that, definitely get another one!

  2. #352
    built a new board running same code as before but different phone getting clicking with audio on the playback messages any ideas plz
    Attached Files Attached Files

  3. #353
    Senior Member h4yn0nnym0u5e's Avatar
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    901
    Quote Originally Posted by carpracing View Post
    built a new board running same code as before but different phone getting clicking with audio on the playback messages any ideas plz
    Is this the "clicking" you mean? Highlighted is the last 0.655s of your file, amplified and zoomed in:
    Click image for larger version. 

Name:	2023-05-23 19_23_05-.jpg 
Views:	30 
Size:	177.1 KB 
ID:	31175

    If so, I'm fairly sure it's high-current pulses that occur during SD writes coupling in to the microphone circuitry. See a discussion around post#311 in this very thread. You may improve matters slightly by better shielding and routing of the microphone cable, but I think the best solution (barring a re-layout of the audio shield) is adding wires as shown in my image. Some soldering skillz required here... also, no-one's actually reported that they've tried it successfully. It would be better with insulated wires, of course - less risk of a short!

  4. #354
    here is the audio file with no one talking you can hear the clicking i have done the same mod as your picture the unit is running on it own battery source

    Click image for larger version. 

Name:	20230524_120208.jpg 
Views:	39 
Size:	144.1 KB 
ID:	31176
    Attached Files Attached Files

  5. #355
    Senior Member h4yn0nnym0u5e's Avatar
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    901
    That's definitely the SD card writes - the profile of the clicks is a dead giveaway, as is the repeat every 46ms. I'm not sure if the revision D2 audio adaptor makes a difference - I don't have one to test. The clicks are actually better than many I've seen, so there may be little more you can do with your hardware, apart from maybe adding some capacitors, or trying an SD card which uses less current for writing. The other thing to do would be to use the built-in SD card slot on a Teensy 4.1.

    EDIT: or experiment with the routing of the microphone cable near the audio adaptor - maybe there's a route that cancels out the issues from the board itself!

  6. #356
    Junior Member
    Join Date
    Feb 2023
    Posts
    4

    On board led blinking

    May be I'm wrong, but the noise seems to fit with onboard led blinking while recording. I'm curious to test with onboard led turned off ... but I don't know how to do this !!

  7. #357
    Senior Member h4yn0nnym0u5e's Avatar
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    901
    Quote Originally Posted by Pascal73 View Post
    May be I'm wrong, but the noise seems to fit with onboard led blinking while recording. I'm curious to test with onboard led turned off ... but I don't know how to do this !!
    Correct - the SD card's SCK signal is on Teensy pin 13, which is also the built-in LED pin. This is unfortunate, but unavoidable. The only way to turn the LED off is to physically remove it, but that won't help the noise: the SD card takes about 100x the current the LED does, so will swamp any effect from removing the LED.

  8. #358
    i have changed the mic element away from the MIC Capsule Electret Condenser Microphone and use a spare ear piece from another hand set and clicking reduced by 95% if you turn the mic gain up then it appears again

  9. #359
    Junior Member
    Join Date
    Jun 2023
    Posts
    2

    Speaker volume problem

    Hi everybody, I have the following issue.
    When I use a standard TRS Audio cable, the message is very quiet and it makes no difference if I raise the volume. If I use a TRRS cable, I have to reduce the volume parameter and the greeting is quite loud. But the problem is if I use the TRRS cable there is just background noise on the recording without understanding the recorded message. If I use the TRS cable the greeting is quite but my recording works perfectly.

    Does anybody know how I can raise the loudness of the greeting without having background noise on my recording?

  10. #360
    Senior Member h4yn0nnym0u5e's Avatar
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    901
    Quote Originally Posted by Julian249 View Post
    Hi everybody, I have the following issue.
    When I use a standard TRS Audio cable, the message is very quiet and it makes no difference if I raise the volume. If I use a TRRS cable, I have to reduce the volume parameter and the greeting is quite loud. But the problem is if I use the TRRS cable there is just background noise on the recording without understanding the recorded message. If I use the TRS cable the greeting is quite but my recording works perfectly.

    Does anybody know how I can raise the loudness of the greeting without having background noise on my recording?
    Please post pictures, and ideally a schematic, of the wiring you've used. Note the audio adaptor is not intended to use a TRRS cable - I don't know what happens if you try, but it could easily be a Bad Thing.

  11. #361
    Junior Member
    Join Date
    Jun 2023
    Posts
    2
    Unfortunately I can't upload any pictures. But I used a TRRS Breakout Board (like this: https://www.sparkfun.com/products/11570). I also tried connecting the ground and tip of the TRRS cable directly to
    both of the speaker cable. And I even tried changing the two wires from the Speaker.

  12. #362
    Junior Member
    Join Date
    Jun 2023
    Posts
    7
    Hi All,

    Im trying to compile the code for this project on a Mac and am getting the below error:
    Multiple libraries were found for "SD.h"
    /Users/roryhammond/Downloads/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/AudioGuestBook/AudioGuestBook.ino:30:10: fatal error: MTP_Teensy.h: No such file or directory
    Used: /private/var/folders/gv/x578ly1n77n3nqw8kkl03cfr0000gn/T/AppTranslocation/D1C7A640-EAE4-461E-B769-74F9B1257145/d/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/SD
    Not used: /private/var/folders/gv/x578ly1n77n3nqw8kkl03cfr0000gn/T/AppTranslocation/D1C7A640-EAE4-461E-B769-74F9B1257145/d/Teensyduino.app/Contents/Java/libraries/SD
    30 | #include <MTP_Teensy.h>
    | ^~~~~~~~~~~~~~
    compilation terminated.
    Error compiling for board Teensy 4.0.


    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.

    Can anyone help as im a complete noob to this and would like to use this for my wedding next weekend.facepalm.

    Much appreciated!

    Rory

  13. #363
    Senior Member BriComp's Avatar
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    1,396
    That library can be downloaded from here. (https://github.com/KurtE/MTP_Teensy)

  14. #364
    Junior Member
    Join Date
    Jun 2023
    Posts
    7
    Thanks so much for your response.

    I assume I just "save" that into the library folder with all of the others?

  15. #365
    Senior Member BriComp's Avatar
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    1,396
    Yes, on my computer the address is: C:\Arduino Programs\LIBRARIES\MTP_Teensy
    Bear in mind that I have changed the Sketchbook location to: C:\Arduino Programs

  16. #366
    Senior Member BriComp's Avatar
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    1,396
    @h4yn0nnym0u5e has done a lot of work with the Audio Guestbook and has a lot of documentation. You can find his info here: (https://github.com/h4yn0nnym0u5e/audio-guestbook)

  17. #367
    Junior Member
    Join Date
    Jun 2023
    Posts
    7
    I have now managed to get the whole system working however the Audio messages when I re-listen to the messages they are very quiet.

    When I up the mic gain to 35, I can hear the audio better but get a very distinct and consistent "ticking" in the background.

    Am I adjusting the wrong parameter OR is this related to the issues others are discussing over the last 2/3 pages of this thread? Im at a bit of a loss as to how to fix !

  18. #368
    Senior Member BriComp's Avatar
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    1,396
    Probably...@h4yn0nnym0u5e is your goto on that one.

  19. #369
    Senior Member h4yn0nnym0u5e's Avatar
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    901
    Quote Originally Posted by BriComp View Post
    Probably...@h4yn0nnym0u5e is your goto on that one.
    Thanks @BriComp!

    Quote Originally Posted by roryhammond View Post
    I have now managed to get the whole system working however the Audio messages when I re-listen to the messages they are very quiet.

    When I up the mic gain to 35, I can hear the audio better but get a very distinct and consistent "ticking" in the background.

    Am I adjusting the wrong parameter OR is this related to the issues others are discussing over the last 2/3 pages of this thread? Im at a bit of a loss as to how to fix !
    https://github.com/h4yn0nnym0u5e/aud...feature/doc-01 is my latest effort on this front - if that's not what you're using, it's probably worth a try. A key / recent feature is being able to set microphone (i.e. record), beep, greeting, and playback levels independently, see lines 117 to 124. It's "obviously" vital to get the microphone level right - you should definitely copy test files to your PC and check they're not too quiet to be useful, or so loud there's distortion. Although greeting and playback are both from WAV files on the SD card, I gave them separate mixer channels because you can max out the greeting level for best quality, but if you're suitably cautious with the microphone level the playback of recorded messages will probably sound a bit quieter - you can up the gain on mixer channel 2 to compensate, if you want.

    On the subject of the ticking, I'm reasonably convinced that it's associated with bursts of high current during SD card writes. If you look back at post #354 above you'll see a pretty neatly done version of some better power distribution that @carpracing did, based on a suggestion I'd made earlier - if you have the skill I think it's definitely worth trying to do this. He wasn't entirely convinced, but I think with that and careful routing of the microphone cable you'll reduce the ticking significantly. You may also find a different SD card works a bit better, if it uses less current. Another approach is to use the built-in SD card slot on a Teensy 4.1. As the current flow doesn't go through the audio card, the effect is basically eliminated, as far as I can tell. This is a real analogue electronics thing, so if you increase the microphone gain you will also increase the level of the ticking.

  20. #370
    Junior Member
    Join Date
    Jun 2023
    Posts
    7
    Quote Originally Posted by h4yn0nnym0u5e View Post
    Thanks @BriComp!


    https://github.com/h4yn0nnym0u5e/aud...feature/doc-01 is my latest effort on this front - if that's not what you're using, it's probably worth a try. A key / recent feature is being able to set microphone (i.e. record), beep, greeting, and playback levels independently, see lines 117 to 124. It's "obviously" vital to get the microphone level right - you should definitely copy test files to your PC and check they're not too quiet to be useful, or so loud there's distortion. Although greeting and playback are both from WAV files on the SD card, I gave them separate mixer channels because you can max out the greeting level for best quality, but if you're suitably cautious with the microphone level the playback of recorded messages will probably sound a bit quieter - you can up the gain on mixer channel 2 to compensate, if you want.

    On the subject of the ticking, I'm reasonably convinced that it's associated with bursts of high current during SD card writes. If you look back at post #354 above you'll see a pretty neatly done version of some better power distribution that @carpracing did, based on a suggestion I'd made earlier - if you have the skill I think it's definitely worth trying to do this. He wasn't entirely convinced, but I think with that and careful routing of the microphone cable you'll reduce the ticking significantly. You may also find a different SD card works a bit better, if it uses less current. Another approach is to use the built-in SD card slot on a Teensy 4.1. As the current flow doesn't go through the audio card, the effect is basically eliminated, as far as I can tell. This is a real analogue electronics thing, so if you increase the microphone gain you will also increase the level of the ticking.
    Thanks so much for this! Really appreciate the explanation.

    I see the two mixers in my code:

    mixer.gain(0, 1.0f);
    mixer.gain(1, 1.0f);

    Would adjusting the gain on one of those improve the audio level (when I replay on my laptop) without increasing the ticking or is one tied to the other?

  21. #371
    Senior Member h4yn0nnym0u5e's Avatar
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    901
    This suggests you do not have the latest version I've committed - please see the link in post #369. You should have these lines in the sketch file if you have the correct version:
    Code:
      // ----- Level settings -----
      sgtl5000_1.micGain(39); // set to suit your microphone
      sgtl5000_1.volume(0.5); // overall speaker volume
    
      mixer.gain(0, 0.1f); // beeps
      mixer.gain(1, 0.1f); // greeting
      mixer.gain(2, 1.0f); // message playback
      // --------------------------
    The only thing that will affect the volume when you copy a file to your laptop and play it is the sgtl5000_1.micGain(39); one. I'd expect that to affect everything equally, the audio picked up by the microphone and the ticking. Only better power connections and / or cable routing and / or lower current SD card is going to affect the relative level of the ticking.

    The mixer.gain() and sgtl5000_1.volume(0.5) lines only affect what you hear on the phone speaker / earpiece.

  22. #372
    Junior Member
    Join Date
    Jun 2023
    Posts
    7
    Quote Originally Posted by h4yn0nnym0u5e View Post
    This suggests you do not have the latest version I've committed - please see the link in post #369. You should have these lines in the sketch file if you have the correct version:
    Code:
      // ----- Level settings -----
      sgtl5000_1.micGain(39); // set to suit your microphone
      sgtl5000_1.volume(0.5); // overall speaker volume
    
      mixer.gain(0, 0.1f); // beeps
      mixer.gain(1, 0.1f); // greeting
      mixer.gain(2, 1.0f); // message playback
      // --------------------------
    The only thing that will affect the volume when you copy a file to your laptop and play it is the sgtl5000_1.micGain(39); one. I'd expect that to affect everything equally, the audio picked up by the microphone and the ticking. Only better power connections and / or cable routing and / or lower current SD card is going to affect the relative level of the ticking.

    The mixer.gain() and sgtl5000_1.volume(0.5) lines only affect what you hear on the phone speaker / earpiece.

    Thanks so much for all the insight.

    One last question, can I run the CPU speed at 150mhz to make it drain my power bank less?

  23. #373
    Senior Member h4yn0nnym0u5e's Avatar
    Join Date
    Apr 2021
    Location
    Cambridgeshire, UK
    Posts
    901
    Quote Originally Posted by roryhammond View Post
    Thanks so much for all the insight.

    One last question, can I run the CPU speed at 150mhz to make it drain my power bank less?
    I believe you can, yes. That’s certainly @DD4WH’s recommendation, and he’s actually built one of these - I’ve just tweaked the software!

  24. #374
    Quote Originally Posted by kkuzy View Post
    When I pickup my handset, it goes quiet when my greeting should be playing then no beep and it starts like a clicking noise for when it is recording (I noticed the clicking noise is still there when I push the handset switch down as well). It creates files for when it's supposed to be recording but there is no audio when I listen to the file. Any suggestions on what the issue might be?
    We are having the same problem on ours. Did you ever get a response/fix for this? I looked through the forum and could not find one.

    TIA

  25. #375
    Junior Member
    Join Date
    Jul 2023
    Location
    Lompoc, California
    Posts
    17
    On TEENSY 4.0 with Audio Shield
    Running Arduino IDE Version: 2.1.1, File, Examples, Audio, HardwareTesting, PassThroughStereo...
    Latency appears to be about 6.3 ms from input to output.
    This amount of latency is not acceptable for real time processing.
    Yellow trace - Input waveform.
    Magenta Trace - Output waveform.
    I must be diligent to measure this every time I settle on some code to do a task on the Audio Stream to determine if the code affects the latency timing.

    Click image for larger version. 

Name:	PXL_20230718_115858904 (2).jpg 
Views:	24 
Size:	99.1 KB 
ID:	31521

Posting Permissions

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