Shop OBEX P1 Docs P2 Docs Learn Events
"coding even temperament" — Parallax Forums

"coding even temperament"

zachzach Posts: 6
edited 2010-01-17 06:17 in BASIC Stamp
I am working on a project I am calling a Digital Trombone.

Adjusting a pot scales from 1 - 36 so I can select notes across 3 octaves.
As I scan through the notes, they appear on a 7 seg. display.
The different octaves are displayed through 3 LEDs

Everything is coded except for telling the buzzer to play the specific note.

I was wanting to select the frequency of the note purely by its index of 1-36.
Pg. 228 of What is a Microcontroller tells of even temperament
which is a referenceNote multiplied by 2 * (Index/12)

That last bit is where I am having trouble.
How do I store a decimal value calculated by PBasic?

I understand I can use lookup and store 36 Words, but I was looking for an alternative.
My goal was to reference everything by the Index of 1 - 36.

Post Edited (zach) : 1/16/2010 9:54:46 PM GMT

Comments

  • Tracy AllenTracy Allen Posts: 6,662
    edited 2010-01-17 01:01
    I'm not sure exactly what you're looking for, but here is a description of how to compute the notes of the scale on the fly in PBASIC. It seems for your purpose you just need to store the 36 frequencies in a DATA table or lookup statement, where the index can select them one at a time.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-01-17 03:52
    It may be just as easy to store only the twelve frequencies of the top octave, since those of successively lower octaves will be half of the octave above it. These are easy enough to compute by shifting.

    -Phil
  • zachzach Posts: 6
    edited 2010-01-17 06:17
    That is doable, thanks for the help!
Sign In or Register to comment.