Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Turing Piano Program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ashkie




PostPosted: Wed Jun 08, 2011 8:15 pm   Post subject: Turing Piano Program

What is it you are trying to achieve?
What I am trying to do is make a one octave piano from a lower c to an upper c.


What is the problem you are having?
Once you get to the notes where you need to increase an octave (2a>, etc.) and you try pressing a lower octave key again, the lower octave key is in a higher octave than it previously was. I want this to stop, as I want the program to simulate a real piano.




Turing:


var chars: array char of boolean
            loop
                     Input.KeyDown (chars)
   
    if chars ('a') then
         Music.Play ( "2c" )
    end if
    if chars ('d') then
        Music.Play ( "2d" )
       end if
    if chars ('f') then
        Music.Play ( "2e" )
      end if
    if chars ('h') then
        Music.Play ( "2f" )
        end if
      if chars ('j') then
         Music.Play ( "2g" )
    end if
    if chars ('k') then
        Music.Play ( "><2a" )
       end if
    if chars ('l') then
        Music.Play ( "><2b" )
      end if
    if chars (';') then
        Music.Play ( ">2c" )
    end if
      if chars ('w') then
        Music.Play ( "2c+" )
        end if
      if chars ('r') then
         Music.Play ( "2d+" )
    end if
    if chars ('u') then
        Music.Play ( "2f+" )
       end if
    if chars ('i') then
        Music.Play ( "2g+" )
      end if
    if chars ('o') then
        Music.Play ( "2a+" )
        end if
    end loop





Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Wed Jun 08, 2011 8:26 pm   Post subject: RE:Turing Piano Program

You'll probably need a variable to keep track of which octave you're at. If you want a low-C, and you're currently at a high octave, reduce the octave, then play the note. If you're at a low octave and want a high-C, increase the octave and play the note.

The important bit is storing which octave you're at.
klutzedufus




PostPosted: Sat Jul 02, 2011 5:13 pm   Post subject: Re: Turing Piano Program

if chars (';') then
Music.Play ( ">2c" )
end if

The problem with this is that it's raising the octave, and not lowering it again after. I had a similar problem when I was trying to make a song playing program. It should look like:

if chars (';') then
Music.Play ( ">2c<" )
end if
Raknarg




PostPosted: Mon Jul 04, 2011 10:36 am   Post subject: RE:Turing Piano Program

if you want to simplify it, you could have it play an mp3 for the notes instead.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: