original pitch fucking shit
This commit is contained in:
parent
fb28000394
commit
d9fc63a75e
6 changed files with 14 additions and 9 deletions
|
@ -469,6 +469,7 @@ public class MusicCommand extends Command {
|
||||||
new Note(
|
new Note(
|
||||||
Instrument.fromId(instrumentId),
|
Instrument.fromId(instrumentId),
|
||||||
j,
|
j,
|
||||||
|
j,
|
||||||
1,
|
1,
|
||||||
i * 50,
|
i * 50,
|
||||||
-1,
|
-1,
|
||||||
|
|
|
@ -320,13 +320,13 @@ public class MusicPlayerPlugin extends Bot.Listener {
|
||||||
if (average > 100) blockPosition = -(float) average / 100; // left
|
if (average > 100) blockPosition = -(float) average / 100; // left
|
||||||
else if (average < 100) blockPosition = (float) average / 100; // right
|
else if (average < 100) blockPosition = (float) average / 100; // right
|
||||||
} else {
|
} else {
|
||||||
// this uses the pitch to calculate
|
// this uses the MIDI PITCH to calculate
|
||||||
final float pitch = note.pitch;
|
final float pitch = note.originalPitch;
|
||||||
|
|
||||||
if (pitch > 8) blockPosition = -(float) (pitch / -8) - 2; // left
|
if (pitch > 93) blockPosition = -(float) (pitch / -93) - 2; // right
|
||||||
else if (pitch < 2) blockPosition = (pitch / 2) - 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;
|
key += 33;
|
||||||
|
|
|
@ -193,7 +193,7 @@ public class MidiConverter implements Converter {
|
||||||
float volume = (float) velocity / 127.0f;
|
float volume = (float) velocity / 127.0f;
|
||||||
long time = microTime / 1000L;
|
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) {
|
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);
|
Instrument instrument = Instrument.fromId(noteId / 25);
|
||||||
long time = microTime / 1000L;
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,9 +232,9 @@ public class NBSConverter implements Converter {
|
||||||
int pitch = key-33;
|
int pitch = key-33;
|
||||||
|
|
||||||
try {
|
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) {
|
} 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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ package land.chipmunk.chayapak.chomens_bot.song;
|
||||||
public class Note implements Comparable<Note> {
|
public class Note implements Comparable<Note> {
|
||||||
public final Instrument instrument;
|
public final Instrument instrument;
|
||||||
public final int pitch;
|
public final int pitch;
|
||||||
|
public final int originalPitch;
|
||||||
public final float volume;
|
public final float volume;
|
||||||
public final long time;
|
public final long time;
|
||||||
public final int panning;
|
public final int panning;
|
||||||
|
@ -12,6 +13,7 @@ public class Note implements Comparable<Note> {
|
||||||
public Note (
|
public Note (
|
||||||
Instrument instrument,
|
Instrument instrument,
|
||||||
int pitch,
|
int pitch,
|
||||||
|
int originalPitch,
|
||||||
float volume,
|
float volume,
|
||||||
long time,
|
long time,
|
||||||
int panning,
|
int panning,
|
||||||
|
@ -19,6 +21,7 @@ public class Note implements Comparable<Note> {
|
||||||
) {
|
) {
|
||||||
this.instrument = instrument;
|
this.instrument = instrument;
|
||||||
this.pitch = pitch;
|
this.pitch = pitch;
|
||||||
|
this.originalPitch = originalPitch;
|
||||||
this.volume = volume;
|
this.volume = volume;
|
||||||
this.time = time;
|
this.time = time;
|
||||||
this.panning = panning;
|
this.panning = panning;
|
||||||
|
|
|
@ -57,6 +57,7 @@ public class TextFileConverter implements Converter {
|
||||||
Instrument.of(instrument) :
|
Instrument.of(instrument) :
|
||||||
Instrument.fromId(intInstrument),
|
Instrument.fromId(intInstrument),
|
||||||
pitch,
|
pitch,
|
||||||
|
pitch,
|
||||||
volume,
|
volume,
|
||||||
time,
|
time,
|
||||||
-1,
|
-1,
|
||||||
|
|
Loading…
Reference in a new issue