changed stuff for day2 mostly
This commit is contained in:
parent
4c375678b5
commit
acecdd72e0
8 changed files with 8 additions and 16 deletions
BIN
.DS_Store
vendored
BIN
.DS_Store
vendored
Binary file not shown.
BIN
day_1/.DS_Store
vendored
BIN
day_1/.DS_Store
vendored
Binary file not shown.
BIN
day_2/.DS_Store
vendored
BIN
day_2/.DS_Store
vendored
Binary file not shown.
Binary file not shown.
|
@ -61,12 +61,7 @@ function audioReaction(){
|
|||
function updateText() {
|
||||
analyser.getByteFrequencyData(dataArray);
|
||||
const sampleRate = audioContext.sampleRate;
|
||||
const pitch = calculatePitch(dataArray, sampleRate);
|
||||
console.log('Detected Pitch:', pitch, 'Hz');
|
||||
|
||||
const currentTime = audioElement.currentTime;
|
||||
const audioPositionPercentage = currentTime / audioDuration;
|
||||
const mappedIndex = Math.floor(audioPositionPercentage * textLength);
|
||||
const volume = Math.sqrt(
|
||||
dataArray.reduce((acc, val) => acc + val * val, 0) / dataArray.length
|
||||
);
|
||||
|
@ -80,6 +75,7 @@ function audioReaction(){
|
|||
|
||||
const minimumBoldness = 15;
|
||||
const maximumBoldness = 257;
|
||||
|
||||
const minimumRotation = -180;
|
||||
const maximumRotation = 180;
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ function audioReaction(){
|
|||
function calculatePitch(dataArray, sampleRate) {
|
||||
const minFrequency = 80; // Minimum expected frequency in Hz
|
||||
const maxFrequency = 1000; // Maximum expected frequency in Hz
|
||||
|
||||
const minPeriod = Math.floor(sampleRate / maxFrequency);
|
||||
const maxPeriod = Math.floor(sampleRate / minFrequency);
|
||||
|
||||
|
@ -61,12 +62,7 @@ function audioReaction(){
|
|||
function updateText() {
|
||||
analyser.getByteFrequencyData(dataArray);
|
||||
const sampleRate = audioContext.sampleRate;
|
||||
const pitch = calculatePitch(dataArray, sampleRate);
|
||||
console.log('Detected Pitch:', pitch, 'Hz');
|
||||
|
||||
const currentTime = audioElement.currentTime;
|
||||
const audioPositionPercentage = currentTime / audioDuration;
|
||||
const mappedIndex = Math.floor(audioPositionPercentage * textLength);
|
||||
const volume = Math.sqrt(
|
||||
dataArray.reduce((acc, val) => acc + val * val, 0) / dataArray.length
|
||||
);
|
||||
|
@ -84,6 +80,7 @@ function audioReaction(){
|
|||
|
||||
const minimumBoldness = 15;
|
||||
const maximumBoldness = 257;
|
||||
|
||||
const minimumRotation = -180;
|
||||
const maximumRotation = 180;
|
||||
|
||||
|
|
|
@ -62,11 +62,7 @@ function audioReaction(){
|
|||
analyser.getByteFrequencyData(dataArray);
|
||||
const sampleRate = audioContext.sampleRate;
|
||||
const pitch = calculatePitch(dataArray, sampleRate);
|
||||
console.log('Detected Pitch:', pitch, 'Hz');
|
||||
|
||||
const currentTime = audioElement.currentTime;
|
||||
const audioPositionPercentage = currentTime / audioDuration;
|
||||
const mappedIndex = Math.floor(audioPositionPercentage * textLength);
|
||||
const volume = Math.sqrt(
|
||||
dataArray.reduce((acc, val) => acc + val * val, 0) / dataArray.length
|
||||
);
|
||||
|
@ -79,6 +75,7 @@ function audioReaction(){
|
|||
|
||||
const minimumVolume = 0;
|
||||
const maximumVolume = dataArray.length;
|
||||
|
||||
const minimumPitch = 10;
|
||||
const maximumPitch = 300;
|
||||
|
||||
|
@ -86,8 +83,10 @@ function audioReaction(){
|
|||
|
||||
const minimumBoldness = 15;
|
||||
const maximumBoldness = 257;
|
||||
|
||||
const minimumRotation = -80;
|
||||
const maximumRotation = 80;
|
||||
|
||||
const minimumScale = 1;
|
||||
const maximumScale = 1.1;
|
||||
|
||||
|
|
BIN
day_3/.DS_Store
vendored
BIN
day_3/.DS_Store
vendored
Binary file not shown.
Loading…
Reference in a new issue