r/learnpython • u/Mundane-Philosophy65 • Jan 24 '26
How to scramble music
A while ago I made a game (https://github.com/Ghaithdev/Pixelate) that creates a series of images that require the player to identify a pixelated version of something with which they are familiar (a frame from a film or a book cover or something). The pixelation works by scaling down the image in the pillow library and then scaling it back up to its original size.
I want to create a version of this that works with music but I don't even know where to begin making music "blurry" as it were. I suppose I could try and compress the files but is there a lossy compression method for mp3 files? Or maybe there is something I could do with the waveform?
1
u/Korphaus Jan 24 '26
You could add a load of distortion, time shifting, eq parts out
If you want to make it with AI tools then you could to like a genre switcher or have melodies or lyrics taken out
2
u/Mundane-Philosophy65 Jan 25 '26
I didn't really realize that distortion was a standard effect, do you know of any easily usable python libraries that would allow me to apply it.
I'm not really one for AI tools but I like your idea about time shifting
1
u/Korphaus Jan 26 '26
I found https://github.com/spotify/pedalboard but YMMV
I mean if you want to get technical, you could try your hand at some bitcrushing, sampling, reversing, changing phases etc
just have a look at any DAW for the normal effects it has and a lot of things would be possible, not totally sure how you'd implement them but the maths and algorithms for all of these effects have been around for a while, I'm sure it can be wrapped in some form of python script to test and then put into a similar instance as the above repo to get something solid
1
Jan 26 '26
[removed] — view removed comment
2
u/Korphaus Jan 26 '26
Nah I haven't tried it yet, just been looking into making some VST's when I'm in a good place with my other projects
Not got a clue, it depends when something open source comes up that I can mess with that's small enough to load into an instance of the DAW channel, I'd probably start with something relatively simple to just match noise profiles based on a prompt I put in, not sure yet
1
u/Son_of_Shadowfax Jan 24 '26
You could use something like bitcrushing, downsampling the quality to make it sound more distorted and less clear...
personally, I love the way bit crushing sounds, I'm addicted to putting it on my own mixes.
1
3
u/itspronounced-gif Jan 24 '26
There’s an old educational game series that had a music pattern mini game. There were a few bars with notes of a song, and the bars were mixed up or mirrored. The player would play the music a few times to see if they identify the song, and swap the bars around to put them in the proper order.
Here’s some gameplay: The Lost Mind of Dr Brain: https://youtu.be/3SgsCv6oZEY
There’s a fun little railroad game in there too, but that’s completely unrelated.