Hi,
I'm working on an application to analyse music (melodies, chord sequences etc.)
I need classes to represent different musical entities. I'm using a
class Note to represent all the notes. Inside it stores the name of
the natural version of the note (C, D, E, F...) and an integer to
calculate the accidentals.
Then I have a class Pitch, to represent the different 12 pitch
classes, because different notes, such as C# and Db, belong to the
same pitch class.
In these classes I also have some arithmetic method to perform
additions or subtractions between pitches and integers.
I also need to represent intervals between notes. An interval must
have a degree (first, second, third), that may be represented with a
simple integer and a size counted in semitones. Then, with these
informations it can retrieve its name, for example: perfect fifth.
The degree is calculated between natural notes. So the degree of
Interval(C, E) is "third", or 3. This may be simple, if I put the
notes in an ordered sequence. But, when I have to calculate, for
example Interval(E, C). It should count till the end of the sequence,
so if I have:
C D E F G A B
after the B it should continue with C. I'm not sure how to implement
this. Is there a suitable data structure for this purpose? 4 938
On Sep 28, 9:37*am, Mr.SpOOn <mr.spoo...@gmail.comwrote:
Hi,
I'm working on an application to analyse music (melodies, chord sequencesetc.)
I need classes to represent different musical entities. I'm using a
class Note to represent all the notes. Inside it stores the name of
the natural version of the note (C, D, E, F...) and an integer to
calculate the accidentals.
Then I have a class Pitch, to represent the different 12 pitch
classes, because different notes, such as C# and Db, belong to the
same pitch class.
In these classes I also have some arithmetic method to perform
additions or subtractions between pitches and integers.
I also need to represent intervals between notes. An interval must
have a degree (first, second, third), that may be represented with a
simple integer and a size counted in semitones. Then, with these
informations it can retrieve its name, for example: perfect fifth.
The degree is calculated between natural notes. So the degree of
Interval(C, E) is "third", or 3. This may be simple, if I put the
notes in an ordered sequence. But, when I have to calculate, for
example Interval(E, C). It should count till the end of the sequence,
so if I have:
C D E F G A B
after the B it should continue with C. I'm not sure how to implement
this. Is there a suitable data structure for this purpose?
Hi,
Here is a link to someone else's design they asked about on the
newsgroup a couple weeks ago. http://groups.google.com/group/comp....1cba3084b984dc
On Sun, Sep 28, 2008 at 8:59 PM, Aaron Castironpi Brady
<ca********@gmail.comwrote:
Here is a link to someone else's design they asked about on the
newsgroup a couple weeks ago.
http://groups.google.com/group/comp....1cba3084b984dc
:D
It's always me.
I think my question is more specific. I need some sort of cycle.
So if I have a list with A, B, C, D, when I iter over it I need to get
an A after the D.
"Mr.SpOOn" <mr********@gmail.comwrote in message
news:ma**************************************@pyth on.org...
On Sun, Sep 28, 2008 at 8:59 PM, Aaron Castironpi Brady
<ca********@gmail.comwrote:
>Here is a link to someone else's design they asked about on the newsgroup a couple weeks ago.
http://groups.google.com/group/comp....1cba3084b984dc
:D
It's always me.
I think my question is more specific. I need some sort of cycle.
So if I have a list with A, B, C, D, when I iter over it I need to get
an A after the D.
Check out itertools.cycle:
>>x=itertools.cycle('ABCDEFG') x.next()
'A'
>>x.next()
'B'
>>x.next()
'C'
>>x.next()
'D'
>>x.next()
'E'
>>x.next()
'F'
>>x.next()
'G'
>>x.next()
'A'
>>x.next()
'B'
-Mark
On Sep 28, 2:08*pm, Mr.SpOOn <mr.spoo...@gmail.comwrote:
On Sun, Sep 28, 2008 at 8:59 PM, Aaron Castironpi Brady
<castiro...@gmail.comwrote:
Here is a link to someone else's design they asked about on the
newsgroup a couple weeks ago.
http://groups.google.com/group/comp....thread/thread/...
:D
It's always me.
I think my question is more specific. I need some sort of cycle.
So if I have a list with A, B, C, D, when I iter over it I need to get
an A after the D.
This one was an easy guess:
cycle( iterable)
Make an iterator returning elements from the iterable and saving a
copy of each. When the iterable is exhausted, return elements from the
saved copy. Repeats indefinitely. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Marian Aldenhövel |
last post by:
Hi,
I am trying to make pygame play music on windows. This simple program:
import pygame,time
pygame.init()
print "Mixer settings", pygame.mixer.get_init()
print "Mixer channels",...
|
by: gallery |
last post by:
Our client insists on having a music loop playing as the visitor travels
throughout his new HTML website.
We will not be doing this in frames and I would prefer not to have the home
page spawn...
|
by: Blue Streak |
last post by:
Hello,
I am trying to develop an interface to view an internal knowledge base. One feature I would like to add is a "Generate E-Mail" button which would automatically open an e-mail message a...
|
by: Just Me |
last post by:
If I use the
shell32q.NameSpace(k)
and the Parent property I can develop, for example, the path to My Music.
Actually it ends with Desktop but Desktop can also be traced by using Parent
to...
|
by: Doug van Vianen |
last post by:
Hi,
I am using Visual Basic 6 to generate web pages that can be used by the
members of our seniors' computer club to create e-cards that include their
own pictures. I wish to include background...
|
by: virtualadepts |
last post by:
Convert WAV To BMP And Back
On RentaCoder one of the other coders thought I just wanted him to
change the extension from WAV to BMP. Another coder brought up the
complexities of actually...
|
by: gnarl |
last post by:
Hello all,
I'm developing a site in PHP4 for a music artist, who wants music to
play across all their pages. I have loaded a simple flash applet to
play the music, but every time the visitor to...
|
by: Suresh P |
last post by:
Hi All,
Is there any way other than frames to play music in the background of
the website without restart while navigating to different pages of the
website.
Because, frames will affect the...
|
by: D'Arcy J.M. Cain |
last post by:
On Sun, 28 Sep 2008 16:37:11 +0200
"Mr.SpOOn" <mr.spoon21@gmail.comwrote:
Sounds interesting. Will this be Open Source?
Have you considered having the object take a key option with default...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |