473,471 Members | 4,625 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1565
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: 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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.