Exemplo n.º 1
0
    def test_osu2(self):
        mFrom = OsuMap.readFile(OSU_TRIBAL_TRIAL_MX)

        mTo = OsuMap.readFile(OSU_TRIBAL_TRIAL_EXH)

        mOut = hitSoundCopy(mFrom=mFrom, mTo=mTo)

        # mOut.writeFile("out.osu")

        mOut = hitSoundCopy(mFrom=mOut, mTo=mFrom)
Exemplo n.º 2
0
    def test_osu3(self):
        # Complex BPM
        osu = OsuMap.readFile(OSU_GRAVITY)

        sm = OsuToSM.convert(osu)
        sm.offset -= 15 + 41
        sm.music = "Gravity.mp3"
Exemplo n.º 3
0
    def testSv(self):
        # Complex BPM Points
        osu = OsuMap.readFile(OSU_CARAVAN)

        seq = SvSequence()
        seq.readSvFromMap(osu)

        for sv, sv0 in zip(seq.writeAsSv(OsuSv, volume=0)[:50], osu.svs):
            assert isinstance(sv, OsuSv)
            self.assertAlmostEqual(sv0.multiplier, sv.multiplier)
            self.assertEqual(0, sv.volume)
Exemplo n.º 4
0
    def testTrueSv(self):
        # Complex BPM Points
        osu = OsuMap.readFile(OSU_CARAVAN)

        seq = SvSequence()
        seq.readTrueSvFromMap(osu, 140)

        # Just need to check the first 50, others should be ok.
        for sv in seq.writeAsSv(OsuSv, volume=0)[:50]:
            assert isinstance(sv, OsuSv)
            self.assertAlmostEqual(1, sv.multiplier, delta=0.01)
            self.assertEqual(0, sv.volume)
Exemplo n.º 5
0
    def convert(sm: SMMapSet) -> List[OsuMap]:
        """ Converts a SMMapset to possibly multiple osu maps

        Note that a mapset contains maps, so a list would be expected.
        SMMap conversion is not possible due to lack of SMMapset Metadata

        :param sm:
        :return:
        """

        # I haven't tested with non 4 keys, so it might explode :(

        osuMapSet: List[OsuMap] = []
        for smMap in sm.maps:
            assert isinstance(smMap, SMMap)

            hits: List[OsuHit] = []
            holds: List[OsuHold] = []

            # Note Conversion
            for hit in smMap.notes.hits():
                hits.append(OsuHit(offset=hit.offset, column=hit.column))
            for hold in smMap.notes.holds():
                holds.append(
                    OsuHold(offset=hold.offset,
                            column=hold.column,
                            _length=hold.length))

            bpms: List[Bpm] = []

            # Timing Point Conversion
            for bpm in smMap.bpms:
                bpms.append(OsuBpm(offset=bpm.offset, bpm=bpm.bpm))

            # Extract Metadata
            osuMap = OsuMap(
                backgroundFileName=sm.background,
                title=sm.title,
                titleUnicode=sm.titleTranslit,
                artist=sm.artist,
                artistUnicode=sm.artistTranslit,
                audioFileName=sm.music,
                creator=sm.credit,
                version=f"{smMap.difficulty} {smMap.difficultyVal}",
                previewTime=int(sm.sampleStart),
                bpms=OsuBpmList(bpms),
                notes=OsuNotePkg(hits=OsuHitList(hits),
                                 holds=OsuHoldList(holds)))
            osuMapSet.append(osuMap)
        return osuMapSet
Exemplo n.º 6
0
    def convert(o2j: O2JMapSet) -> List[OsuMap]:
        """ Converts a Mapset to multiple Osu maps

        Note that a mapset contains maps, so a list would be expected.
        O2JMap conversion is not possible due to lack of O2JMapset Metadata

        :param o2j:
        :return:
        """

        osuMapSet: List[OsuMap] = []
        for o2jMap in o2j.maps:
            assert isinstance(o2jMap, O2JMap)

            hits: List[OsuHit] = []
            holds: List[OsuHold] = []

            # Note Conversion
            for hit in o2jMap.notes.hits():
                hits.append(OsuHit(offset=hit.offset, column=hit.column))
            for hold in o2jMap.notes.holds():
                holds.append(
                    OsuHold(offset=hold.offset,
                            column=hold.column,
                            _length=hold.length))

            bpms: List[Bpm] = []

            # Timing Point Conversion
            for bpm in o2jMap.bpms:
                bpms.append(OsuBpm(offset=bpm.offset, bpm=bpm.bpm))

            # Extract Metadata
            osuMap = OsuMap(
                title=o2j.title,
                artist=o2j.artist,
                creator=o2j.creator,
                version=f"Level {o2j.level[o2j.maps.index(o2jMap)]}",
                bpms=OsuBpmList(bpms),
                circleSize=7,
                notes=OsuNotePkg(hits=OsuHitList(hits),
                                 holds=OsuHoldList(holds)))
            osuMapSet.append(osuMap)
        return osuMapSet
Exemplo n.º 7
0
    def convert(qua: QuaMap) -> OsuMap:
        """ Converts a Quaver map to an osu map

        :param qua:
        :return:
        """

        hits: List[OsuHit] = []
        holds: List[OsuHold] = []

        # Note Conversion
        for hit in qua.notes.hits():
            hits.append(OsuHit(offset=hit.offset, column=hit.column))
        for hold in qua.notes.holds():
            holds.append(OsuHold(offset=hold.offset, column=hold.column, _length=hold.length))

        bpms: List[Bpm] = []
        svs: List[OsuSv] = []
        # Timing Point Conversion
        for bpm in qua.bpms:
            bpms.append(OsuBpm(offset=bpm.offset, bpm=bpm.bpm))

        for sv in qua.svs:
            svs.append(OsuSv(offset=sv.offset, multiplier=sv.multiplier))

        # Extract Metadata
        osuMap = OsuMap(
            backgroundFileName=qua.backgroundFile,
            title=qua.title,
            circleSize=QuaMapMode.getKeys(qua.mode),
            titleUnicode=qua.title,
            artist=qua.artist,
            artistUnicode=qua.artist,
            audioFileName=qua.audioFile,
            creator=qua.creator,
            version=qua.difficultyName,
            previewTime=qua.songPreviewTime,
            bpms=OsuBpmList(bpms),
            svs=OsuSvList(svs),
            notes=OsuNotePkg(hits=OsuHitList(hits),
                             holds=OsuHoldList(holds))
        )

        return osuMap
Exemplo n.º 8
0
    def test_osu(self):
        osu = OsuMap.readFile(OSU_BOOGIE)

        ptn = Pattern.fromPkg([osu.notes.hits(), osu.notes.holds()])
        grp = ptn.group(hwindow=None, vwindow=50, avoidJack=True)

        keys = osu.notes.maxColumn() + 1

        pf = PlayField(m=osu, durationPerPx=5) \
             + PFDrawLines.fromCombo(keys=keys, **PFDrawLines.Colors.RED,
            combo=PtnCombo(grp).templateChordStream(primary=3, secondary=2, keys=keys, andLower=True)) \
             + PFDrawLines.fromCombo(keys=keys, **PFDrawLines.Colors.BLUE,
            combo=PtnCombo(grp).templateChordStream(primary=2, secondary=1, keys=keys, andLower=True)) \
             + PFDrawLines.fromCombo(keys=keys, **PFDrawLines.Colors.PURPLE,
            combo=PtnCombo(grp).templateJacks(minimumLength=2, keys=keys))

        # pf.exportFold(maxHeight=1750, stageLineWidth=0).save("osu.png")

        pass
Exemplo n.º 9
0
from reamber.osu.OsuMap import OsuMap
import matplotlib.pyplot as plt

from reamber.algorithms.analysis.generic.rollingDensity import rollingDensity

m = OsuMap()
m.readFile("generic/PLANETSHAPER.osu")

rollingDensity(m.notes.hits().offsets(), rollingWindowS=2).plot()
plt.show()
Exemplo n.º 10
0
 def testByKey(self):
     plt.clf()
     m = OsuMap.readFile(OSU_PLANET_SHAPER)
     npsPlotByKey(m.notes)
Exemplo n.º 11
0
 def test_osu(self):
     m = OsuMap.readFile(OSU_PLANET_SHAPER)
     offset = m.notes.offsets(flatten=True)[:10]
     m.rate(2.0, inplace=True)
     for i, j in zip(offset, m.notes.offsets(flatten=True)[:10]):
         self.assertAlmostEqual(i / 2, j)
Exemplo n.º 12
0
parser = argparse.ArgumentParser(description='osu!mania rate changer.')
parser.add_argument("rate", type=float)
parser.add_argument("-od", help="Change the od to [value]", type=int)
parser.add_argument("-nsv", help="Removes all the SVs in a map", action='store_true')
parser.add_argument("-nln", help="Removes all the LNs in a map", action='store_true')
args = parser.parse_args()

r = requests.get('http://127.0.0.1:24050/json')
jsons = json.loads(r.text)['menu']['bm']['path']

SONG_FOLDER = json.loads(r.text)['settings']['folders']['songs']
FOLDER = f"{SONG_FOLDER}\\{jsons['folder']}\\"
RATE = float(args.rate)

m = OsuMap.read_file(FOLDER + jsons['file'])
m_ = m.rate(RATE)

if args.rate != 1.0:
    m_.version = f"{m_.version} {RATE}x {round(m_.bpms[0].bpm, 1)}bpm"
    m_.audio_file_name = f"{jsons['audio'][:-4]} {RATE}.mp3"
    os.system(
        f'ffmpeg -i "{FOLDER + jsons["audio"]}" -filter_complex [0:a]atempo={RATE}[s0] -map [s0] "{FOLDER + m_.audio_file_name}"')

filename = f"{FOLDER + jsons['file'][:-4]} {RATE}"

if args.od is not None:
    m_.overall_difficulty = args.od
    m_.version += f" OD {args.od}"
    filename += f" od{args.od}"
Exemplo n.º 13
0
    def test_osu3(self):
        # Complex BPM
        osu = OsuMap.readFile(OSU_GRAVITY)

        qua = OsuToQua.convert(osu)
        qua.music = "Gravity.mp3"
Exemplo n.º 14
0
 def test_osu(self):
     m = OsuMap.readFile(OSU_CARAVAN)
     m.bpms.snapOffsets(nths=4, lastOffset=10000)
Exemplo n.º 15
0
    def test_osu1(self):
        # Complex BPM Points
        osu = OsuMap.readFile(OSU_CARAVAN)

        qua = OsuToQua.convert(osu)
Exemplo n.º 16
0
    def test_osu2(self):
        # Stops
        osu = OsuMap.readFile(OSU_ESCAPES)

        qua = OsuToQua.convert(osu)
Exemplo n.º 17
0
from reamber.algorithms.plot.nps import npsPlot
from reamber.osu.OsuMap import OsuMap
import matplotlib.pyplot as plt

m = OsuMap()
m.readFile("note/PLANETSHAPER.osu")
npsPlot(m, binSize=500)
plt.show()
Exemplo n.º 18
0
 def test_osu(self):
     m = OsuMap.readFile(OSU_ICFITU)
     m.describe()
Exemplo n.º 19
0
from reamber.algorithms.plot.nps import npsPlot
from reamber.osu.OsuMap import OsuMap
import matplotlib.pyplot as plt

m = OsuMap.readFile("plot/PLANETSHAPER.osu")
npsPlot(m, binSize=500)
plt.show()
Exemplo n.º 20
0
from aleph.f598 import f598
from aleph.f608 import f608
from aleph.f834 import f834
from aleph.f919 import f919
from aleph.f950 import f950
from reamber.osu.OsuBpm import OsuBpm
from reamber.osu.OsuMap import OsuMap

logging.basicConfig(filename="event.log", filemode="w+", level=logging.DEBUG)

# Path is redacted
path = "LeaF - Aleph-0 (extended ver.) (Evening) [Easy 1].osu"

np.random.seed(2)

osu = OsuMap.readFile(path)

osu.bpms.clear()

# Comment out anything here to remove that section

f002(osu)
f017(osu)
f018(osu)
f019(osu)
f024(osu)
f028(osu)
f039(osu)
f053(osu)
f072(osu)
f083(osu)
Exemplo n.º 21
0
    def test(self):
        # Complex BPM Points
        osu = OsuMap.readFile(OSU_ZENITHALIZE_19)

        bms = OsuToBMS.convert(osu, moveRightBy=1)
        bms.writeFile('out.bme', BMSChannel.BME)