Phase Shifting with DSP using the Teensy

Поделиться
HTML-код
  • Опубликовано: 10 дек 2024

Комментарии • 46

  • @egbertgroot2737
    @egbertgroot2737 3 года назад +2

    Just subscribed as well .... this is gold for me! HAM radio experiments to next level. Even for audio phaser application super interesting!

    • @na5y
      @na5y  3 года назад +1

      Thank you Egbert!

  • @TheOleHermit
    @TheOleHermit 6 месяцев назад

    CORRECTION: Although the SGTL5000 has I2C controlling the CODEC, the audio communications between the T4.x and SGTL5000 are strictly I2S. Many folks don't understand the difference between I2C device control and I2S audio protocol.
    I've used 2 SGTL5000 audio boards, with one modified with a unique I2C address for quad in/out, as well as the CS42448 6in/8out CODEC for a laser synth. But, with the CS42448 @ EOL, I'm now developing a new PCB, using the 6in8out PCM3168A CODEC.
    JS

  • @rfdave3980
    @rfdave3980 4 года назад +1

    Excellent Video. So interesting. Yes Charlie Morris is my inspiration as well.

    • @na5y
      @na5y  4 года назад

      There is a *pile* of code running behind the Teensy arduino environment - particularly in the audio processing side of things. I have even seen a few videos of hooking up the NXP programming/debugging environment to the Teensy through the debug lines. I'd love to do that because I am not a huge fan of the Arduino programming environment

    • @rfdave3980
      @rfdave3980 4 года назад

      @@na5y Yes I too am not a big fan of that environment, but it is a great starter. I wish they stop calling library's they are classes. Library is where all the collection is. Oh well , I use Atmel Studio. Intellisence is very nice. Keep your video's coming I enjoy them. Thank you. 73

    • @na5y
      @na5y  4 года назад

      @@rfdave3980 I have been using STM32CubeIDE. Would like to use Keil, because it has broad support, but it is expensive for the hobbyist and the "freeware" version limits you to around 32kB binary files.

  • @R2AUK
    @R2AUK Год назад

    Re-watching the video in 2023. Thanks for sharing! 👍 Couldn't find much information about Hilbert Filters either. The book "Understanding Digital Signal Processing, 3rd Edition" by Richard Lyons has a good description of Hilbert transform in chapter 9, and there is a math for calculating the coefficients in section 9.3. The author does 0/90 degree phase shifting instead of +45/-45 one which obviously doesn't make much difference for us. The chapter does describe how to preserve the *relative* phase shift for a pair of signals, see Fig 9-12. I found the chapter somewhat difficult to follow because the author seems to have other uses cases of the Hilbert transform in mind. But from what I can tell it should serve our purposes.

    • @na5y
      @na5y  Год назад +1

      Thanks for the lead Alex I will check it out. I ended up figuring out how to produce my own 0/90 phase shift using python libraries to generate the coefficients: ruclips.net/video/BUGQaTJ6aWI/видео.html
      Its not perfect and you have to make sure you run the signal through a band pass filter as the delay filter doesn't do that. I still haven't been able to find a way of generating coefficients for an arbitrary phase shift though (say 0 and 89). Let me know if you find one!

  • @hpa4355
    @hpa4355 4 года назад

    You got yourself a new subscriber with this video ! really interesting, looking forward to explore your channel :) thank you for sharing your work !

    • @na5y
      @na5y  4 года назад

      Thank you very much - glad you enjoyed the video!

  • @TheOleHermit
    @TheOleHermit 6 месяцев назад

    ref: 'Notes and Volts' Teensy Synth tutorial series. 👍
    That's where I learned.

  • @NeonFuxAlot
    @NeonFuxAlot 3 года назад +1

    i would love to see SDR based on the teensy , did you make one yet ? i only just discovered the device and ordered myself a Teensy 3.2 and the TEENSY3_AUDIO board

    • @na5y
      @na5y  3 года назад +2

      Hi Steven - thank you for the comment. I never did a video of my Teensy SDR - I did post the code up at github here github.com/thaaraak/IQ-Radio/blob/master/Tayloe/Tayloe.ino - that radio was receive only. I know its not quite what you are after but I did do an STM32 based SDR here ruclips.net/video/I8ZwlgjXAZM/видео.html
      Charlie Morris has a really good series on his SDR which uses the Teensy starting here ruclips.net/video/J7FEJeCYBpY/видео.html
      Thanks again for the comment - please let me know if you have any questions

  • @DavyOneness
    @DavyOneness 2 года назад

    Thanks for this video, been working on phaseshift, but hung up on converting the coefficients for teensy. Some people convert it in a spreadsheet, which I was trying to figure out. I see you do it in the program, that doesn't effect the CPU usage compared to pre converted?

    • @na5y
      @na5y  2 года назад +1

      You mean the multiplication of the coefficients by 32768 in the array? That 's only going to be done once on initialization. It will slightly delay startup but it won't have any runtime effect beyond that. Thank you for the comment and question!

    • @DavyOneness
      @DavyOneness 2 года назад

      @@na5y oh. Ok, that makes sense then, thanks for quick reply!

    • @na5y
      @na5y  2 года назад +1

      @@DavyOneness You are welcome - good luck with the Teensy!

  • @ki4dbk
    @ki4dbk 2 года назад

    This is really impressive!

    • @na5y
      @na5y  2 года назад

      Thank you very much - glad you enjoyed!

  • @mancio92M
    @mancio92M 4 года назад +1

    beautiful tutorial

    • @na5y
      @na5y  4 года назад +1

      Thank you for you kind words - I am glad you enjoyed the video

  • @phillipneal8194
    @phillipneal8194 2 года назад

    Nice video. Thank you

    • @na5y
      @na5y  2 года назад

      Thank you Phillip

  • @odissey2
    @odissey2 3 года назад

    The low cut-off for Hilbert filter with 160 taps and 44.1kHz sampling rate would be 44100÷160=276Hz. It is typically usable up to 1.3-1.5x of that value, which is ~400Hz.
    I am surprised that only 200 coefficients are allowed by Teensy. Is this a hard value or a library limitation?

    • @na5y
      @na5y  3 года назад

      Thank you for your comment. The library used by the teensy for FIR is the CMSIS DSP library. In particular this is the call from the teensy arduino code (filter_fir.cpp)
      arm_fir_fast_q15(&fir_inst, (q15_t *)block->data,
      (q15_t *)b_new->data, AUDIO_BLOCK_SAMPLES);
      There's no limitation in that library the limitation is just purely the amount of processing power you have on the uController

    • @odissey2
      @odissey2 3 года назад +1

      @@na5y Thank you for reply and video. Subscribed.

    • @odissey2
      @odissey2 3 года назад

      @@na5y To improve SSB carrier suppression I would try to scale left or right FIR coefficients by small amount

    • @na5y
      @na5y  3 года назад

      @@odissey2 I will have to give that a try - thank you for the tip!

  • @thedanyesful
    @thedanyesful 3 года назад

    Don't you lose a bunch of precision converting your double to a short int?

    • @na5y
      @na5y  3 года назад +1

      You do but the FIR filter algorithm used by the teensy (arm_fir_fast_q15) uses 16bit signed integers for the coefficients, so it doesn't matter

  • @egbertgroot2737
    @egbertgroot2737 3 года назад

    Would it be possible to programme a FM stereo encoder signal using this setup?

    • @na5y
      @na5y  3 года назад

      I must admit I haven't done a lot of FM - just some VCO stuff (have the audio signal waveform as input to control an oscillator frequency). I haven't done any FM demodulators.
      I am mainly using DSP here for the 90 degree audio shift required for unwanted sideband suppression. Upshot is I would say probably not useful for FM modulation - but its an intriguing question. There's a paper here about using DSP for FM demodulation might be worth a read
      www-elec.inaoep.mx/~rogerio/Digradio.pdf

    • @egbertgroot2737
      @egbertgroot2737 3 года назад

      @@na5y Thanks for your reply. I will look at quite some of your vlogs in the near future. Just discovered it.
      Main question is actually can you write code that makes a physical balanced mixer circuit superfluous?

    • @na5y
      @na5y  3 года назад

      @@egbertgroot2737 The tayloe mixer series I do elsewhere - here for example:
      ruclips.net/video/bOyliyEWw8U/видео.html
      Does away with a traditional double balanced mixer and replaces that with a quadrature controlled FST3253 switch. Could it *all* be done in code without specialized hardware (frequency synthesis as well) - all I am sure of is that *I* couldn't do it ;)
      Thanks for the comment!

  • @awaazmatroko5972
    @awaazmatroko5972 4 года назад

    Very nice video, pls I am new inro this, looking for low budget audio dsp 2 in 2.1 or 4 out, low , mid high pass, and sigma studio, (Less programing)

    • @na5y
      @na5y  4 года назад +1

      Thank you for the comment. I am not familiar at all with Sigma Studio. I did do a separate video on DSP using STM32 F767 and the pMod board. Check it out if you are interested - programming is relatively straightforward
      ruclips.net/video/jvmejxsQzn4/видео.html

  • @MrRonychakraborty
    @MrRonychakraborty Год назад

    Bro What is the Mixer ADE ......

    • @na5y
      @na5y  Год назад

      I'm sorry which mixer were you referring to?

  • @billglass5160
    @billglass5160 3 года назад

    Very interesting video! I have bought a Teensy4.0 and the corresponding audio board. Your displayed hardware setup is very useful for me! I want to make an automatic gain control for my TV audio output so I can gain-equalize the various sequences (commercials, films, or my various mp3 songs which have non-normalized gains). I have a question. Where did you get the command language shown in your sketch shown below? I know signal processing and the Arduino but I'm a new guy for the Teensy. There must be a manuel describing the audio library commands somewhere? THANX!!!
    from your Hilbert Arduino sketch:
    #include
    Si5351 si5351;
    AudioControlSGTL5000 ctl;
    AudioAmplifier amp;
    AudioInputI2S i2s1; //xy=233,194
    AudioFilterFIR fir2; //xy=494,294
    AudioFilterFIR fir1; //xy=498,93
    AudioOutputI2S i2s2; //xy=743,192
    AudioConnection patchCord1(i2s1, 0, fir1, 0);
    AudioConnection patchCord2(i2s1, 1, fir2, 0);
    AudioConnection patchCord3(fir2, 0, i2s2, 1);
    AudioConnection patchCord4(fir1, 0, i2s2, 0);
    ..
    ..
    bool i2c_found = si5351.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0);
    si5351.drive_strength(SI5351_CLK0, SI5351_DRIVE_2MA);
    si5351.drive_strength(SI5351_CLK2, SI5351_DRIVE_2MA);
    ..
    ...
    ctl.enable();
    ctl.volume(0.8);
    ctl.inputSelect(AUDIO_INPUT_LINEIN);
    amp.gain( 10 );
    fir1.begin(plus45, NUM_COEFFS);
    fir2.begin(minus45, NUM_COEFFS);

    • @na5y
      @na5y  3 года назад

      There is an online manual Bill - go here
      www.pjrc.com/teensy/gui/index.html?info=AudioInputI2S2
      As you click on the class (e.g. I2S2) help text appears over to the right. I think the rest of the message was cut off though. If you are interested in Finite Impulse Response filters work there area a variety of resources out there e.g.
      eclipseaudio.com/fir-filter-guide/
      The software I use to create the coefficients is here
      iowahills.com/

    • @billglass5160
      @billglass5160 3 года назад

      @@na5y Thanx. So I imagine that you used this GUI tool to create those commands? It seems to be very useful for 100% forward processing operations such as a Hilbert filter. However, in my case, I will have to provide feedback information for the volume gain, according to the output of the averaging filter. I noticed that there are not any closed-loop algorithms (LMS filter for example) in this GUI tool. Anyway, I'll start my project when I get my long header pins that I forgot to order. I'll see how that goes. Thanks again!!!

    • @na5y
      @na5y  3 года назад

      I usually use the GUI just to get started and then refer to the class information from then on. There's a project page on that site I sent you with a whole pile of other audio stuff people have done with their teensy's. Its a fun little board. Let me know how you get on and thanks for the comment.
      The teensy uses CMSIS-DSP under the covers. That has IIR filters in it so if you are feeling brave you could mod the teensy audio code. I think you could use that for least mean squares couldn't you? Not a DSP expert here by any means. Also there is an RMS component in the library which you could potentially use

    • @billglass5160
      @billglass5160 3 года назад

      @@na5y I'm learning more & more about Teensy thanks to your useful answers! No, I won't need an LMS (it's an adaptive FIR) algo for the AGC. I was just citing examples of closed-loop functions. Yeah, the Teensy looks like a fun processor. Reminds me of my DSP days when I was working. I'll let you know how my project goes. Hardest part is starting it.