Skip to content

Commit

Permalink
Corrupted MIDI files can also be loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
BShakhovsky committed May 8, 2021
1 parent e30b176 commit 1df899a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
Binary file modified Keyboard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions Piano/MidiParser.cpp
Expand Up @@ -14,10 +14,19 @@ MidiParser::MidiParser(LPCTSTR fileName) : lastTime_(0), milliSeconds_(0)
File::getCurrentWorkingDirectory().getChildFile(String(fileName)).getFullPathName());
if (inputFile.failedToOpen())
throw MidiError((wstring(TEXT("Could not open file:\r\n")) + fileName).c_str());
if (!midi_.readFrom(inputFile))
throw MidiError((wstring(TEXT("Not a MIDI-file:\r\n")) + fileName).c_str());
const auto midiIsOk(midi_.readFrom(inputFile));
if (!midiIsOk) log_.append(wstring(TEXT("WARNING: This MIDI-file may be corrupted\r\n")));

Parse();
if (!midiIsOk)
{
if (Piano::notes.empty())
{
assert(Piano::milliSeconds.empty() && Piano::percussions.empty());
throw MidiError((wstring(TEXT("Not a MIDI-file:\r\n")) + fileName).c_str());
}
assert(!"Corrupted MIDI-file");
}
}

void MidiParser::ParseKeySignatureMetaEvent()
Expand Down
Binary file modified Piano/Piano.rc
Binary file not shown.
4 changes: 2 additions & 2 deletions Piano/Piano.vcxproj
Expand Up @@ -38,7 +38,7 @@
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseIntelMKL>Parallel</UseIntelMKL>
<UseInteloneMKL>Parallel</UseInteloneMKL>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
Expand All @@ -52,7 +52,7 @@
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseIntelMKL>Parallel</UseIntelMKL>
<UseInteloneMKL>Parallel</UseInteloneMKL>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
Expand Down
7 changes: 5 additions & 2 deletions PianoTranscription3D.sln
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
# Visual Studio Version 16
VisualStudioVersion = 16.0.31220.234
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Piano", "Piano\Piano.vcxproj", "{44BEE791-5D97-4AA4-B0FE-DEA29C8413C4}"
EndProject
Expand All @@ -25,4 +25,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CD51AF27-6EC9-4A2D-9CE5-01BA2D34D109}
EndGlobalSection
EndGlobal
4 changes: 3 additions & 1 deletion README.md
Expand Up @@ -8,6 +8,8 @@ or get it on Google Play:

[![](https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png 'Get it on Google Play')](https://play.google.com/store/apps/details?id=ru.BShakhovsky.Piano_Transcription)

Android version also has the real-time transcription feature which may help you to learn the MIDI chords on your real piano. The app will recognize the notes you play and highlight them. Once you correctly play all the notes of the chord simultaneously, it will proceed to the next MIDI chord, and so on.

# Description

3D-piano, with an option of advising on which fingers to use to press each piano key, accuracy of finger numbers is around 75%.
Expand All @@ -22,7 +24,7 @@ No instrument information is extracted, and all transcribed notes get combined i

# How to Install

[Download the latest zip-archive](https://GitHub.com/BShakhovsky/PianoTranscription_Windows/releases/download/2019-06-22/PianoTranscription3D.zip)
[Download the latest zip-archive](https://GitHub.com/BShakhovsky/PianoTranscription_Windows/releases/download/2019-06-22/PianoTranscription3D.zip) ![](https://img.shields.io/github/downloads/BShakhovsky/PianoTranscription_Windows/total?logo=visual-studio&style=plastic)

No installation is required, just open file "Piano Transcription 3D.exe".

Expand Down

0 comments on commit 1df899a

Please sign in to comment.