• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python music.Music类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中music.Music的典型用法代码示例。如果您正苦于以下问题:Python Music类的具体用法?Python Music怎么用?Python Music使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Music类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: run

	def run(self):
		self._screen().blit(self._background(), (0, 0))
		pygame.display.flip()
		clock = pygame.time.Clock()
		music = Music()
		music.play()
		while 1:
			clock.tick()
			
			self._draw_background()
			self._draw_monsters()
			self._draw_hero()
			self._draw_coins()
			self._draw_hud()
			
			pygame.display.flip()
			
			
			for event in pygame.event.get():
				if event.type == QUIT:
					return
				elif event.type == KEYDOWN and event.key == K_ESCAPE:
					return
				elif event.type == KEYDOWN:
					self.hero().handle_keydown(event.key)
				elif event.type == KEYUP:
					self.hero().handle_keyup(event.key)
开发者ID:chamblin,项目名称:coin_runner,代码行数:27,代码来源:game.py


示例2: main

def main():
    dt = DumplingTown()
    music = Music()
    music.animalCrossingDay()
    #music.pause()
    #music.pause()
    music.play()
开发者ID:ahh2131,项目名称:DumplingTown,代码行数:7,代码来源:main.py


示例3: __start

    def __start(self):
        music_helper = MusicHelper()

        while self._file_name_list:
            file_path = self._file_name_list.pop()
            music_tag = music_helper.get_music_tag(file_path)
            music_info = Music()
            music_info.file_path = file_path
            if music_tag == {}:
                logger.info("Music tag can't be got: " + music_info.file_path)
            else:
                music_info.music_tag = music_tag
                self._music_tag_queue.put(music_info)
开发者ID:littleneko,项目名称:iCover,代码行数:13,代码来源:icover_thread.py


示例4: __init__

    def __init__(self):
        self.window_manager = WindowManager()
        self.events = Queue()
        self.panel = Panel()
        self.clock = Clock()
        self.notification_monitor = NotificationMonitor()

        try:
            with open(os.path.expanduser('~/.config/mpd/credentials.conf'), 'r') as f:
                mpd_settings = json.load(f)
        except FileNotFoundError:
            self.music = Music()
        else:
            self.music = Music(**mpd_settings)
        self.music_controller = self.music.clone()

        self.system_info = SystemInfo()
开发者ID:DexterLB,项目名称:ui,代码行数:17,代码来源:info.py


示例5: __init__

	def __init__(self, sound="None", soundout="pulse"):
		self.music = Music(sound, soundout)
		sleep(0.25)
		self.screen = curses.initscr()
		self.screen.clear()
		self.screen.refresh()
		self.music.start()
		self.mapstr = "map{}.txt"
		curses.noecho()
		self.game = Game(self, 0)
		self.game.start()
开发者ID:YtvwlD,项目名称:LokoPizza,代码行数:11,代码来源:main.py


示例6: run_game

def run_game():
    pygame.init()
    ai_setting = Settings()
    screen = pygame.display.set_mode((ai_setting.screen_width, ai_setting.screen_height))
    pygame.display.set_caption("Alien Invasion")
    ship = Ship(ai_setting, screen)
    bullets = Group()
    aliens = Group()
    stats = GameStats(ai_setting)
    sb = Scoreboard(ai_setting, screen, stats)
    gf.create_fleet(ai_setting, screen, ship, aliens)
    play_button = Button(ai_setting, screen, "Play")
    music = Music()

    while True:
        gf.check_events(ai_setting, screen, stats, sb, play_button, ship, aliens, bullets, music)
        if stats.game_active:
            music.play_bgm()
            ship.update()
            gf.update_bullets(ai_setting, screen, stats, sb, ship, aliens, bullets, music)
            gf.update_aliens(ai_setting, screen, stats, sb, ship, aliens, bullets)

        gf.update_screen(ai_setting, screen, stats, sb, ship, aliens, bullets, play_button)
开发者ID:shucommon,项目名称:little-routine,代码行数:23,代码来源:alien_invasion.py


示例7: parse

def parse(fname):
	soup = BeautifulSoup(open(fname), 'lxml')
	soup = BeautifulSoup(soup.prettify('shift-jis'), 'lxml')
	music = Music()

	title, artist = getHeader(soup)
	keys = getKeys(soup)
	lyrics = getLyrics(soup)
	chords = getChords(soup)

	music.title = title
	music.artist = artist
	music.keys = keys
	music.lyrics = lyrics
	music.chords = chords

	return music
开发者ID:Saito-,项目名称:NITKC_Research,代码行数:17,代码来源:parse_html.py


示例8: page_not_found

from events import Events
from users import Users
from docs import Docs

# configuration
DATABASE = 'test.json'

app = flask.Flask(__name__)
app.secret_key = settings.secret_key

#URL rules:  add as needed for the various dynamic pages
app.add_url_rule('/', view_func=Main.as_view('main'), methods=('get','post'))
app.add_url_rule('/<page>/', view_func=Main.as_view('main'), methods=('get','post'))
app.add_url_rule('/login/', view_func=Login.as_view('login'), methods=('get','post'))
app.add_url_rule('/remote/', view_func=Remote.as_view('remote'), methods=('get','post'))
app.add_url_rule('/music/', view_func=Music.as_view('music'), methods=('get', 'post'))
app.add_url_rule('/events/', view_func=Events.as_view('events'), methods=('get','post'))
app.add_url_rule('/users/', view_func=Users.as_view('users'), methods=('get','post'))
app.add_url_rule('/docs/', view_func=Docs.as_view('docs'), methods=('get','post'))

#error handling wrapper
@app.errorhandler(404)
def page_not_found(error):
	return flask.render_template('404.html'), 404

#database handling wrappers
@app.before_request
def before_request():
    """Make sure we are connected to the database each request."""
    try:
        db = open(DATABASE).read()
开发者ID:zkastl,项目名称:knights3,代码行数:31,代码来源:app.py


示例9: Display

"""

from display import Display
from controller import Controller
from music import Music

import threading
import gobject

if __name__ == '__main__':
    gobject.threads_init()

    display = Display()
    controller = Controller()
    music = Music()
    mainloop = gobject.MainLoop()

    # Connect signals between components.
    controller.connect('change-mode', display.change_mode)
    controller.connect('station-up', music.tune_station, 1)
    controller.connect('station-down', music.tune_station, -1)
    controller.connect('play-pause', music.play_pause)
    controller.connect('next-song', music.skip_song)
    music.connect('station-changed', display.change_station)
    music.connect('song-changed', display.change_song)
    music.connect('state-changed', display.change_state)

    # Start user interface loop.
    display_thread = threading.Thread(target=display.run, args=(mainloop,))
    display_thread.daemon = True
开发者ID:desheffer,项目名称:pyccolo,代码行数:30,代码来源:pyccolo.py


示例10: __init__

class Generator:

    def __init__(self):
        self.music = Music()

    def write_arffs(self):
        for next_file in os.listdir("midi"):
            if os.path.isfile("midi/" + next_file):
                print "adding midi/" + next_file
                self.music.load_song("midi/" + next_file)

        print "generating arff files"
        self.music.write_arff("test")

    def train(self):
        print "loading arff files"
        instrument_data, note_data, velocity_data, duration_data, time_delta_data = self.music.read_arff(
            "test")
        
        self.transform_instrument = preprocessing.OneHotEncoder(categorical_features=[0,1,2,5,6,7,10,11,12,15,16,17,20,21,22])
        self.transform_instrument.fit(instrument_data[:, :-1])

        self.transform_note = preprocessing.OneHotEncoder(categorical_features=[0,1,2,5,6,7,10,11,12,15,16,17,20,21,22])
        self.transform_note.fit(note_data[:, :-1])

        self.transform_duration = preprocessing.OneHotEncoder(categorical_features=[0,1,2,5,6,7,10,11,12,15,16,17,20,21,22])
        self.transform_duration.fit(duration_data[:, :-1])

        self.transform_time_delta = preprocessing.OneHotEncoder(categorical_features=[0,1,2,5,6,7,10,11,12,15,16,17,20,21,22])
        self.transform_time_delta.fit(time_delta_data[:, :-1])

        print "training instruments"
        self.instrument_clf = RandomForestClassifier(n_estimators=10)
        self.instrument_clf = self.instrument_clf.fit(
            self.transform_instrument.transform(instrument_data[:, :-1]), instrument_data[:, -1:])
        print "training notes"
        self.note_clf = RandomForestRegressor(n_estimators=10)
        print note_data[:, :-1]
        self.note_clf = self.note_clf.fit(self.transform_note.transform(note_data[:, :-1]), note_data[:, -1:])
        print "training velocity"
        self.velocity_clf = RandomForestClassifier(n_estimators=10)
        self.velocity_clf = self.velocity_clf.fit(
            velocity_data[:, :-1], velocity_data[:, -1:])
        print "training duration"
        self.duration_clf = RandomForestClassifier(n_estimators=10)
        self.duration_clf = self.duration_clf.fit(
            self.transform_duration.transform(duration_data[:, :-1]), duration_data[:, -1:])
        print "training time_delta"
        self.time_delta_clf = RandomForestClassifier(n_estimators=10)
        self.time_delta_clf = self.time_delta_clf.fit(
            self.transform_time_delta.transform(time_delta_data[:, :-1]), time_delta_data[:, -1:])

    def generate_song(self, filename):
        self.song = Song()

        self.song.add_note(self.get_seed_note())
        self.song.add_note(self.get_seed_note())

        print "generating new song"
        for _ in range(5000):
            notes = self.song.get_last_notes()
            notes = np.array(notes).reshape(1, -1)
            instrument = self.instrument_clf.predict(self.transform_instrument.transform(notes))[0]
            note = self.note_clf.predict(self.transform_note.transform(notes))[0]
            velocity = self.velocity_clf.predict(notes)[0]
            note_duration = self.duration_clf.predict(self.transform_duration.transform(notes))[0] * 2
            time_delta = self.time_delta_clf.predict(self.transform_time_delta.transform(notes))[0] * 0.75

            self.song.add_note(Note(int(instrument), int(note), int(
                velocity), int(time_delta), duration=int(note_duration)))

        print "writing song to " + filename
        self.song.write_file(filename)

    def get_seed_note(self):
        return Note(0, random.randrange(0, 126), 100, 0, duration=random.randrange(1, 10) * 10)
开发者ID:chrisranderson,项目名称:music-generation,代码行数:76,代码来源:generator.py


示例11: page_not_found

app.secret_key = settings.secret_key


#Routes	
app.add_url_rule('/',
			view_func=Main.as_view('main')
			methods=["GET"])

app.add_url_rule('/<page>/',
			view_func=Main.as_view('main')
			methods=["GET"])

app.add_url_rule('/Login/', 
			view_func=Login.as_view('login'), 
			methods=['GET', 'POST'])

app.add_url_rule('/remote/', 
			view_func=Music.as_view('remote'), 
			methods=(['GET'])

app.add_url_rule('/music/',
			view_func=Music.as_view('music'),
			methods=['GET'])

@app.errorhandler(404)
def page_not_found(error):
		return flask.render_template('404.html'), 404


app.debug = True
app.run()
开发者ID:learnthecraft617,项目名称:dev-sprint3,代码行数:31,代码来源:base_app.py


示例12: music

 def music(jsonData):
     Music.playCmd(jsonData)
开发者ID:shanlihou,项目名称:pythonFunc,代码行数:2,代码来源:RPC.py


示例13: page_not_found

import flask
import settings

#Views
from main import Main
from login import Login
from remote import Remote
from music import Music

app = flask.Flask(__name__)
app.secret_key = settings.secret_key

#Routes
app.add_url_rule('/', view_func=Main.as_view('main'), methods=["GET"])
app.add_url_rule('/<page>/', view_func=Main.as_view('main'), methods=["GET"])
app.add_url_rule('/login/', view_func=Login.as_view('login'), methods=["GET", "POST"])
app.add_url_rule('/remote/', view_func=Remote.as_view('remote'), methods=["GET", "POST"])
app.add_url_rule('/music/', view_func=Music.as_view('music'), methods=["GET"])

@app.errorhandler(404)
def page_not_found(error):
	return flask.render_template('404.html'), 404

app.debug = True
app.run()
开发者ID:ovasylev,项目名称:dev-sprint3,代码行数:25,代码来源:app.py


示例14: page_not_found

app =flask.Flask(__name__)

app.secret_key = settings.secret_key

#Routes

app.add_url_rule('/',
			view_func=Main.as_view('main'),
			methods=['GET'])

app.add_url_rule('/<page>/',
			view_func=Main.as_view('page'),
			methods=['GET'])

app.add_url_rule('/login',
			view_func=Login.as_view('login'),
			methods=['GET','POST'])
app.add_url_rule('/remote',
			view_func=Remote.as_view('remote'),
			methods=['GET','POST'])
app.add_url_rule('/music',
			view_func=Music.as_view('music'),
			methods=['GET'])

@app.errorhandler(404)
def page_not_found(error):
	return flask.render_template('404.html'),404

app.debug=True

app.run()
开发者ID:richardqlin,项目名称:flask_demo,代码行数:31,代码来源:app.py



注:本文中的music.Music类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python music21.mainTest函数代码示例发布时间:2022-05-27
下一篇:
Python gettextutils._函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap