rgrosset / pico-pwm-audio Goto Github PK
View Code? Open in Web Editor NEWRaspberry Pi Pico PWM Audio Project
License: MIT License
Raspberry Pi Pico PWM Audio Project
License: MIT License
Hi @rgrosset!
I want to know, if you can do an example, playing diferent sounds, every 2 or 3 seconds.
Thx!
Thanks a lot for sharing this project!
You set the PWM wrap to 250 but amplitude levels in e.g. sample.h go up to 256, doesn't that mean that you slightly amplify the sound (by 256/250) and then clip the loudest parts of the waveform?
See this chart for the specs:
IIUC
wrap = top counter level = 250
level = end of duty cycle
so, that for all values >= 250 you get a full duty cycle / voltage.
Hello Robin,
Could you add a few instructions on how to use the converter please?
Thanks
I'm trying to compile with a sample.h file that is larger then 15 seconds at 11 mhz.
I keep getting this message when trying to compile the file for my pi pico.
I don't know cmake, or make very well. I have compile c/c++ but it's been a long time.
I get a message stating that there is not enough space in RAM but don't know where I would go to increase the reserved ram so I can just get the program compiled. I tried to increase the RAM section in the pico-pwm-audio.map file but it doesn't seem to make a difference.
Maybe I need to run cmake again after I adjust the map file? I'm not sure and just home I can get more then 15 seconds of audio to play. If this is the max amount of time, that is all I need to know.
Let me know if you need more information regarding my issue.
Thank you in advance for any assistance.
... so I can check my circuit works, before battling with getting the compiler working. I usually use the Arduino IDE, so I don't have the Raspberry Pi Pico SDK installed. If it works, I could try and port it to the Arduino IDE. Thanks.
Hi could you please let me know how you chose the value 250 for this function in pico-pwm-audio.c
pwm_config_set_wrap(&config, 250);
I can understand how your clock divider and other values ultimately set a sampling frequency of 11000 Hz for the clock frequency you have chosen, but I wanted to understand how you chose those specific values.
The reason I ask this is because I want to take audio input from a "line-out" audio signal attached to the ADC and play it back in PWM in real time. I don't have experience with generating audio using PWM and your code is also serving as a tutorial for me. The ADC audio samples are 12-bits and I am storing them in a uint16 and the ADC values that I am getting are in the range 2030 to 2090. Since they are all bigger than 250, using your code as it is now and just using my ADC data as input for the PWM output does not generate any PWM signal. I have tried changing the 12-bits of ADC to 8 [doing something like this in pwm_interrupt_handler()]
pwm_set_gpio_level(AUDIO_PIN, (WAV_DATA[wav_position>>3]) >>4);
but that also adds a lot of noise to the output sound, so I think I may be going about this the wrong way.
So I am guessing it is better if I do not loose any bits of my audio samples and find out a way of playing them as 16 bit audio. Could you give me some ideas on how to do this, or at least what is the proper way to choose the pwm_config_set_wrap value, and the number of shifts in WAV_DATA[wav_position>>3]?
Hi, thanks for your example file for the PWM audio and supporting files. this has been a great help so far
1 minor snafu: your CMakeLists.txt file has your SDK location hardcoded, preventing cmake from running for everyone without a user called robin ;) . A quick '#' solved the issue
It was a quick and easy fix for myself, but might catch some newer users trying to build the software
Finally, you propose the clone git@github link for downloading the repository. I would recommend changing that to the https://github version as otherwise the clone command will fail for users without an account on most clean build environments.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.