def _draw_background(self):
        # Add background image
        pianoimage = pygame.image.load(util.get_app_path() + "/res/piano.jpg")
        image_width = 1024.0
        image_height = pianoimage.get_height() * (image_width /
                                                  pianoimage.get_width())
        image_width = int(image_width)
        image_height = int(math.floor(image_height))
        pianoimage = pygame.transform.scale(pianoimage,
                                            (image_width, image_height))
        background = pygame.Surface(self.screen.get_size())
        background = background.convert()
        background.blit(pianoimage, (0, 0))
        # Text information to go to background
        if pygame.font:
            self.font = pygame.font.Font(None, 36)
            self.bigfont = pygame.font.Font(None, 64)
            self.smallfont = pygame.font.Font(None, 18)
            title = self.bigfont.render("Air Piano", 1, (0xCA, 0xFF, 0x70))
            by = self.smallfont.render("By: ChopSueyTeam", 1,
                                       (0xCA, 0xFF, 0x70))
            background.blit(
                title, title.get_rect(top=20,
                                      left=512 - title.get_width() / 2))
            background.blit(by, by.get_rect(top=700,
                                            left=1004 - by.get_width()))

        return background
Exemplo n.º 2
0
    def generate_scale(self):
        """
        Given the initial note, middle C, create the rest of the musical scale by
        resampling.
    
        Returns: Dictionary of musical scale with the key being the name of the note
        and the value being the corresponding sound object.
    
        """    
        pygame.mixer.init()
    
        wav = util.get_app_path() + "res/piano-c.wav"
        sound = pygame.mixer.Sound(wav)
        
        pygame.mixer.set_num_channels(32)
        sndarray = pygame.sndarray.array(sound)

        ratio_dict = {'low_c': 1, 'c_sharp': .944, 'd': .891, 'd_sharp':.841, 'e':.794,
                  'f':.749, 'f_sharp': .707, 'g': .667, 'g_sharp': .63, 'a': .594,
                  'a_sharp': .561, 'b':.53, 'high_c':.5}
    
        # Generate the Sound objects from the dictionary.
        scale = {}
        for key,value in ratio_dict.iteritems():
            smp = resample(sndarray, value,"sinc_fastest").astype(sndarray.dtype)
            # Use the key, currently a string, as a variable
            scale[key] = pygame.sndarray.make_sound(smp)
            
        self.scale_dict=scale
Exemplo n.º 3
0
    def generate_scale(self):
        """
        Given the initial note, middle C, create the rest of the musical scale by
        resampling.
    
        Returns: Dictionary of musical scale with the key being the name of the note
        and the value being the corresponding sound object.
    
        """
        pygame.mixer.init()

        wav = util.get_app_path() + "res/piano-c.wav"
        sound = pygame.mixer.Sound(wav)

        pygame.mixer.set_num_channels(32)
        sndarray = pygame.sndarray.array(sound)

        ratio_dict = {
            'low_c': 1,
            'c_sharp': .944,
            'd': .891,
            'd_sharp': .841,
            'e': .794,
            'f': .749,
            'f_sharp': .707,
            'g': .667,
            'g_sharp': .63,
            'a': .594,
            'a_sharp': .561,
            'b': .53,
            'high_c': .5
        }

        # Generate the Sound objects from the dictionary.
        scale = {}
        for key, value in ratio_dict.iteritems():
            smp = resample(sndarray, value,
                           "sinc_fastest").astype(sndarray.dtype)
            # Use the key, currently a string, as a variable
            scale[key] = pygame.sndarray.make_sound(smp)

        self.scale_dict = scale
    def _draw_background(self):
        # Add background image
        pianoimage = pygame.image.load(util.get_app_path() + "/res/piano.jpg")
        image_width = 1024.0
        image_height = pianoimage.get_height()*(image_width/pianoimage.get_width())
        image_width = int(image_width)
        image_height = int(math.floor(image_height))
        pianoimage = pygame.transform.scale(pianoimage,(image_width,image_height))
        background = pygame.Surface(self.screen.get_size())
        background = background.convert()
        background.blit(pianoimage, (0,0))
        # Text information to go to background
        if pygame.font:
            self.font = pygame.font.Font(None, 36)
            self.bigfont = pygame.font.Font(None, 64)
            self.smallfont = pygame.font.Font(None, 18)
            title = self.bigfont.render("Air Piano", 1, (0xCA,0xFF,0x70))
            by = self.smallfont.render("By: ChopSueyTeam", 1, (0xCA,0xFF,0x70))
            background.blit(title, title.get_rect(top=20, left=512-title.get_width()/2))
            background.blit(by, by.get_rect(top=700, left=1004-by.get_width()))

        return background
Exemplo n.º 5
0
APP_DEVELOPER_INFO="SubsCribe at http://www.cliodin.com"
APP_VERSION="1.3.0.0"
#APP_CODENAME="Super User Preview"
APP_WEB="http://bit.ly/14g1cQl"
APP_WEB_LABEL="cliodin.com"
APP_DESCRIPTION="""iMovMan means Instant Movie Manager which manage all movies of your hard drive with movie cover and IMDb information such as rating, genre, actors, directors etc. It'll help a user to search and manage movies efficiently."""
APP_CREDITS="""Credits:<br/> 
 &nbsp;<a href="http://on.fb.me/11XcIOH">Khusbo Rezwan</a> :: Icon Design<br/>""" 
next_year=int(datetime.date.today().strftime("%Y"))+1
APP_COPYRIGHT="copyright (c) 2013-"+str(next_year)+" cliodin.com"
APP_HELP="http://on.fb.me/19zg0wM"
APP_FB="http://on.fb.me/133Euy8"

APP_UPDATE_CHECK="http://bit.ly/16DiWqR"#it is used to check if a new version is available or not

LOG_FILE=os.path.realpath(os.path.join(util.get_app_path(),"applog/iMovMan.log"))

C_DATA_DIR=os.path.realpath(os.path.join(util.get_app_path(),"data"))
C_COVER_PATH=os.path.realpath(os.path.join(util.get_app_path(),"data/data-cover"))
C_DATA_PATH=os.path.realpath(os.path.join(util.get_app_path(),"data/data-cover"))

#C_ACTIVE_THEME=
BUILD_FILE="data/zimmlib/zbuild/build-prop.idat"
C_THEME_PATH="data/zimmlib/web-ui/themes"
C_APPICON_PATH="data/zimmlib/appicon"
C_APPANIM_PATH="data/zimmlib/appanim"
C_APPSPLASH_PATH="data/zimmlib/appsplash"
C_ASSETS_PATH="data/zimmlib/assets"
C_MOVIE_FORMAT=["mp4","mkv","avi","flv","vob","mov","mpg","wmv","m4v"]
C_COVER_FORMAT=["jpg","gif","png","jpeg","bmp"]
C_DEFAULT_THEME="default"