Afinador On-Line
Guitar Tuner from GTDB gtdb.org
Stop
https://code.jquery.com/jquery-2.2.3.min.js
$(window).on('resize load', function(e) {
var width1 = document.getElementById('btn-74950-1').offsetWidth;
let btn1 = document.querySelector('#btn-74950-1');
btn1.style.height = width1 + "px";
// var width1 = document.getElementById('btn1').offsetWidth;
document.querySelector('#btn-74950-1').style.height = width1 + "px";
document.querySelector('#btn-74950-2').style.height = width1 + "px";
document.querySelector('#btn-74950-3').style.height = width1 + "px";
document.querySelector('#btn-74950-4').style.height = width1 + "px";
document.querySelector('#btn-74950-5').style.height = width1 + "px";
document.querySelector('#btn-74950-6').style.height = width1 + "px";
if (document.querySelector('#btn-74950-7')) {
document.querySelector('#btn-74950-7').style.height = width1 + "px";
}
if (document.querySelector('#btn-74950-8')) {
document.querySelector('#btn-74950-8').style.height = width1 + "px";
}
if (document.querySelector('#btn-74950-9')) {
document.querySelector('#btn-74950-9').style.height = width1 + "px";
}
});
var $ = jQuery.noConflict();
// Make buttons stop audio and go to zero on click
$('.play74950').click(function() {
var $this74950 = $(this);
var id74950 = "";
id74950 = $this74950.attr('id').replace(/btn-74950-/, '');
// console.log(this);
$this74950.toggleClass('active');
if ($this74950.hasClass('active')) {
//$this.text('stop');
$('audio[id^="sound-74950-"]')[id74950 - 1].play();
} else {
//$this.text('play');
$('audio[id^="sound-74950-"]')[id74950 - 1].pause();
$('audio[id^="sound-74950-"]')[id74950 - 1].currentTime = 0;
}
});
function stopTheBugger74950() {
let playings = document.querySelectorAll('.playing74950');
let main_tuner_buttons = document.querySelectorAll('.main_tuner_button74950');
for(main_tuner_button of main_tuner_buttons) {
main_tuner_button.classList.remove('active');
}
for(playing of playings) {
playing.pause();
playing.currentTime = 0;
}
}
function strumTheBugger74950() {
let tuning_link = '';
// Strum tuning
var strummers = null;
// get all strummable notes
strummers = document.querySelectorAll('.main_tuner_button74950');
// convert nbodelist to array to enable sorting
var strumArray = Array.prototype.slice.call(strummers);
// order array after from string 9 to string 1
strumArray = strumArray.sort((a, b) => parseFloat(a.dataset.order) - parseFloat(b.dataset.order));
// console.log(bugger);
// strummers = $('.active_map_string');
var strum_length = 100;
// console.log(strummers);
var mp3 = {};
for (let i = 0; i < strumArray.length; i++) {
setTimeout(function () {
// console.log(strumArray[i].dataset.mp3);
mp3[i] = strumArray[i].dataset.mp3;
mp3[i] = mp3[i].replace(/#/g, "s");
tuning_link = tuning_link + " " + mp3[i].replace(/[0-9]/g, '').toLowerCase();
// console.log(tuning_link);
var audio = new Audio(`/wp-content/plugins/guitar-tuner/sounds/${mp3[i]}.mp3`);
audio.loop = false;
audio.volume = 0.8;
audio.play();
// console.log(strumArray[i].innerText + " String number " + strumArray[i].dataset.string);
}, strum_length / 1.5);
strum_length = strum_length + 100;
}
// console.log(tuning_link);
}