DEV Community

Cover image for Happy Pi Day! I made a Pi-ano πŸ˜†
Best Codes
Best Codes

Posted on

14 4 5 7 6

Happy Pi Day! I made a Pi-ano πŸ˜†

Happy Pi Day! πŸ₯³
March 14th (3/14) is the day we celebrate everyone's favorite never-ending number: Ο€. To celebrate, I made a Pi-ano. You're probably wondering what that is. Well, let's see! 🎹

Introducing the Pi-ano 🎢

The Pi-ano does exactly what it sounds like β€” it calculates digits of pi and plays a note for each one; it's a piano controlled by pi! Each digit (0-9) is mapped to a different note, so as Pi unfolds, it creates a completely unique melody.

How It Works

  • The program continuously computes digits of Pi.
  • Each digit corresponds to a note, and the note is played on your speaker.
  • It's basically a never-ending, math-powered concert.

Here's a quick demo. Don't get your hopes up, the song isn't that great:

Try It Yourself!

Want to hear Pi sing? You can check out the code and play around with it here:

https://github.com/The-Best-Codes/bestcodes-react-site/tree/main/app/math/pi-ano

More Pi Day Fun

Of course, Pi Day isn't just about weird musical experiments. It's a great excuse to eat pie. πŸ₯§
What's your favorite kind of pie? (I don't have a favorite, I like all of them!)

How are you celebrating Pi Day? Let me know in the comments!

Sentry image

See why 4M developers consider Sentry, β€œnot bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (45)

Collapse
 
rollcode22 profile image
Roll Code β€’

Fun post! Don't eat too much pie, though, or you'll end up with a big circumference. 🫠

Collapse
 
best_codes profile image
Best Codes β€’

🀣

Collapse
 
best_codes profile image
Best Codes β€’

What are you all doing for Pi day?

Collapse
 
bretbernhoft profile image
Bret Bernhoft β€’

Working on a Raspberry Pi quantified-self project. Building electronics has been a lot of fun and eye-opening.

Collapse
 
best_codes profile image
Best Codes β€’

Yep, I've got a Raspberry Pi too! Do you have a Pi 5? I've heard they're awesome!

Happy Ο€ day!

Thread Thread
 
bretbernhoft profile image
Bret Bernhoft β€’

I do have a RPi 5, which is a true computing powerhouse. It processes updates and Python instructions like a champ.

Happy Ο€ day do you as well!

Thread Thread
 
best_codes profile image
Best Codes β€’

Wow, do you have the 16 GB RAM one? I was just looking on the website and they seem to have improved a lot since the Pi 3

Thread Thread
 
bretbernhoft profile image
Bret Bernhoft β€’

I have the 8 GB model, and rarely use more than 10% of the available RAM. The advertised use case for the 16 GB model is as a tool among top power users. It would be interesting to see the types of applications which require that much RAM on the RPi 5. I would think those users would primarily be business and industrial customers?

And indeed, these little computers have been transformed since the Raspberry Pi 3 model was released. Model 5 includes hyper-optimization and a bunch of new hardware features.

Thread Thread
 
best_codes profile image
Best Codes β€’

I can see where 16 GB would be good for running AI models locally and stuff. It would be nice to have a local mini-AI server. I wonder if the Pi 5 has a GPU...

Thread Thread
 
bretbernhoft profile image
Bret Bernhoft β€’

I could see that as well. The requirements for running an AI model on one's computer are dropping fast. Right alongside a growth in computing power and capacity.

I know from having recently updated my RPi 5, there is NVIDIA code running on the computer. So my guess would be yes, the Raspberry Pi 5 has a GPU of some sort.

Thread Thread
 
best_codes profile image
Best Codes β€’

Even on the Pi 3, I can already run Gemma 3 with Ollama. I bet it's really fast on the Pi 5.
Also, I did some research, and it looks like there is a GPU on the Pi 5, but I don't think it's a dedicated one. Apparently you can connect an external one somehow?

Now I want a Pi 5 πŸ˜‚

Thread Thread
 
bretbernhoft profile image
Bret Bernhoft β€’

You can indeed connect an external GPU to the RPi 5. Such as in this YouTube video from Jeff Geerling. It is difficult to imagine what will be possible with the Raspberry Pi 6!

Thread Thread
 
best_codes profile image
Best Codes β€’

Wow, thanks for sharing! You should make a DEV post about Pis, you know so much about them haha. I would read it for sure πŸ™ƒ

Collapse
 
alt_exist profile image
Alternate Existance β€’

eating pi

Collapse
 
best_codes profile image
Best Codes β€’

πŸ˜‚

Collapse
 
adrian_11444490b66513360d profile image
Tnt kaboom β€’

Guess this makes you a pi-grammer

Collapse
 
best_codes profile image
Best Codes β€’

I hope not, pi is irrational

Collapse
 
amtrakguy2 profile image
AmtrakGuy2 β€’

To be, fair the song is pi-rational πŸ˜…

Thread Thread
 
best_codes profile image
Best Codes β€’

Ins-pi-rational πŸ’€

Thread Thread
 
amtrakguy2 profile image
AmtrakGuy2 β€’

God dammit I didn't think anybody would get it πŸ˜‚

Thread Thread
 
best_codes profile image
Best Codes β€’

You really went off on a tangent there.

(I hope you know something about pi, circles, and tangents, or you won't get it)

Thread Thread
 
amtrakguy2 profile image
AmtrakGuy2 β€’

I hate algebra πŸ˜…

Thread Thread
 
best_codes profile image
Best Codes β€’

Aren't tangents trigonometry though 🧐

Thread Thread
 
amtrakguy2 profile image
AmtrakGuy2 β€’

Fun fact: They apply to both trigonometry AND algebra! πŸ€“

Thread Thread
 
best_codes profile image
Best Codes β€’

I think it's most relevant in trig, but okay πŸ€“

Thread Thread
 
amtrakguy2 profile image
AmtrakGuy2 β€’

I actually learned about pi in pre-algebra!

Thread Thread
 
best_codes profile image
Best Codes β€’

I was talking about tangents, not pi. I don't remember when I learned pi, probably before algebra

Thread Thread
 
amtrakguy2 profile image
AmtrakGuy2 β€’

Ahhh yes tangents. I talked about those in geometry

Collapse
 
robbenzo24 profile image
Rob Benzo β€’

I have one thing to say:

o

Let me show you my reasoning:
pi = 3.141592
Leviticus = 3rd book
So look in Leviticus 14:15. Find the 9th word in the verse and get its 2nd letter.

15: And the priest shall take some of the log of oil...

and you get o, so thats what i have to say.


just kidding, great post as always :P

Collapse
 
best_codes profile image
Best Codes β€’

You had me confused for a second 🀣
Glad you enjoyed it!

Collapse
 
robbenzo24 profile image
Rob Benzo β€’

lol

Collapse
 
pengeszikra profile image
Peter Vivo β€’

Thx for a music experiment of Ο€!

My music about PI is based on a small sci-fi theory: Based on a series of 42 marker distances in Ο€ lead a groundbreaking theoretical exploration.
There is a song about this theory:

Collapse
 
best_codes profile image
Best Codes β€’

Interesting.
Happy late Ο€ day! πŸ˜€

Collapse
 
alt_exist profile image
Alternate Existance β€’

the pi-ano is cool haha :)

Collapse
 
best_codes profile image
Best Codes β€’

Glad you liked it πŸ€“

Collapse
 
mileswk profile image
MilesWK β€’

Awesome! I love this!

Collapse
 
best_codes profile image
Best Codes β€’

Thank you for reading, glad you enjoyed it! πŸ™Œ

Collapse
 
amtrakguy2 profile image
AmtrakGuy2 β€’

Broooooo the title of the posttttttttttt πŸ’€

Collapse
 
best_codes profile image
Best Codes β€’

πŸ˜†
Thanks for reading

Collapse
 
shricodev profile image
Shrijal Acharya β€’

This is cool, buddy. Love it. πŸ”₯

Collapse
 
best_codes profile image
Best Codes β€’ β€’ Edited

Thank you! Happy Ο€ day ❀️

Collapse
 
inshot_pro profile image
inshot video editor β€’

what can be starting price of pi on binanace

Collapse
 
best_codes profile image
Best Codes β€’ β€’ Edited

I have no clue what this means. ChatGPT says it's a trading network? 🀷

Some comments may only be visible to logged-in visitors. Sign in to view all comments.

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

πŸ‘₯ Ideal for solo developers, teams, and cross-company projects

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay