original pitch fucking shit

This commit is contained in:
Chayapak 2023-10-01 11:27:54 +07:00
parent fb28000394
commit d9fc63a75e
6 changed files with 14 additions and 9 deletions

View file

@ -469,6 +469,7 @@ public class MusicCommand extends Command {
new Note(
Instrument.fromId(instrumentId),
j,
j,
1,
i * 50,
-1,

View file

@ -320,13 +320,13 @@ public class MusicPlayerPlugin extends Bot.Listener {
if (average > 100) blockPosition = -(float) average / 100; // left
else if (average < 100) blockPosition = (float) average / 100; // right
} else {
// this uses the pitch to calculate
final float pitch = note.pitch;
// this uses the MIDI PITCH to calculate
final float pitch = note.originalPitch;
if (pitch > 8) blockPosition = -(float) (pitch / -8) - 2; // left
else if (pitch < 2) blockPosition = (pitch / 2) - 2; // right
if (pitch > 93) blockPosition = -(float) (pitch / -93) - 2; // right
else if (pitch < 10) blockPosition = (pitch / 10) - 2; // left
blockPosition = MathUtilities.clamp(blockPosition, -0.5F, 0.5F);
blockPosition = MathUtilities.clamp(blockPosition, -0.4F, 0.4F);
}
key += 33;

View file

@ -193,7 +193,7 @@ public class MidiConverter implements Converter {
float volume = (float) velocity / 127.0f;
long time = microTime / 1000L;
return new Note(instrument, pitch, volume, time, -1, 100);
return new Note(instrument, pitch, midiPitch, volume, time, -1, 100);
}
private static Note getMidiPercussionNote (int midiPitch, int velocity, long microTime) {
@ -204,7 +204,7 @@ public class MidiConverter implements Converter {
Instrument instrument = Instrument.fromId(noteId / 25);
long time = microTime / 1000L;
return new Note(instrument, pitch, volume, time, -1, 100);
return new Note(instrument, pitch, midiPitch, volume, time, -1, 100);
}
return null;
}

View file

@ -232,9 +232,9 @@ public class NBSConverter implements Converter {
int pitch = key-33;
try {
song.add(new Note(instrument, pitch, (float) note.velocity * (float) layerVolume / 10000f, getMilliTime(note.tick, tempo), note.panning, nbsLayers.get(note.layer).stereo));
song.add(new Note(instrument, pitch, key, (float) note.velocity * (float) layerVolume / 10000f, getMilliTime(note.tick, tempo), note.panning, nbsLayers.get(note.layer).stereo));
} catch (Exception e) {
song.add(new Note(instrument, pitch, (float) note.velocity * (float) layerVolume / 10000f, getMilliTime(note.tick, tempo), -1, 100));
song.add(new Note(instrument, pitch, key, (float) note.velocity * (float) layerVolume / 10000f, getMilliTime(note.tick, tempo), -1, 100));
}
}

View file

@ -4,6 +4,7 @@ package land.chipmunk.chayapak.chomens_bot.song;
public class Note implements Comparable<Note> {
public final Instrument instrument;
public final int pitch;
public final int originalPitch;
public final float volume;
public final long time;
public final int panning;
@ -12,6 +13,7 @@ public class Note implements Comparable<Note> {
public Note (
Instrument instrument,
int pitch,
int originalPitch,
float volume,
long time,
int panning,
@ -19,6 +21,7 @@ public class Note implements Comparable<Note> {
) {
this.instrument = instrument;
this.pitch = pitch;
this.originalPitch = originalPitch;
this.volume = volume;
this.time = time;
this.panning = panning;

View file

@ -57,6 +57,7 @@ public class TextFileConverter implements Converter {
Instrument.of(instrument) :
Instrument.fromId(intInstrument),
pitch,
pitch,
volume,
time,
-1,