Forum Rule: Always post complete source code & details to reproduce any issue!
Page 5 of 5 FirstFirst ... 3 4 5
Results 101 to 125 of 125

Thread: Audio Library for Linear Timecode (LTC)?

  1. #101
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,557
    ..just to be sure: You're using the latest example and library code from Github?

  2. #102
    Member
    Join Date
    Feb 2013
    Location
    Portland, OR
    Posts
    55
    I emailed with the author of the LTCReader software and shared my wav files with him. He said they looked fine and worked offline for him, just as they did for me. I was using an outdated version of the LTCReader program. When I updated to the latest v6.04, then it started properly reading the LTC signal from both our Teensy LTC genereator, and from the Tentacle sync. So that's good news!

    But I still couldn't get the Tentacle to sync to my Teensy signal, and I'm not sure why.

    Next thing I did was check the wiring on the RC low-pass filter, and it was wired wrong. I fixed that and then the waveform went from a nice square to almost a sin wave, and I could hear the filter working, cutting off the high frequency information. So I will experiment with that to get it to behave better. With the correctly wired lowpass filter, the LTCReader still was able to resolve sync from the teensy, but the tentacle was not.

    Finally, I removed the low pass once more, and suddenly the tentacle started working. Why? I have no idea.

    So as of this moment, everything seems to be working. As to why it didn't work with the tentacle before, I don't know.
    Perhaps it was a problem with the incoming audio level, which I've been changing at times... maybe it was looking for a line level signal and I was sending a mic level signal?


    I believe I'm using latest version of your code and library Frank, but will confirm that next time I have a chance to play with it.


    -Tom

  3. #103
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,557
    Well, that's great news!

    I was just working on the data before I went to dinner. Then I came back and saw your posting.
    I've prepared it before, so here's the bitstream:
    Code:
    0:  0000 0000 - 0000 0000 - 0000 0000 - 1101 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    1:  1000 0000 - 0000 0000 - 0000 0000 - 1100 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    2:  0100 0000 - 0000 0000 - 0000 0000 - 1100 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    3:  1100 0000 - 0000 0000 - 0000 0000 - 1101 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    4:  0010 0000 - 0000 0000 - 0000 0000 - 1100 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    5:  1010 0000 - 0000 0000 - 0000 0000 - 1101 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    6:  0110 0000 - 0000 0000 - 0000 0000 - 1101 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    7:  1110 0000 - 0000 0000 - 0000 0000 - 1100 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    8:  0001 0000 - 0000 0000 - 0000 0000 - 1100 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    9:  1001 0000 - 0000 0000 - 0000 0000 - 1101 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    10: 0000 0000 - 1000 0000 - 0000 0000 - 1100 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    11: 1000 0000 - 1000 0000 - 0000 0000 - 1101 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    12: 0100 0000 - 1000 0000 - 0000 0000 - 1101 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    13: 1100 0000 - 1000 0000 - 0000 0000 - 1100 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    14: 0010 0000 - 1000 0000 - 0000 0000 - 1101 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    15: 1010 0000 - 1000 0000 - 0000 0000 - 1100 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    16: 0110 0000 - 1000 0000 - 0000 0000 - 1100 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    17: 1110 0000 - 1000 0000 - 0000 0000 - 1101 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    18: 0001 0000 - 1000 0000 - 0000 0000 - 1101 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    19: 1001 0000 - 1000 0000 - 0000 0000 - 1100 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    20: 0000 0000 - 0100 0000 - 0000 0000 - 1100 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    21: 1000 0000 - 0100 0000 - 0000 0000 - 1101 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    22: 0100 0000 - 0100 0000 - 0000 0000 - 1101 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    23: 1100 0000 - 0100 0000 - 0000 0000 - 1100 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    0:  0000 0000 - 0000 0000 - 1000 0000 - 1100 0000 - 1110 0000 - 0010 0000 - 0001 0000 - 1000 0000 - 0011111111111101
    Read it backwards!
    Maybe it's useful for you.

    Perhaps tentacle wants one of the flags set?

  4. #104
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,557
    ..you can feed with other sources - today I noticed there is a andriod app for generating the code. I'd check if tentacle has problems with other sources, too.

  5. #105
    Member
    Join Date
    Feb 2013
    Location
    Portland, OR
    Posts
    55
    Ach! I spoke too soon.

    I had the teensy running in the background for 10 or 20 minutes, and when I returned to the serial output, the hours on the teensy output had jumped from 10h (where mine is preset to start) to 20h. Clearly it wasn't 10 hours of elapsed time, so something funny is going on. I'm not sure if this is a problem in the encoding, or the decoding side. I noticed this earlier today, so it's happened at least twice. It might be some sort of feedback from plugging/unplugging the audio output? Seems strange that it would happen twice the same way if it was signal noise causing the problem.

    ----
    I let the teensy run again, and this time noted the moment it switched over: serial port reads:

    10:14:59.23
    10:14:59.24
    20:29:27.00
    20:29:27.01
    20:29:27.02
    20:29:27.03
    20:29:27.04
    20:29:27.05... etc

  6. #106
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,557
    oops.............?

  7. #107
    Member
    Join Date
    Feb 2013
    Location
    Portland, OR
    Posts
    55
    At least it's consistent and it only takes a few minutes to happen!
    I'm setting my initial timecode with this line in setup()
    setTime(10, 10, 0, 24, 4, 2020); //set initial time

    I just ran it again and got the same results. This time didn't touch the teesny or any wires connected to it.

    -----
    10:14:59.24
    20:29:27.00

  8. #108
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,557
    ? does not happen on my teensy:
    Code:
    10:14:59.20
    10:14:59.21
    10:14:59.22
    10:14:59.23
    10:15:00.00
    10:15:00.01
    10:15:00.02
    10:15:00.03
    10:15:00.04

  9. #109
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,557
    The 20:29:27 look like a skipped bit.

  10. #110
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,557
    As I have a 3.6 here on my desk, i'm working with that. I even tried to slow it down to 24MHz and it still works (hey..encoding AND decoding the same time - the Teensys are so fast..). So it can't be speed.

  11. #111
    Member
    Join Date
    Feb 2013
    Location
    Portland, OR
    Posts
    55
    We've created a rip in the space-time continuum!

    I let it run for a while:

    It's normal from startup until:
    10:14:59.24
    20:29:27.0

    -----
    Then runs fine till this:
    20:34:26.24
    20:29:27.00

    -----
    Now we enter the loop of time:
    20:34:26.24
    20:29:27.00

    Who knew the Teensy was capable of time travel!

  12. #112
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,557
    Can you post your sketch?
    I can not confirm this problem on my Teensy with my sketch.

    The frame-# 24 should'nt happen...

  13. #113
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,557
    Maybe let's discuss that via mail.. no need to spam the forum..

  14. #114
    Member
    Join Date
    Feb 2013
    Location
    Portland, OR
    Posts
    55
    I just sent you an email through the forum with the code. The reason you saw frame 24 above in my examples was because I set the FPS to 25.
    I'm using your latest code from github, and only added the line in setup() to reset the teensy time to my preset number.

    -Tom

  15. #115
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,557
    The bug is in the timelib. The realtime-clock shows the same effect after 5 minutes.
    Let's try to find that...

  16. #116
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,557

  17. #117
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,557
    Use Teensy3Clock.set(10 * 3600 + 0 * 60 + 0 ); instead.

  18. #118
    Quote Originally Posted by Frank B View Post
    Cool! Is this a I2C display? How fast is it?

    You can reduce the lag by using a smaller audio block size.
    Then, there is no check if the data are correct. You could add a check for the parity or if the received time makes sense.
    I.e. a "time" 25:60:00 would be a indication for some bit errors..
    This is not an I2C display, it uses a MAX7219 which is basically SPI. I'm using the LEDControl library (https://www.pjrc.com/teensy/td_libs_LedControl.html) and it seems to be keeping up just fine. I actually have it set for two full displays, so it's churning the bits for twice the number of digits as I have connected right now. I'll need to do a bit more testing to see if I can characterize the lag more before trying to solve it. For my main purposes (display), a frame delay isn't a huge issue.

    I did a few tests on calculating frame rate. So far I've only used one generator, I will need to try an alternate to verify my theories. I haven't implemented these in software, I just had the unit spit out the timestamp of each packet then did some work in Excel.

    So far what I'm seeing is that there seems to be a large and a small timestamp interval (for 30fps I see intervals of 34793 and 31937). I averaged these two and get 33365. If I calculate 1,000,000/33365 I get 29.97 fps, which is pretty close to 30. And yes, I am sure this should be actually 30fps. Still, that's pretty darn close. I'm a bit further off on 24fps and 25fps, but usually within about 0.2 of the correct fps.

    Is there any other method you think I should be using to calculate this? To be clear, I'm fairly happy with this, I just want to make sure I haven't make some terrible mistake.

    Thanks!

  19. #119
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,557
    I don't know.
    Maybe taking an average over a couple of frames is helpful for the fps calculation. Just a guess.

  20. #120
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,557
    Or maybe just use the highest frame-number within a second?

  21. #121
    Quote Originally Posted by Frank B View Post
    I don't know.
    Maybe taking an average over a couple of frames is helpful for the fps calculation. Just a guess.
    Yep, this is what I'm going to do. Just wanted to double check I wasn't messing up on the math! Thanks!

  22. #122
    Member
    Join Date
    Feb 2013
    Location
    Portland, OR
    Posts
    55
    Let us know how it turns out.
    Did you say which model Teensy you are using? and at what processing speed?

  23. #123
    Quote Originally Posted by tomfrisch View Post
    Let us know how it turns out.
    Did you say which model Teensy you are using? and at what processing speed?
    Hi Tom!

    I didn't say, but I am using a 3.2 for this testing. I have considered going to a 3.5 to get more I/O for switches and indicators if I ever get around to making this project a bit more permanent! I had considered a 4.0 for speed, but so far doesn't seem to be needed. Plus I hope to experiment with USB audio eventually. Then again, maybe by the time I'm ready, it will be ready on the 4.0!
    Last edited by jkoffman; 01-30-2020 at 07:55 PM. Reason: Typo - 3.1 instead of 3.2

  24. #124
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,557
    Go for both. Or, best, buy 2x 3.5, 2x3.6, 2xT4 (no, I do not get money from PJRC, haha)
    The 3.5 give you 5V compatibility, the 3.6 more speed and ease of use, the T4 raw speed, but if you want to use it like me, more "hardcore", its way more difficult..
    The T4 "reference manual" makes headaches. At least. Only the parts that are correct the other things...let's not mention them. Its full of missing and wrong information.
    The other manuals, too, but they are not bad as the T4 manual..

    But.. it may be ideal for beginners. Often, they have problems due to the slow code they write. The T4 will help them.

  25. #125
    I have several of all options, don't worry! I buy extras each order. The only problem is where I keep putting the ones I haven't used yet. Hm...

Posting Permissions

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