def test(self): # Complex BPM Points sm = SMMapSet.readFile(SM_GRAVITY) osuMapSet = SMToOsu.convert(sm) osuMapSet[0].audioFileName = "audio.mp3" osuMapSet[0].addOffset(15 + 41)
def test(self): # Stops and multiple map sm = SMMapSet.readFile(SM_ESCAPES) osuMapSet = SMToOsu.convert(sm) osuMapSet[0].audioFileName = "Escapes.mp3" osuMapSet[0].addOffset(635 + 575) # osuMapSet[0].writeFile("out.osu") osuMapSet[1].audioFileName = "Escapes.mp3" osuMapSet[1].addOffset(635 + 575)
def convert(osu: OsuMap, assertKeys=True) -> SMMapSet: """ Converts Osu to a SMMapset Obj Note that each osu map object will create a separate mapset, they are not merged :param osu: :param assertKeys: Adds an assertion to verify that Quaver can support this key mode :return: """ if assertKeys: assert osu.circleSize == 4 hits: List[SMHit] = [] holds: List[SMHold] = [] for hit in osu.notes.hits(): hits.append(SMHit(offset=hit.offset, column=hit.column)) for hold in osu.notes.holds(): holds.append(SMHold(offset=hold.offset, column=hold.column, _length=hold.length)) bpms: List[Bpm] = [] for bpm in osu.bpms: bpms.append(SMBpm(offset=bpm.offset, bpm=bpm.bpm)) smSet: SMMapSet = SMMapSet( music=osu.audioFileName, title=osu.title, titleTranslit=osu.titleUnicode, artist=osu.artist, artistTranslit=osu.artistUnicode, credit=osu.creator, background=osu.backgroundFileName, sampleStart=osu.previewTime, sampleLength=10, offset=-OsuToSM.OFFSET, maps=[ SMMap( chartType=SMMapChartTypes.DANCE_SINGLE, notes=SMNotePkg(hits=SMHitList(hits), holds=SMHoldList(holds)), bpms=SMBpmList(bpms) ) ] ) return smSet
def convert(o2j: O2JMapSet) -> List[SMMapSet]: """ Converts a Mapset to multiple SM maps Due to non-confidence that bpms are consistent, A list of SMSet would be generated. :param o2j: :return: """ smSets = [] for o2jMap in o2j.maps: bpms: List[Bpm] = [] for bpm in o2jMap.bpms: bpms.append(SMBpm(offset=bpm.offset, bpm=bpm.bpm)) hits: List[SMHit] = [] holds: List[SMHold] = [] for hit in o2jMap.notes.hits(): hits.append(SMHit(offset=hit.offset, column=hit.column)) for hold in o2jMap.notes.holds(): holds.append( SMHold(offset=hold.offset, column=hold.column, _length=hold.length)) smSet: SMMapSet = SMMapSet( title=o2j.title, artist=o2j.artist, credit=o2j.creator, offset=0.0, maps=[ SMMap(description= f"Level {o2j.level[o2j.maps.index(o2jMap)]}", chartType=SMMapChartTypes.KB7_SINGLE, notes=SMNotePkg(hits=SMHitList(hits), holds=SMHoldList(holds)), bpms=SMBpmList(bpms)) ]) smSets.append(smSet) return smSets
def convert(qua: QuaMap) -> SMMapSet: """ Converts a Quaver map to a SMMapset Obj Note that each qua map object will create a separate mapset, they are not merged :param qua: :return: """ hits: List[SMHit] = [] holds: List[SMHold] = [] for hit in qua.notes.hits(): hits.append(SMHit(offset=hit.offset, column=hit.column)) for hold in qua.notes.holds(): holds.append( SMHold(offset=hold.offset, column=hold.column, _length=hold.length)) bpms: List[Bpm] = [] for bpm in qua.bpms: bpms.append(SMBpm(offset=bpm.offset, bpm=bpm.bpm)) smSet: SMMapSet = SMMapSet( music=qua.audioFile, title=qua.title, titleTranslit=qua.title, artist=qua.artist, artistTranslit=qua.artist, credit=qua.creator, background=qua.backgroundFile, sampleStart=qua.songPreviewTime, sampleLength=10, offset=qua.notes.firstOffset(), maps=[ SMMap(chartType=SMMapChartTypes.DANCE_SINGLE, notes=SMNotePkg(hits=SMHitList(hits), holds=SMHoldList(holds)), bpms=SMBpmList(bpms)) ]) return smSet
def convert(bms: BMSMap) -> SMMapSet: """ Converts a Mapset to multiple SM maps :param bms: :return: """ bpms: List[Bpm] = [] for bpm in bms.bpms: bpms.append(SMBpm(offset=bpm.offset, bpm=bpm.bpm)) hits: List[SMHit] = [] holds: List[SMHold] = [] for hit in bms.notes.hits(): hits.append(SMHit(offset=hit.offset, column=hit.column)) for hold in bms.notes.holds(): holds.append( SMHold(offset=hold.offset, column=hold.column, _length=hold.length)) smSet: SMMapSet = SMMapSet( title=str(bms.title, 'ascii', errors='ignore'), artist=str(bms.artist, 'ascii', errors='ignore'), offset=0.0, maps=[ SMMap(description=f"Level {bms.version}", chartType=SMMapChartTypes.getType(bms.notes.maxColumn() + 1), notes=SMNotePkg(hits=SMHitList(hits), holds=SMHoldList(holds)), bpms=SMBpmList(bpms)) ]) return smSet
def test2(self): # Stops and multiple map sm = SMMapSet.readFile(SM_ESCAPES) quas = SMToQua.convert(sm)
def test(self): # Complex BPM Points sm = SMMapSet.readFile(SM_GRAVITY) quas = SMToQua.convert(sm)
def test_sm(self): s = SMMapSet.readFile(SM_CARAVAN) s.describe()
def test_sm(self): s = SMMapSet.readFile(SM_CARAVAN) offset = s.maps[0].notes.offsets(flatten=True)[:10] s.rate(2.0, inplace=True) for i, j in zip(offset, s.maps[0].notes.offsets(flatten=True)[:10]): self.assertAlmostEqual(i / 2, j)
def test(self): # This is not going to give me a proper map but ok sm = SMMapSet.readFile(SM_ICFITU) bms = SMToBMS.convert(sm) bms[0].writeFile('out.bme', BMSChannel.BME)