Musical notation question

Status
Not open for further replies.

3v0

Coop Build Coordinator
Forum Supporter
My knowledge of music is limited.

I have been playing with a program that is much like a simple electronic organ. More like a kazoo. Fun stuff.

You can encode a tune by call playNote(duration, note) as needed.

The following plays an octave of full notes

Code:
  playNote(100, C);
  playNote(100, Db);
  playNote(100, D);
  playNote(100, Eb);
  ...
  playNote(100, Bb);
  playNote(100, B);
  playNote(100, C);  // <--- problem here
This notation is limited to one octave. I need to use a musical notation that is not.

I started to google on the subject but there are too many choices.

Does anyone have a suggestion about which notation to use. Simple would be good.
 
That'd depend on the actual library you're using. Where is playNote() defined and what is the code? Is there any documentation?

I'd be tempted to try 'C1' to get C above middle C, if I had no docs/comments to work from.


Torben

[Edit: What is the software you're using? i.e. the code library containing 'playNote()'? Without that info, we can only guess at what the programmer has decided would be a good octave encoding. With the name, we could maybe look it up.]

[Edit 2: Um. I've assumed you're using C. Is this true? If so, what does the .h file look like?]
 
Last edited:
No library. It is a program I am writting. I am not having a problem with the code. I do need some guidance on what the musical notation to pick.


FWIW:
This is not finished or polished code.
playNote is a big switch statement that calls aNote which is

Code:
void aNote(int duration,  
            long period)  // half the actual period of the note
{
  int i; 
  unsigned long _duration = tempo * duration;
  
  OpenTimer0( TIMER_INT_OFF &  T0_16BIT &  T0_SOURCE_INT & T0_PS_1_256 );
  WriteTimer0(0);
  
  while (((unsigned long) ReadTimer0()) < _duration )
  {       
            LATCbits.LATC3 = 0;
          delay_us(period); 
          LATCbits.LATC3 = 1;
          delay_us(period);
  }  

  CloseTimer0();
}
 
Exactly what I was looking for.

THANKS.

There was so much stuff to wade through that I could have been at it for hours.
 
No problem. I realized I'm rusty at music notation and also found this: **broken link removed**

May be a bit more succinct. Anyway, sounds like a cool project.


Torben
 
You might also try looking at

which is written in C for you, and plays mobile phone RTTTL ringtones.
 
I intend to use the code as an early programming example. Need to keep it simple.

The ringtone code is interesting.

I have enough information.

Thanks everyone.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…