473,387 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Re: Music knowledge representation

On Mon, 29 Sep 2008 20:29:44 +0200
"Mr.SpOOn" <mr********@gmail.comwrote:
Couldn't the note class simply have a list of all the notes and have a
simple method calculate the actual pitch?

That's not really how it works. There exists just 12 octave
independent pitch classes. This means that there is a pitch class C
with all possible Cs. There ambiguities with accidentals, because
different named notes fall in the same pitch class. The difference is
important for the musical theory, because C# and Db belongs to the
same pitch class (actually they are the same note, they sounds
completely identical -- because on the piano you play them pressing
the same key), but in a scale they have a very different role.
Sure, they are enharmonically identical but in our tempered scale.
That's why my example showed it as (note, octave, accidental) rather
than a specific note. It would differentiate between these.
For example, the interval C F# is an "augmented fourth", because what
really matters are the natural note (C and F), and their distance if
4. Then it is augmented due to the #-

But the interval C Gb (Gb is the same as F#) is a "diminished fifth".
This is true. My simple example would not have dealt with this. The
arguments would have to be the full tuple rather than the actual pitch.
So I can't list all pitches.
You can but you can't store them as raw pitches.
def interval(self, lower, higher)
if lower higher:
# uncomment one of the two following lines depending
# on the behaviour you want
#lower,higher = higher,lower
#higher += 12

# could use some error trapping
return self.interval_name[higher - lower]

Note that lower and higher could be a note object that you have to
convert to integers first.

I can't estabilish which note is higher, because all the analysis part
is octave independent. Anyway thanks for the ideas.
I'm not sure I understand this. You either have to assume that the
first note is the root or the lower one is. What other options are
there? It sounds like your requirement is "higher += 12" or some
variant. It also depends on whether you need to deal with things like
ninths and thirteenths.

Anyway, I was just tossing out ideas. You know what your requirements
are better than I.

--
D'Arcy J.M. Cain <da***@druid.net | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
Sep 29 '08 #1
1 1562
On Sep 29, 3:56*pm, "D'Arcy J.M. Cain" <da...@druid.netwrote:
On Mon, 29 Sep 2008 20:29:44 +0200

"Mr.SpOOn" <mr.spoo...@gmail.comwrote:
Couldn't the note class simply have a list of all the notes and have a
simple method calculate the actual pitch?
That's not really how it works. There exists just 12 octave
independent pitch classes. This means that there is a pitch class C
with all possible Cs. There ambiguities with accidentals, because
different named notes fall in the same pitch class. The difference is
important for the musical theory, because C# and Db belongs to the
same pitch class (actually they are the same note, they sounds
completely identical -- because on the piano you play them pressing
the same key), but in a scale they have a very different role.

Sure, they are enharmonically identical but in our tempered scale.
That's why my example showed it as (note, octave, accidental) rather
than a specific note. *It would differentiate between these.
For example, the interval C F# is an "augmented fourth", because what
really matters are the natural note (C and F), and their distance if
4. Then it is augmented due to the #-
But the interval C Gb (Gb is the same as F#) is a "diminished fifth".

This is true. *My simple example would not have dealt with this. *The
arguments would have to be the full tuple rather than the actual pitch.
So I can't list all pitches.

You can but you can't store them as raw pitches.
* *def interval(self, lower, higher)
* * * *if lower higher:
* * * * * *# uncomment one of the two following lines depending
* * * * * *# on the behaviour you want
* * * * * *#lower,higher = higher,lower
* * * * * *#higher += 12
* * * *# could use some error trapping
* * * *return self.interval_name[higher - lower]
Note that lower and higher could be a note object that you have to
convert to integers first.
I can't estabilish which note is higher, because all the analysis part
is octave independent. Anyway thanks for the ideas.

I'm not sure I understand this. *You either have to assume that the
first note is the root or the lower one is. *What other options are
there? *It sounds like your requirement is "higher += 12" or some
variant. *It also depends on whether you need to deal with things like
ninths and thirteenths.

Anyway, I was just tossing out ideas. *You know what your requirements
are better than I.

--
D'Arcy J.M. Cain <da...@druid.net* * * * | *Democracy is three wolveshttp://www.druid.net/darcy/* * * * * * * *| *and a sheep voting on
+1 416 425 1212 * * (DoD#0082) * *(eNTP) * | *what's for dinner.
I like D'Arcy's tuples so far. You could have a 4th element that
contains adjustment for temper. Octave could be None.

You want ( 4, None, 1 ) "sharp 4th" == ( 5, None, -1 ) "flat 5th", but
you can't have it. The closest ones are Note( 4, None, 1 )== Note( 5,
None, -1 ) or Note(4, None, 1 ).enh_cmp( Note( 5, None, -1 ) ). More
elaborate code means more options for calling, though: Note(4, None,
1 ).cmp_enh( 5, None, -1 ), and just call the constructor on the 3
arguments. You also want Note( 9, None, 0 ).cmp_octave( 2, Rel+ 1,
0 ), 9th== 2nd + 1 octave, and Note( 9, None, 0 ).cmp_nooctave( 2,
None, 0 ), where cmp_... functions return in ( -1, 0, 1 ), and the
middle term can be a class Relative instance, which indicates a
relative octave instead of absolute... or just start at 4.
Sep 29 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
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",...
20
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...
2
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...
2
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...
4
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...
2
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...
14
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...
2
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...
4
by: Mr.SpOOn | last post by:
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....
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
1
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...
0
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...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.