Skip to content

Commit

Permalink
Fix title, add favicons and description for search engines
Browse files Browse the repository at this point in the history
Also make realistic breaking function easier to debug
  • Loading branch information
ArijanJ committed Aug 5, 2024
1 parent 03209e4 commit a908549
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 10 deletions.
Binary file added public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon.ico
Binary file not shown.
Binary file removed public/favicon.png
Binary file not shown.
5 changes: 3 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width,initial-scale=1'>

<title>MIDI Converter (no script)</title>
<title>MIDI Converter</title>
<meta name="description" content="Convert your MIDI files to VP sheets!">

<link rel='icon' type='image/png' href='./favicon.png'>
<link rel='icon' type='image/x-icon' href='./favicon.ico'>
<link rel='stylesheet' href='./global.css'>

<script defer src='./build/bundle.js'></script>
Expand Down
4 changes: 4 additions & 0 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,10 @@ Individual sizes are an estimation, the total is correct.">ⓘ</span>
/>
</div>
<Guide />
<hr class="mx-2 my-1">
<a target="_blank" class="underline text-white" href="https://github.com/ArijanJ/midi-converter/issues">
Suggestions, bug reports, or just need help?
</a>
</div>
<section bind:this={trackChooser.element} id="track-chooser" class="z-40 w-full absolute flex flex-col gap-4 justify-center items-center content-center text-2xl"
Expand Down
19 changes: 11 additions & 8 deletions src/utils/VP.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ function generateChords(events /* note_on, set_tempo and time_signature */, sett
}
}

const debug = false
let debug_comment = debug
? (text) => {chords.push({type: 'comment', kind: 'inline', text})}
: () => {}

let current_beat = 0
let next_beat_border = 0
function break_realistically(note, index = undefined) {
Expand All @@ -273,7 +278,7 @@ function generateChords(events /* note_on, set_tempo and time_signature */, sett
}

if (current_time_signature.scheduled_break != false) {
// chords.push({type: 'comment', kind: 'inline', text: ' <scheduled break> '})
debug_comment(' <scheduled break> ')
if(current_time_signature.scheduled_break.break !== false)
chords.push({type: 'break'})

Expand All @@ -287,7 +292,7 @@ function generateChords(events /* note_on, set_tempo and time_signature */, sett
current_beat = 0
next_beat_border += note.ticks - next_beat_border + ticks_per_beat
// console.log('starting point', next_beat_border)
// chords.push({type: 'comment', kind: 'inline', text: `<br>setting goal to ${next_beat_border}<br>`})
debug_comment(`<br>setting goal to ${next_beat_border}<br></br>`)
}

// console.log(note)
Expand All @@ -296,7 +301,7 @@ function generateChords(events /* note_on, set_tempo and time_signature */, sett
// chords.push({type: 'comment', kind: 'inline', text: `<${current_ticks}>`})

if (current_ticks >= next_beat_border) {
// chords.push({type: 'comment', kind: 'inline', text: `and a ${current_beat+1} (${current_ticks}/${next_beat_border})<br>`})
debug_comment(`and a ${current_beat+1} (${current_ticks}/${next_beat_border})`)
current_beat++
next_beat_border+=ticks_per_beat
}
Expand All @@ -305,9 +310,7 @@ function generateChords(events /* note_on, set_tempo and time_signature */, sett
// TODO: Is 4/2 handled differently?
if (current_beat == current_time_signature.numerator) {
// chords.push({type: 'comment', kind: 'inline', text: ' /bar '})
// console.log(`________ reached ${current_time_signature.numerator}`)

// chords.push({type: 'comment', kind: 'inline', text: `and a break<br>`})
debug_comment(`and a break`)
chords.push({type: 'break'})
current_beat = 0
}
Expand Down Expand Up @@ -375,15 +378,15 @@ function generateChords(events /* note_on, set_tempo and time_signature */, sett
// offset = Math.round(element.playTime * 1000 / current_time_signature.tick_resolution)
// console.log('TIME_SIGNATURE event: ', current_time_signature)
// Note comments are pushed below, so this comment will show up above the actual affected notes
// chords.push({ type: 'comment', kind: 'inline', text: `<br>(switch to ${current_time_signature.numerator}/${2**current_time_signature.denominator})<br>` })
debug_comment(`<br>(switch to ${current_time_signature.numerator}/${2**current_time_signature.denominator})<br>`)
return

case MIDIEvents.EVENT_META_SET_TEMPO:
set_time_signature(element)
current_time_signature.scheduled_break = { break: false }
// current_bar++
// console.log('new TEMPO event: ', current_time_signature)
// chords.push({ type: 'comment', kind: 'inline', text: '<new tempo>' })
debug_comment(` <new tempo: ${current_time_signature.numerator}/${2 ** current_time_signature.denominator}>`)

nextTempo = element.tempo
nextBPM = element.tempoBPM
Expand Down

0 comments on commit a908549

Please sign in to comment.