Share your repls and programming experiences

← Back to all posts
Getting a sound... From an image.
h
eekboi (278)

Make sure to read the full post before pointing out errors please.

Hey! I've made this trash for you all to enjoy. This was made using @minx28's circle API. Make sure to change the seed in main.py! This repl is a dummy for a concept of mine that I call "Wide coding". This concept is basically a way of keeping your code as bloated as possible just for the effect, hence why I have like 12 files. If you have any questions/problems go ahead and ask me in the comments!
Some things you have to do to get this piece of crap working right are first, running the repl for a second time. And then deleting the contents of mathpy.py every second time you've ran the repl. Sorry I couldn't make it simpler, just the way it works.
We now have 445/1000 lines of code!
EDIT: Due to multiple people pointing out an issue which I had underestimated (looking at you @ZDev1, @CodingCactus, @abaanasim98, @JosephSanthosh, and @EthanCulp) I've decided to make a fix, courtesy of CodingCactus. You'll see changes in my repl about now.

Commentshotnewtop
minx28 (351)

@amasad ikr, it's cool! Have you seen my Circles API, which is where the images are coming from? Docs here and example images here (refresh the page for more examples)
Edit: repl talk post also lol

eekboi (278)

@amasad Never thought I'd ever hear that from ya. But here we are. Thank ya :D

eekboi (278)

@minx28 What a plug. Just kidding, you deserve it.

abaanasim98 (4)

Traceback (most recent call last):
File "main.py", line 4, in <module>
import mathpy
File "/home/runner/j3s66foqpe/mathpy.py", line 2
ggg = 132 + 190 + 63 + 133 + 189 + 64 + 135 + 188 + 65 +
^
SyntaxError: invalid syntax
This is what i am getting

eekboi (278)

@abaanasim98

Once you run the repl, you need to go into mathpy.py, go to the line that is declaring the variable ggg and go to the end of that line, and delete the extra + because I'm too lazy to find a fix for that.

Please read the post before ya point out any errors. Have a nice day!

eekboi (278)

@ZDev1 Like I said multiple times, please read the post for clarification on how to not get the error.

eekboi (278)

@ZDev1 I hope this new fix works for ya!

CodingPseudonym (40)

AHHHHHH MY EARSSSSS!!! I WAS WEARING HEADPHONES!!! NOOOOOOOOOOOOOOO

eekboi (278)

@CodingPseudonym Nooooooo. Are your ears alright?

CodingPseudonym (40)

@eekboi Yes they are fine. But I wasn't expecting that to come from the program.

LarryChenDaBest (0)

MY EARS STING LIKE ANTS

Leroy01010 (203)

myyyyyy eeeeeeaaaarrrrrssss

sugarfi (521)

This concept is basically a way of keeping your code as bloated as possible just for the effect

Have you heard of code bowling? It's a similar concept, where players compete to write the largest program to do a task.

eekboi (278)

@sugarfi I've heard of the term before, never really cared enough to research it though. I'll check it out! (Also fixed some markdown for ya)

promike (17)

why don't your thing work??

eekboi (278)

@promike It does work. Ya just have to use it in the right way :P

minx28 (351)

I might try make a version of this - how have you converted the image into sound? What I'm thinking of doing is selecting a handful of points across the image, making a bezier curve out of them, then for each point along that curve, turning the RGB into a linear value and playing a pitch associated with that.

eekboi (278)

@minx28 What I've done was take the pixels, turn them into an RGB value. Then I used the re module to remove the characters from the output of that. Next I added the result of the filter into a number, which happens to be a frequency of the noise that is played.

eekboi (278)

@minx28 And to address

You can remove the post and premodifiers.

It's fun to jack the postmodifiers all the way up and hear the sound go "EEEEEEEEEEEEEEEEEEE". :D

minx28 (351)

Looks pretty noice, however-
1. If you want a default image you should remove premodifiers and postmodifiers completely from the API request
2. You don't need to save the image then reopen it. Just replace the img on line 25 with im, and delete lines 27 and 31. Unless, of course, you want to see the image you were working with - in which case, leave line 27, but you still don't need line 31.

CodingCactus (3069)

congrations!!! btw what is the reason you have that extra + to make an error?

[deleted]

now make it convert back! :)

EthanCulp (29)

Im getting this error:
Traceback (most recent call last):
File "main.py", line 4, in <module>
import mathpy
File "/home/runner/n6xz039xqr/mathpy.py", line 2
ggg = 132 + 190 + 63 + 133 + 189 + 64 + 135 + 188 + 65 +
Also, I recommend, making a copy of the repl so that you can edit it without it changing on the posted repl.

eekboi (278)

@EthanCulp Like I said in the post.

Once you run the repl, you need to go into mathpy.py, go to the line that is declaring the variable ggg and go to the end of that line, and delete the extra + because I'm too lazy to find a fix for that.

Also yes I have done so :).

HahaYes (1190)

Yay eekboi is now famous

DynamicSquid (3298)

Hey! I've made this trash for you all to enjoy.

this isn't trash what are you talking about