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").
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.
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...
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.
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.
@@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.
@@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.
@@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.
@@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...
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.
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?
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.
@@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 ?
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.
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)
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").
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.
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...
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.
ah yes classic family guy intro song
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.
The frequency multiple is 125MHz / 22050 = 5669 times the sample rate.
@@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.
@@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.
@@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.
@@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...
good stuff
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.
@@DevelopIT looking forwards!
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?
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.
@@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 ?
@@IndicDarshan The current project I am working on contains the source code and will be published on GitHub when it is written up soon.
where (on your page on github) do i find the code for converting a WAV to PWM?
I should be able to put the converter code on GitHub this weekend.
I have placed the code for converting WAV to PWM here: github.com/BirchJD/WAV-To-PWM-.h-Data
Nice project.
Is 44100 sample rate possible?
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.
@@DevelopIThow about going out from pwm through USB?
@@user-qh5br9jl9g I wouldn't know how to do that. Good idea though.
Could the processors be implemented to improve the quality of (or operate to process) the audio?
Did you scheme finally worked ? Because there is no demo as well. No demo no source code!
Should be part of the write up for what I am working on now, hopefully published soon.
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)
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.
i kind of understand i just wish i understood c ... i only know pythong and the code confuses me