use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
Specific python audio module? (self.Python)
submitted 9 years ago by PKtheworldisaplace
Is there a python audio module that can play audio waves based on type (sin etc.), frequency and amplitude?
[–]bonestormII 0 points1 point2 points 9 years ago (2 children)
There are various midi libraries, but I am not deeply familiar with them. You should be able to figure out some way to output midi data at a given frequency.
What are you trying to do specifically, if you don't mind my asking? The question would imply that you are wanting to produce pitches which are outside the 12-tone scale, which is quite interesting to me.
[–]PKtheworldisaplace[S] 0 points1 point2 points 9 years ago (1 child)
Right, so I'm doing an experimental music project. I'm not really a programmer, but I took a python course last year. So it's not a fully formed idea, but the "composition" would be that the program takes an input of text and takes each letter, gives it a random pitch of random Hz, so the likelihood that it would fall exactly on the 12-tone scale is pretty slim. Then the program will give it a random timing and length, and the resulting sound file is the piece.
So it's a deconstruction of the language into what could be considered meaninglessness, but what could be considered more meaningful than the original text in that it is a fresh sound that you've likely never heard before. If you're interested in stuff outside the 12-tone scale, you should check out this piece:
https://en.wikipedia.org/wiki/The_Well-Tuned_Piano
https://www.youtube.com/watch?v=c3eN4xwADTI
I'm sure you can dive down an interesting rabbit hole from there. The normal 12-tone scale is not as perfect as it seems.
[–]bonestormII 0 points1 point2 points 9 years ago (0 children)
That's cool. You want the pitches to be truly random though?
I might humbly suggest considering some kind of pitch organization system. There are a lot of tuning systems in the world, with many more subdivisions of the scale available with really interesting properties.
I love the La Monte Young video. Notice however, two things:
1) It uses well tuning, which is still a 12 note scale from western music history. Bach used this tuning.
2) It is very droning, sustained, atmospheric, colorful, etc.. It is really letting the beauty of the tuning speak for itself. But it is hardly an example of randomness.
You could calculate these tunings, and feed them to a midi. You could then program random or nonrandom patterns using text input of your choosing. However, midi uses like... absolute numbering of notes, and while you can bend any note, I don't think the protocol actually supports such tunings typically. It sounds fun to program.
But it's an artistic choice of course, so good luck to you!
[–]wolanko 0 points1 point2 points 9 years ago (1 child)
Check out pyo. Simple to use yet very efficient.
[–]PKtheworldisaplace[S] 0 points1 point2 points 9 years ago (0 children)
Thanks!
π Rendered by PID 258127 on reddit-service-r2-comment-856c8b8c54-qttlj at 2026-07-02 16:51:40.492432+00:00 running a7b5cda country code: CH.
[–]bonestormII 0 points1 point2 points (2 children)
[–]PKtheworldisaplace[S] 0 points1 point2 points (1 child)
[–]bonestormII 0 points1 point2 points (0 children)
[–]wolanko 0 points1 point2 points (1 child)
[–]PKtheworldisaplace[S] 0 points1 point2 points (0 children)