DEV Community

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

Posted on

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!

Top comments (47)

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
BestCodes β€’

🀣

Collapse
Β 
best_codes profile image
BestCodes β€’

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
BestCodes β€’

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
BestCodes β€’

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
BestCodes β€’

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
BestCodes β€’

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
BestCodes β€’

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
BestCodes β€’

πŸ˜‚

Collapse
Β 
adrian_11444490b66513360d profile image
Tnt kaboom β€’

Guess this makes you a pi-grammer

Collapse
Β 
best_codes profile image
BestCodes β€’

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
BestCodes β€’

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
BestCodes β€’

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
BestCodes β€’

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
BestCodes β€’

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
BestCodes β€’

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

Thread Thread
Β 
amtrakguy2 profile image
AmtrakGuy2 β€’

We really went full circumference there! (I know I know I am terrible πŸ˜‚)

Thread Thread
Β 
best_codes profile image
BestCodes β€’

πŸ€¦πŸ™„

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
BestCodes β€’

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
BestCodes β€’

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

Collapse
Β 
alt_exist profile image
Alternate Existance β€’

the pi-ano is cool haha :)

Collapse
Β 
best_codes profile image
BestCodes β€’

Glad you liked it πŸ€“

Collapse
Β 
amtrakguy2 profile image
AmtrakGuy2 β€’

Broooooo the title of the posttttttttttt πŸ’€

Collapse
Β 
best_codes profile image
BestCodes β€’

πŸ˜†
Thanks for reading

Collapse
Β 
shricodev profile image
Shrijal Acharya β€’

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

Collapse
Β 
best_codes profile image
BestCodes β€’ β€’ Edited

Thank you! Happy Ο€ day ❀️

Collapse
Β 
mileswk profile image
MilesWK β€’

Awesome! I love this!

Collapse
Β 
best_codes profile image
BestCodes β€’

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

Collapse
Β 
sara_knt_codes555 profile image
sara β€’

best website for my math teacher XD i think its her fav XD but good tho i love it as a beginner

Collapse
Β 
best_codes profile image
BestCodes β€’

Thanks for reading, glad you liked it πŸ™Œ

Some comments may only be visible to logged-in visitors. Sign in to view all comments. Some comments have been hidden by the post's author - find out more