Forum Rule: Always post complete source code & details to reproduce any issue!
Page 3 of 3 FirstFirst 1 2 3
Results 51 to 65 of 65

Thread: USB Audio Clicking Noise

  1. #51
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,529
    Quote Originally Posted by Theremingenieur View Post
    ... which means that FrankB and myself have spent much time for nothing... :-(
    Well Theremingenieur, I believe you know how I do things and how this forum generally works.

    Especially with a thread like this involves (maybe) different issues that manifest with similar problems, there's always a chance something may fall through the cracks. We're all humans here, with imperfect memory and many demands on our limited time & attention. When something does get missed, just (hopefully politely) bring it up again. Sometimes if a thread has become too long and at least some subset of the problems were resolved, starting a new thread with link to the old one and a clear description of what's still unresolved is the best approach.

    Unfortunately, we're in a period right now were I can't pour much engineering time into these sorts of investigations. The schedule for new Teensy hardware is approx every 2 years. When it's a major change, like we had from 2.0 to 3.0, and this transition from 3.x to 4.0, there will be a few months leading up to the release, and a couple months after, where I just can't put the usual effort into chasing down bugs. I still try to do quick tests, and I try to keep up with the forum threads. When a problem is very serious, like the recent serial lockup where Serial1.end() was called during a narrow time window where the serial fifo had an unreported framing error, I do prioritize a fix. I also try to prioritize at least looking to gauge how serious the bug is. For less serious problems, I'm afraid they're going to sit on my issue list for many months.

    About the audio timing work you & Frank have done, the honest truth is I haven't had time to look at it yet. There's a very real possibility I won't manage to look at it until T4 is released and I get caught up to a ton of other stuff that's gone onto the "after T4 release" list. I know that can feel very frustrating. Believe me, I would really rather spend my time doing these sorts of things. But the reality is PJRC really *must* keep releasing new hardware to financially sustain all this work. And the new T4 hardware, at least all the non-analog stuff, is truly amazing.

    On the USB stuff, in the very long term (like late-2019 or 2020) I might try to reimplement the whole thing using synchronous mode (see 3.3.2 on page 19 of the USB audio class 1.0 spec) and do all the necessary rate conversion on the Teensy side. Originally I discounted this idea as requiring too much CPU time. But the 17 Hz mismatch turned out to be a terribly thorny problem due the varying host side implementations. Then again, I'm not even 100% confident that would really be better. This whole USB isochronous rate matching properly with all operating systems is a really hard problem.

    Please, if this falls through the cracks, just wait a while and then bring it up as a new thread.

  2. #52
    Member
    Join Date
    Nov 2016
    Location
    France
    Posts
    30
    Thanks paul for your replies !

    But what about testing on WIN or OSX os ? and the "buffer overrun" in msg #35 ?

    edit : I just saw your post. It's not a good new for me I just bought some audio boards and I can't use them ....
    Last edited by worldhugo; 11-14-2018 at 12:09 PM.

  3. #53
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,529
    Sorry, I can't do *anything* with Mac or Windows until at least next week. Remind me after Tuesday, Nov 20th.

    Usually I can do quick tests with Linux and only small hardware, because my desktop runs Linux. To do anything at all with Mac or Windows or Raspberry Pi or Jetson TX2, or anything requiring setting up much hardware, I need to clear off my workbench to set up another machine. Sometimes on the weekends I can use the work tables where Teensy is normally tested and packaged, if Robin isn't using them for inventory management stuff.

  4. #54
    Senior Member
    Join Date
    Apr 2014
    Posts
    296
    Paul...... I tried again following you test procedure on Lubuntu 18.04 and still get the faint clicks. I have attached screen dumps and an audio wav recording.
    I am not sure that your test with the cheap USB audio adaptor is same as what I was thinking. I am not querying the quality of the playback from the PC, I was thinking of the USB audio adaptor as an alternative to recording on PC and playing back from PC ...... to try and eliminate any issues I may have on my PC because of old hardware.
    The way I would intend to test with the USB adaptor is to plug teensy into the USB port of the USB audio adaptor and connect a speaker/amplifier to the lineout of the USB audio adaptor and listen directly without using a PC.
    But I don't have one yet to try. I also see you are testing on a teensy 3.6 ..... I am using a Teensy 3.2.....is there likely to be any difference in the audio processing.?? ....... I will order one of these as well.... have about 6 of 3.2's but no 3.6s.
    Eventually my use for all of this would be to be able to send USB audio and USB power over 1 lead from a teensy controlled gadget to a USB audio input speaker or other USB audio processing device and not needing an 3.5mm jack
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	audacity1.png 
Views:	6 
Size:	181.4 KB 
ID:	15153   Click image for larger version. 

Name:	audacity2.png 
Views:	9 
Size:	185.7 KB 
ID:	15154  

    Attached Files Attached Files

  5. #55
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,529
    Quote Originally Posted by Teenfor3 View Post
    The way I would intend to test with the USB adaptor is to plug teensy into the USB port of the USB audio adaptor and connect a speaker/amplifier to the lineout of the USB audio adaptor and listen directly without using a PC.
    This doesn't make any sense.

    That USB audio adaptor is a USB device. USB devices can only be plugged into USB hosts or hubs, where the hubs plug into a USB host. You can't plug a USB device into another USB device.

    When you think of USB devices, think USB mouse & USB keyboard. When you think of USB hosts, think computers. You can only plug keyboards and mice into a computer. Plugging a keyboard into a mouse without a computer makes no sense at all!

    Teensy 3.2 has only 1 USB port which only works as a USB device.

    Teensy 3.6 has 2 USB ports, where the 2nd port can work as a USB host. So in some glorious but distant future where the USBHost_t36 library gets isochronous pipe support (currently only control, bulk & interrupt pipes work) and an audio driver is added, and this hypothetical driver offers whatever isochronous synchronization method that USB adaptor wants, and that driver integrates with the Audio library (no small feat to do well... as this thread shows), then you could use it with Teensy 3.6 on the host port. But that's a lot of software which doesn't exist today. USBHost_t36 offers only a small collection of USB device drivers.

    There just isn't any way to use that USB adaptor connected to a Teensy, and there *never* will be any way with Teensy 3.2 because the USB on 3.2 only supports device mode.

  6. #56
    Senior Member
    Join Date
    Apr 2014
    Posts
    296
    Paul, thanks for the info......well thats that then......I suppose I should have read the small print somewhere and known this myself. I just thought as teensy was generating the audio and needed another object running to keep USB running that it would output audio data to what was plugged in. But that explains it, thanks.

    Maybe thats why USB audio is not so popular....everybody uses 3.5mm jacks even on bluetooth speakers.???

    Regards, then sending and recording to a PC, I discovered that if I set the sine frequency to 1000Hz I do not hear any clicks, at 1200Hz the clicks start to be heard faintly and similar at 800Hz the start to be heard faintly. The clicks are louder or heard more easily with higher frequency. at 4000 Hx the clicks are quite distinct. I reduced the amplitude of a 4000Hz sine to 0.01 and recorded this and the audio as well as the clicks were reduced to low 0.01 amplitude. I amplified this in Audacity and 4000Hz audio and clicks can be heard. So does that mean the clicks are coming in with the audio and not being generated in the PC audio processing...???. I have attached audio recording of the sounds.
    Attached Files Attached Files

  7. #57
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,529
    Quote Originally Posted by Teenfor3 View Post
    Regards, then sending and recording to a PC, I discovered that if I set the sine frequency to 1000Hz I do not hear any clicks, at 1200Hz the clicks start to be heard faintly and similar at 800Hz the start to be heard faintly. The clicks are louder or heard more easily with higher frequency. at 4000 Hx the clicks are quite distinct
    Please test with another PC. I'm pretty sure this problem is happening entirely on your PC, since you're getting correct waveforms recorded from Teensy when viewed in Audacity, and I can't reproduce it here when playing the also-good waveforms through 2 different output devices (high quality speakers and a cheap USB audio adaptor with good quality headphones). Unless there's a way to reproduce it on other computers, I'm going to assume this particular problem is just poor quality audio hardware on your PC.

    If the problem is on your PC and not anything to do with Teensy, all this talk is only a distraction from the rest of this thread, where playing (not recording) with Teensy is suffering problems with some computers.

  8. #58
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,997
    It's just that I can exactly reproduce the same problem on my MacBook Pro: I hear that crackling, too, after recording Teensy's USB audio output in Audacity (while the waveforms are displayed nicely) when playing back the recording over the MacBook's internal speakers with the Teensy disconnected. And FrankB experienced the same. So, the conclusion that would be a problem on Teenfor3's PC seems not very logical to me, especially after I could show that the subroutine which handles buffer overruns is definitively involved.

    But let's postpone that and not longer steal precious Teensy4 development time! I don't think that it's a heavy or blocking problem, so we can wait until further investigation will be possible in 2019.

  9. #59
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,640
    Yes. I hear the same - live, without recording, Windows 10 pro.
    And yes, the T4 is more important

  10. #60
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,529
    Ok then, this thread will go on the list of stuff to investigate more at a later date.

    I've tried to catch up on the forum and missed emails over the last couple days, while waiting for a T4 board rev (which allows the bootloader to control the boot mode pins - needed to recover from certain ways the board could otherwise become bricked). The PCBs arrived just now! I'm going to take them over to the contract manufacturer now!

  11. #61
    Senior Member
    Join Date
    Apr 2014
    Posts
    296
    Yes, I have tried again on Lubuntu laptop and on XP desktop and win 10 laptop and clicking is still there. If I compile on one and play on another, still clicks.

    I listened to the 1000 Hz and 1200Hz and 2000Hz that I posted earlier, on both XP and Lubuntu with the same headphones each time turned up same loudness and clicks are there in the 1000Hz as well, I think it was masked more when listening earlier on laptop speakers not so loud and I thought clicks wern't there at 1000Hz.
    I can also listen without the need to record and playback on XP by clicking "Click to Monitor" in Audacity and the clicks are still there. Also same with Win 10 in sound settings can click the tick box to listen to Teensy input device without recording and still get clicks.

    I started this thread, so thank you all for your help, and I have learned that teensy3,2 is a USB device and needs plugged in to a USB host, which is not really what I was wanting on this instance. But for now teensy DAC and audio lead is still good quality simple sound.

  12. #62
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,529
    Can you save one of these recordings that has the clicks and share it here?

  13. #63
    Senior Member
    Join Date
    Apr 2014
    Posts
    296
    I dont understand........are all the posts not available to everybody on this forum....?????

    Post .... #56 ..... has 3 recordings

    Post .... #54 ..... has 1 recording

    There are 2 other recordings earlier.....one from Therem.... and one from worldhugo......

    #54 and #56 are zipped wave files for best detail....

  14. #64
    Member
    Join Date
    Nov 2016
    Location
    France
    Posts
    30
    Yes, we have already sent several audio files. If you need, Paul, I can send others, tell me what you want

  15. #65
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,997
    ok, to preserve every info and attachments, I'll temporarily close this thread for now and reopen it on demand when the time for it will have come.

Posting Permissions

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