Guitar string code in Python? [closed] - python

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm very new at Python but really interested in making a code that could simulate guitar strings. How would I go about doing this? Or at least how would I begin to do this? Any help is appreciated!
Thank you!
EDIT:
I would like to see the sound waves when playing different strings, notes, etc.
I am also interested in the sound waves when two different strings are being played, and how that changes when they are dissonant and consonant notes.
Another thing I'm interested in is how sometimes strings vibrate when they are not being plucked (resonance).
Any help is appreciated, thank you!!!

This is really a question of sound synthesis, and there's no simple answer. There are a whole bunch of possible approaches--it's an entire field of study. Physical Audio Signal Processing by J.O. Smith is a good starting point, as is The Theory and Technique of Electronic Music by Miller Puckette. For guitar, you might particularly be interested in the Karpus-Strong method. Perhaps you should search for a Python implementation of it. It's a common project for students in music technology programs; I'm sure there are many.

Related

Designing a game advice [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to design a game which is similar to Plague Inc. and it is essentially where there is a deadly virus (quite ironic) which is spreading and the aim of the game is to stop the virus from spreading.
I've split the world into 13 regions, and each region will have several key details I will need to use, such as the number of cases, the number of deaths and the population. With each of these details, I will want some of them to be dynamic, such as wanting the amount of cases and deaths to go up or down.
I'm extremely new to python, and was hoping for some particular expertise in how to design this game. Any guidance of the best ways to represent this data would be much appreciated!
Hello Aran Khalastchi,
Based off of my experiences, Python is not really a graphical programming language, and more of a text based language. I wouldn't suggest Python as your go to unless you are using a library for graphics. If not, I definitely recommend Unity or Godot, and if you want to go fully raw code (no engines/libraries) I recommend Java as it has its own graphics. If I am wrong, please forgive me :)

Can dividing code too much make it inefficient? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
If code is divided into too many segments, can this make the program slow?
For example - Creating a separate file for just a single function.
In my case, I'm using Python, and suppose there are two functions that I need in the main.py file. If I placed them in different files (just containing the function).
(Suppose) Also, If I'm using the same library for the two functions and I've divided the functions into separate files.
How can this affect efficiency? (Machine performance-wise and Team-wise).
It depends on the language, the framework you use etc. However, dividing the code too much can make it unreadable, which is (most of the time) the bigger problem. Since most of the time you will (or should) be working in a team, you should consider how readable your code would be for them.
However, answering this in a definite way is difficult. You should ask a Senior developer on your team for guidelines.

Why is list comprehension so prevalent in python? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
Often you see question asked about a better method of doing something, or just generally a looping question and very often the top answers will use some form of convoluted list/dict/tuple comprehension that takes longer for others to understand than create themselves. While a simple and understandable loop could have just been made.
Since it cannot provide any speed benefits that I could imagine, is there any use of it in python other than to look smart or be Pythonic?
Thanks.
I believe the goal in this case to make your code as concise and efficient as possible. At times it can seem convoluted, but the computer looping through multiple lines as opposed to a single line adds processing time, which in large applications and across many iterations can cause some delays.
Additionally, although it seems harder to understand initially, for an outside individual reading your code, it's much quicker for them to read simplified expressions than pages of loops to get an idea of what you're attempting to accomplish.

Array vs object - what's faster in Python [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am wondering what I should do for the purpose of my project.
I am gonna operate on about 100 000 rows, every time.
what I wanted to do is to create an object "{}" and then, if I need to search for a value, just call it , for example
data['2018']['09']['Marketing']['AccountName']
the second option is to pull everyting into an array "[]" and in case I need to pull value, I will create a function to go through the array and sum numbers for specific parameters.
But don't know which method is faster.
Will be thankful if you can shed some light on this
Thanks in advance,
If performance (speed) is an issue, Python might not be the ideal choice...
Otherwise:
Might I suggest the use of a proper database, such as SQLLite (which comes shipped with Python).
And maybe SQLAlchemy as an abstraction layer. (https://docs.sqlalchemy.org/en/latest/orm/tutorial.html)
After all, they were made exactly for this kind of tasks.
If that seems overkill: Have a look at Pandas.

What do I lose if I move from R to Python? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am intermediate in R and a beginner in Python. However my core abilities lie less in data analysis and more in programming and developing large software systems in teams, and I don't have time to become an expert in both.
Given the advances in the Python world in numpy, scipy, pandas, and its prevalence in data science and in general programming, I think I need to concentrate on Python (even though I enjoy R a lot), and accept that for some tasks I might be 75% as efficient, say, as I would be in R. I'd find this efficiency loss acceptable in order to be a master of one language rather than intermediate at both.
However I don't know enough about either language to really be sure of my facts. I would be very interested in hearing from anyone who is experienced in both R and Python and can say what would be the significant disadvantages, if any, of dropping R in favour of Python?
Edit 5: this question on stats.stackexchange is similar and has some great answers.
(Edits 3-4: reverted content/title to original question, which was closed. The original question attracted a lot of expert comment, my attempt to narrow the question to reopen it failed, and I'd prefer to have these comments below the original text they were commenting on.)

Categories