Audio DMA To PWM Pins No CPU On Raspberry Pi Pico

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

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

  • @zetaconvex1987
    @zetaconvex1987 Год назад +2

    Interesting. I want to try out that OPAMP thing. FYI, the fading in and out you are referring to called "apodising" (which literally means "removing the foot").

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

      That is good to know, thank you. BTW, using just a transistor rather than an op-amp also works. I am currently using a transistor for this, the same circuit that is in my video "Emulated ZX Spectrum Beep Using A GPIO Pin". But the variable resistor I am using is 100K rather than the 10K one in the video. This make is much simpler and cheaper, and can drive a very small speaker directly.

  • @rafaelgcpp
    @rafaelgcpp Год назад +2

    I am really, really confused by the opamp circuit. It is working single supply, in inverting configuration, with positive input. Hence, the opamp output is at ground, since it cannot go negative. You are listening to amplified leak current...

    • @abraxalito
      @abraxalito 8 месяцев назад

      Not just that - the TI data for LM741 says the min supply voltage is 20V total, here its running on 5V. So I reckon it works because the resistors are doing the attenuation work, the opamp's effectively out of circuit.

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

    ah yes classic family guy intro song

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

    Nice video, but for the second time running following your videos I have failed to find the code referenced in the video on your github link. Can you please put the link to the actual project explained in the description rather than a generic link to your projects. I wanted to see what the PWM frequency is, in theory it should be a PWM frequency of at least 7 times the audio sample rate, this allows the value of C to be small in the RC which stops the clicking issue as well is improving the waveform shape. Disclaimer though i've never actually coded audio this way so I don't pretend to be any kind of expert.

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

      The frequency multiple is 125MHz / 22050 = 5669 times the sample rate.

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

      @@DevelopIT125Mhz? It is possible I guess, are you confusing the PWM source clock and PWM frequency maybe. If you set duty cycle to 50% and measure the frequency what do you get? I don't see an R/C filter, are you relying on the limited bandwidth of the opamp instead. It is more common to have one or more R/C low pass filters, this both smooths the pulses and attenuates from logic level down to something closer to 1v for the audio amp to follow. The amplifier is typically a fixed impedance so does not require an opamp or transistor to buffer the signal.

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

      @@jonshouse1 125MHz is the system clock divided by 22050 which is the sample rate gives maximum count for PWM of 5669. In other words the PWM is running at 5669 times the sample rate, which meets the requirement of the 7 times you had commented it needed to be. I think 7 times is a bit low as 3 bits can represent 7. 5669 is slightly over 12bit representation, still under the original wav file's 16bit samples though.

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

      @@DevelopIT I clearly do not follow what is going on, I guess I need to read up more on the PICO. I've used hardware PWM on PICS, I get 13 bits of resolution from PWM frequencies as low as 500Hz. The Pico has hardware PWM, best I can tell with similar specs. One, the other, or both of us are confused at this point but clearly I do not understand your maths or method so I guess it must be me. You did not answer what frequency a 50% duty cycle is for your project, so I am unclear if you are confusing the units and terminology or I am.

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

      @@jonshouse1 If measured with a frequency counter or scope, the PWM running at any specific duty cycle will always be twice the sample frequency as it only transitions once at the start of the sample and once at the required period during the cycle. However, the granularity of being able to give 50% duty is twice the sample frequency, 25% duty is four times the sample frequency, 12.5% duty is eight times the sample frequency and so on...

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

    good stuff

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

      You may like my next video for recording and playing back audio on a Pico. I'm currently documenting it and will publish it soon with all of the source code too.

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

      @@DevelopIT looking forwards!

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

    The source code for your PWM audio for PICO is not in the list of your project. If you have it there can you please place actual link directly pointing to the project in github or anywhere. Or you did you not find it finally working and worthy to be put on github?

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

      The converter to convert a WAV file to the data include file for a project is here: github.com/BirchJD/WAV-To-PWM-.h-Data
      The source code is very small and can be typed in from the video. However the current project I am working on contains the source code and will be published on GitHub when it is written up soon.

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

      @@DevelopIT I was interested in the main code of your project that runs the converted file using DMA, not in the converter itself. If you have the main part uploaded somewhere on net please let us know the link. Can a wavetable be run with different frequency in the similar fashion ?

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

      @@IndicDarshan The current project I am working on contains the source code and will be published on GitHub when it is written up soon.

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

    where (on your page on github) do i find the code for converting a WAV to PWM?

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

      I should be able to put the converter code on GitHub this weekend.

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

      I have placed the code for converting WAV to PWM here: github.com/BirchJD/WAV-To-PWM-.h-Data

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

    Nice project.
    Is 44100 sample rate possible?

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

      Technically I don't think so. The advantage of this method is that audio can play without load on the CPU, so the CPU is fully available for other tasks while the audio is playing. The quality of the audio is a compromise.

    • @user-qh5br9jl9g
      @user-qh5br9jl9g 6 месяцев назад

      ​@@DevelopIThow about going out from pwm through USB?

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

      @@user-qh5br9jl9g I wouldn't know how to do that. Good idea though.

    • @user-qh5br9jl9g
      @user-qh5br9jl9g 6 месяцев назад

      Could the processors be implemented to improve the quality of (or operate to process) the audio?

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

    Did you scheme finally worked ? Because there is no demo as well. No demo no source code!

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

      Should be part of the write up for what I am working on now, hopefully published soon.

  • @huckleberryfinn-cz3gd
    @huckleberryfinn-cz3gd 11 месяцев назад

    Sorry but I do not have the time to go through all the 25 minutes.
    Is there some point where we can here what comes out of the speakers?
    (please tell me at which time)

    • @DevelopIT
      @DevelopIT  11 месяцев назад

      It is not possible to take a short cut to knowledge and ability. With time you will learn to saw like an eagle and glide like a crane.

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

    i kind of understand i just wish i understood c ... i only know pythong and the code confuses me