mirror of
https://github.com/FMS-Cat/condition.git
synced 2025-08-07 14:36:28 +02:00
aesthetics: offset time by 16 beat
This commit is contained in:
19
automaton時間全部ずらすやつ.js
Normal file
19
automaton時間全部ずらすやつ.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* @type {import('../automaton/node_modules/@fms-cat/automaton/types').SerializedAutomaton}
|
||||||
|
*/
|
||||||
|
const data = require( './src/automaton.json' );
|
||||||
|
|
||||||
|
const newData = JSON.parse( JSON.stringify( data ) );
|
||||||
|
|
||||||
|
const bpm = 180.0;
|
||||||
|
const beat = 60.0 / bpm;
|
||||||
|
|
||||||
|
const shift = 16.0 * beat;
|
||||||
|
|
||||||
|
newData.channels.forEach( ( [ name, channel ] ) => {
|
||||||
|
channel.items.forEach( ( item ) => {
|
||||||
|
item.time += shift;
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
|
||||||
|
console.log( JSON.stringify( newData ) );
|
File diff suppressed because one or more lines are too long
@@ -3,6 +3,7 @@ import { GLCatBuffer, GLCatProgram, GLCatTransformFeedback } from '@fms-cat/glca
|
|||||||
import { MUSIC_BPM } from '../config';
|
import { MUSIC_BPM } from '../config';
|
||||||
import { SamplesManager } from './SamplesManager';
|
import { SamplesManager } from './SamplesManager';
|
||||||
import { audio } from '../globals/music';
|
import { audio } from '../globals/music';
|
||||||
|
import { binarySearch } from '@fms-cat/automaton';
|
||||||
import { gl, glCat } from '../globals/canvas';
|
import { gl, glCat } from '../globals/canvas';
|
||||||
import { injectCodeToShader } from '../utils/injectCodeToShader';
|
import { injectCodeToShader } from '../utils/injectCodeToShader';
|
||||||
import { randomTextureStatic } from '../globals/randomTexture';
|
import { randomTextureStatic } from '../globals/randomTexture';
|
||||||
@@ -10,6 +11,18 @@ import musicVert from './music.vert';
|
|||||||
|
|
||||||
const discardFrag = '#version 300 es\nvoid main(){discard;}';
|
const discardFrag = '#version 300 es\nvoid main(){discard;}';
|
||||||
|
|
||||||
|
const sectionResets = [
|
||||||
|
16.0,
|
||||||
|
80.0,
|
||||||
|
144.0,
|
||||||
|
208.0,
|
||||||
|
272.0,
|
||||||
|
336.0,
|
||||||
|
400.0,
|
||||||
|
464.0,
|
||||||
|
1E9,
|
||||||
|
].map( ( v ) => v * 60.0 / MUSIC_BPM );
|
||||||
|
|
||||||
export abstract class Music {
|
export abstract class Music {
|
||||||
public isPlaying: boolean;
|
public isPlaying: boolean;
|
||||||
public time: number;
|
public time: number;
|
||||||
@@ -128,7 +141,10 @@ export abstract class Music {
|
|||||||
|
|
||||||
const beatLength = 60.0 / MUSIC_BPM;
|
const beatLength = 60.0 / MUSIC_BPM;
|
||||||
const barLength = 240.0 / MUSIC_BPM;
|
const barLength = 240.0 / MUSIC_BPM;
|
||||||
const sixteenBarLength = 3840.0 / MUSIC_BPM;
|
|
||||||
|
const sectionReset = binarySearch( sectionResets, time );
|
||||||
|
const sectionBegin = sectionResets[ sectionReset ];
|
||||||
|
const sectionLength = sectionResets[ sectionReset + 1 ] - sectionBegin;
|
||||||
|
|
||||||
program.attribute( 'off', this.__bufferOff, 1 );
|
program.attribute( 'off', this.__bufferOff, 1 );
|
||||||
program.uniform( 'bpm', '1f', MUSIC_BPM );
|
program.uniform( 'bpm', '1f', MUSIC_BPM );
|
||||||
@@ -139,7 +155,7 @@ export abstract class Music {
|
|||||||
'4f',
|
'4f',
|
||||||
beatLength,
|
beatLength,
|
||||||
barLength,
|
barLength,
|
||||||
sixteenBarLength,
|
sectionLength,
|
||||||
1E16
|
1E16
|
||||||
);
|
);
|
||||||
program.uniform(
|
program.uniform(
|
||||||
@@ -147,7 +163,7 @@ export abstract class Music {
|
|||||||
'4f',
|
'4f',
|
||||||
time % beatLength,
|
time % beatLength,
|
||||||
time % barLength,
|
time % barLength,
|
||||||
time % sixteenBarLength,
|
( time - sectionBegin ) % sectionLength,
|
||||||
time,
|
time,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -8,12 +8,12 @@ const float PI = 3.14159265359;
|
|||||||
const float TAU = 6.28318530718;
|
const float TAU = 6.28318530718;
|
||||||
const float BPM = 180.0;
|
const float BPM = 180.0;
|
||||||
const float BEAT = 60.0 / BPM;
|
const float BEAT = 60.0 / BPM;
|
||||||
const float SECTION_BEGIN = 0.0 * BEAT;
|
const float SECTION_BEGIN = 16.0 * BEAT;
|
||||||
const float SECTION_NEURO = 128.0 * BEAT;
|
const float SECTION_NEURO = 144.0 * BEAT;
|
||||||
const float SECTION_WHOA = 256.0 * BEAT;
|
const float SECTION_WHOA = 272.0 * BEAT;
|
||||||
const float SECTION_PORTER_FUCKING_ROBINSON = 320.0 * BEAT;
|
const float SECTION_PORTER_FUCKING_ROBINSON = 336.0 * BEAT;
|
||||||
const float SECTION_AAAA = 384.0 * BEAT;
|
const float SECTION_AAAA = 400.0 * BEAT;
|
||||||
const float SECTION_PSY = 448.0 * BEAT;
|
const float SECTION_PSY = 464.0 * BEAT;
|
||||||
|
|
||||||
#define saturate(i) clamp(i, 0.,1.)
|
#define saturate(i) clamp(i, 0.,1.)
|
||||||
#define aSaturate(i) clamp((i),-1.,1.)
|
#define aSaturate(i) clamp((i),-1.,1.)
|
||||||
@@ -260,7 +260,7 @@ vec2 mainAudio( vec4 time ) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
int progB = ( time.w < SECTION_AAAA - 8.0 * BEAT )
|
int progB = ( time.w < SECTION_AAAA - 8.0 * BEAT )
|
||||||
? 6 * ( int( time.w / ( 8.0 * BEAT ) ) % 8 )
|
? 6 * ( int( time.z / ( 8.0 * BEAT ) ) % 8 )
|
||||||
: 36;
|
: 36;
|
||||||
|
|
||||||
float bassfreq = n2f( 0.0 );
|
float bassfreq = n2f( 0.0 );
|
||||||
@@ -268,8 +268,7 @@ vec2 mainAudio( vec4 time ) {
|
|||||||
float sidechain = 1.0;
|
float sidechain = 1.0;
|
||||||
|
|
||||||
// -- kick ---------------------------------------------------------------------------------------
|
// -- kick ---------------------------------------------------------------------------------------
|
||||||
if ( inRange( time.w, 64.0 * BEAT, SECTION_NEURO - 16.0 * BEAT ) ) {
|
if ( inRange( time.w, SECTION_BEGIN + 64.0 * BEAT, SECTION_NEURO - 16.0 * BEAT ) ) {
|
||||||
float ph = linearstep( 64.0 * BEAT, SECTION_PORTER_FUCKING_ROBINSON, time.w );
|
|
||||||
float t = mod( mod( time.z - 1.5 * BEAT, 4.0 * BEAT ), 2.5 * BEAT );
|
float t = mod( mod( time.z - 1.5 * BEAT, 4.0 * BEAT ), 2.5 * BEAT );
|
||||||
sidechain = smoothstep( 0.0, 0.7 * BEAT, t );
|
sidechain = smoothstep( 0.0, 0.7 * BEAT, t );
|
||||||
dest += 0.25 * kick( t, 0.2 );
|
dest += 0.25 * kick( t, 0.2 );
|
||||||
@@ -280,7 +279,7 @@ vec2 mainAudio( vec4 time ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -- click --------------------------------------------------------------------------------------
|
// -- click --------------------------------------------------------------------------------------
|
||||||
if ( inRange( time.w, 64.0 * BEAT, SECTION_NEURO - 16.0 * BEAT ) ) {
|
if ( inRange( time.w, SECTION_BEGIN + 64.0 * BEAT, SECTION_NEURO - 16.0 * BEAT ) ) {
|
||||||
float t = mod( time.x, 0.25 * BEAT );
|
float t = mod( time.x, 0.25 * BEAT );
|
||||||
vec2 w = fbm( vec2( time.w ) ) * 2.0 - 1.0;
|
vec2 w = fbm( vec2( time.w ) ) * 2.0 - 1.0;
|
||||||
dest += 0.3 * exp( -500.0 * t ) * mix( 0.3, 1.0, sidechain ) * w;
|
dest += 0.3 * exp( -500.0 * t ) * mix( 0.3, 1.0, sidechain ) * w;
|
||||||
@@ -288,14 +287,14 @@ vec2 mainAudio( vec4 time ) {
|
|||||||
|
|
||||||
// -- hihat --------------------------------------------------------------------------------------
|
// -- hihat --------------------------------------------------------------------------------------
|
||||||
if (
|
if (
|
||||||
inRange( time.w, 64.0 * BEAT, SECTION_NEURO )
|
inRange( time.w, SECTION_BEGIN + 64.0 * BEAT, SECTION_NEURO )
|
||||||
) {
|
) {
|
||||||
float t = mod( time.x, 0.5 * BEAT );
|
float t = mod( time.x, 0.5 * BEAT );
|
||||||
dest += 0.03 * mix( 0.3, 1.0, sidechain ) * hihat2( 2.0 * t, 50.0 );
|
dest += 0.03 * mix( 0.3, 1.0, sidechain ) * hihat2( 2.0 * t, 50.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- longclap -----------------------------------------------------------------------------------
|
// -- longclap -----------------------------------------------------------------------------------
|
||||||
if ( inRange( time.w, 67.0 * BEAT, SECTION_NEURO - 17.0 * BEAT ) ) {
|
if ( inRange( time.w, SECTION_BEGIN + 67.0 * BEAT, SECTION_NEURO - 17.0 * BEAT ) ) {
|
||||||
float t = mod( time.y - 3.0 * BEAT, 4.0 * BEAT );
|
float t = mod( time.y - 3.0 * BEAT, 4.0 * BEAT );
|
||||||
// float t = mod( time.z - 2.0 * BEAT, 4.0 * BEAT );
|
// float t = mod( time.z - 2.0 * BEAT, 4.0 * BEAT );
|
||||||
dest += 0.1 * longclap( t, time.w );
|
dest += 0.1 * longclap( t, time.w );
|
||||||
@@ -306,10 +305,10 @@ vec2 mainAudio( vec4 time ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -- pad ----------------------------------------------------------------------------------------
|
// -- pad ----------------------------------------------------------------------------------------
|
||||||
if ( inRange( time.w, 0.0, SECTION_NEURO ) ) {
|
if ( inRange( time.w, SECTION_BEGIN, SECTION_NEURO ) ) {
|
||||||
vec2 sum = vec2( 0.0 );
|
vec2 sum = vec2( 0.0 );
|
||||||
|
|
||||||
float ph = lofi( time.w, 0.5 * BEAT ) / SECTION_NEURO;
|
float ph = lofi( time.w - SECTION_BEGIN, 0.5 * BEAT ) / SECTION_NEURO;
|
||||||
float tb = lofi( time.z, 0.5 * BEAT );
|
float tb = lofi( time.z, 0.5 * BEAT );
|
||||||
float t = time.z - tb;
|
float t = time.z - tb;
|
||||||
float rev = 0.02 * exp( -8.0 * t );
|
float rev = 0.02 * exp( -8.0 * t );
|
||||||
@@ -323,10 +322,10 @@ vec2 mainAudio( vec4 time ) {
|
|||||||
sum += 0.1 * inRangeSmooth( t, 0.0, 0.48 * BEAT, 1E3 ) * wavetable( phase, radius, vec2( 0.3 * float( i ) ) );
|
sum += 0.1 * inRangeSmooth( t, 0.0, 0.48 * BEAT, 1E3 ) * wavetable( phase, radius, vec2( 0.3 * float( i ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( inRange( time.w, 64.0 * BEAT, SECTION_NEURO ) ) {
|
if ( inRange( time.w, SECTION_BEGIN + 64.0 * BEAT, SECTION_NEURO ) ) {
|
||||||
for ( int i = 0; i < 7; i ++ ) {
|
for ( int i = 0; i < 7; i ++ ) {
|
||||||
float rate = n2r( float( chordsA[ i ] ) ) * 0.5;
|
float rate = n2r( float( chordsA[ i ] ) ) * 0.5;
|
||||||
sum += 0.1 * choir( ( time.w - 64.0 * BEAT ) * rate * 0.5 );
|
sum += 0.1 * choir( time.z * rate * 0.5 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user