diff --git a/.DS_Store b/.DS_Store index 5008ddf..bcd480f 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/day_1/.DS_Store b/day_1/.DS_Store index 872ab86..dca9e37 100644 Binary files a/day_1/.DS_Store and b/day_1/.DS_Store differ diff --git a/day_2/.DS_Store b/day_2/.DS_Store index e605302..6fba331 100644 Binary files a/day_2/.DS_Store and b/day_2/.DS_Store differ diff --git a/day_2/day_2_programming_examples.zip b/day_2/day_2_programming_examples.zip index 5b07d0e..8a339e8 100644 Binary files a/day_2/day_2_programming_examples.zip and b/day_2/day_2_programming_examples.zip differ diff --git a/day_2/programming-examples/example-1-rotation/js/script.js b/day_2/programming-examples/example-1-rotation/js/script.js index fac0ca4..4e698f8 100644 --- a/day_2/programming-examples/example-1-rotation/js/script.js +++ b/day_2/programming-examples/example-1-rotation/js/script.js @@ -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; diff --git a/day_2/programming-examples/example-2-selected-letters/js/script.js b/day_2/programming-examples/example-2-selected-letters/js/script.js index 99d7717..bf6938d 100644 --- a/day_2/programming-examples/example-2-selected-letters/js/script.js +++ b/day_2/programming-examples/example-2-selected-letters/js/script.js @@ -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; diff --git a/day_2/programming-examples/example-3-selected-words/js/script.js b/day_2/programming-examples/example-3-selected-words/js/script.js index 1888f40..141b41f 100644 --- a/day_2/programming-examples/example-3-selected-words/js/script.js +++ b/day_2/programming-examples/example-3-selected-words/js/script.js @@ -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; diff --git a/day_3/.DS_Store b/day_3/.DS_Store index e2c5b54..5170395 100644 Binary files a/day_3/.DS_Store and b/day_3/.DS_Store differ