summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
8107325)
synth = Synth()
synth.program_select(0, 0, 0)
synth = Synth()
synth.program_select(0, 0, 0)
home = Home(songPath=SONG_FILE_PATH)
home.connect(QUIT, app.quit)
app.run(home)
app.close(home)
home = Home(songPath=SONG_FILE_PATH)
home.connect(QUIT, app.quit)
app.run(home)
app.close(home)
- song = musicXml2Song('/Users/pinbe/dev/minwii/src/songs/chansons/etoile_neige.xml', printNotes=True)
+ song = musicXml2Song(home.songFile, printNotes=True)
playingScreen = SongPlayingScreen(synth, song)
#playingScreen = PlayingScreen(synth)
playingScreen.run()
playingScreen = SongPlayingScreen(synth, song)
#playingScreen = PlayingScreen(synth)
playingScreen.run()
self.notes = []
self.repeats = []
self.distinctNotes = []
self.notes = []
self.repeats = []
self.distinctNotes = []
+ self.quarterNoteDuration = 500
self._parseMusic()
self.verses = [[]]
self.chorus = []
self._parseMusic()
self.verses = [[]]
self.chorus = []
self.repeats.append(barline)
self.distinctNotes.sort(lambda a, b : cmp(a.midi, b.midi))
self.repeats.append(barline)
self.distinctNotes.sort(lambda a, b : cmp(a.midi, b.midi))
+ sounds = self.node.getElementsByTagName('sound')
+ tempo = 120
+ for sound in sounds :
+ if sound.hasAttribute('tempo') :
+ tempo = float(sound.getAttribute('tempo'))
+ break
+
+ self.quarterNoteDuration = int(round(60000/tempo))
+
def iterNotes(self, indefinitely=True) :
"exécution de la chanson avec l'alternance couplets / refrains"
def iterNotes(self, indefinitely=True) :
"exécution de la chanson avec l'alternance couplets / refrains"
- print 'indefinitely', indefinitely
if indefinitely == False :
iterable = self.verses
else :
if indefinitely == False :
iterable = self.verses
else :
from pgu.gui import Select
from pgu.gui import CLICK
from pgu.gui import QUIT
from pgu.gui import Select
from pgu.gui import CLICK
from pgu.gui import QUIT
+from pgu.gui import CHANGE
import pygame
from gui.constants import reversedReadabilityDict, modeDict
from songfilebrowser import FileOpenDialog
import pygame
from gui.constants import reversedReadabilityDict, modeDict
from songfilebrowser import FileOpenDialog
def __init__(self,**params):
Table.__init__(self,**params)
self.songPath = params.get('songPath', '.')
def __init__(self,**params):
Table.__init__(self,**params)
self.songPath = params.get('songPath', '.')
self.spaceSize = (100,100)
self.font = pygame.font.Font(None,70)
self._fill()
self.spaceSize = (100,100)
self.font = pygame.font.Font(None,70)
self._fill()
def open_file_browser(self):
dlg = FileOpenDialog(self.songPath)
def open_file_browser(self):
dlg = FileOpenDialog(self.songPath)
- #d = MINWiiDialog(font = self.font,width = 800, height = 600,path = "../songs/smwis")
- #d.connect(pguGui.CHANGE, self.handle_file_browser_closed, d)
+ dlg.connect(CHANGE, self.handle_file_browser_closed, dlg)
+ def handle_file_browser_closed(self, dlg) :
+ if dlg.value and os.path.isfile(dlg.value):
+ self.songFile = dlg.value
+
\ No newline at end of file
\ No newline at end of file
def __init__(self, synth, song, mode=PLAYING_MODES['EASY']) :
super(SongPlayingScreen, self).__init__(synth, song.distinctNotes)
self.song = song
def __init__(self, synth, song, mode=PLAYING_MODES['EASY']) :
super(SongPlayingScreen, self).__init__(synth, song.distinctNotes)
self.song = song
+ self.quarterNoteDuration = song.quarterNoteDuration
self.currentColumn = None
self.noteIterator = self.song.iterNotes()
self.displayNext()
self.currentColumn = None
self.noteIterator = self.song.iterNotes()
self.displayNext()
col = event.column
if col.state and not self.currentNotePlayed :
self.synth.noteon(0, col.tone.midi, DEFAULT_MIDI_VELOCITY)
col = event.column
if col.state and not self.currentNotePlayed :
self.synth.noteon(0, col.tone.midi, DEFAULT_MIDI_VELOCITY)
- SongPlayingScreen.setNoteTimeout(int(self.currentNote.duration * 600))
+ SongPlayingScreen.setNoteTimeout(
+ int(self.currentNote.duration * \
+ self.quarterNoteDuration)
+ )
self.currentNotePlayed = True
@event_handler(events.NOTEEND)
self.currentNotePlayed = True
@event_handler(events.NOTEEND)