Add a soprano recorder tab converter as a Linux AppImage.
The app turns a lead line into Baroque fingering tabs with rhythm kept, ships Twinkle and Ode to Joy, and reads photos locally with oemer when the bundled Python is present. Co-authored-by: catpersonisme <catpersonisme@gmail.com>
This commit is contained in:
55 files changed
+17536
No files matched your search
@@ -0,0 +1,52 @@
|
||||
import { connection } from "next/server";
|
||||
import { recognizeImage, recognizerInfo } from "@/lib/recognize";
|
||||
|
||||
const TYPES = new Set(["image/png", "image/jpeg", "image/webp"]);
|
||||
|
||||
export async function GET() {
|
||||
await connection();
|
||||
return Response.json(recognizerInfo());
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
let form: FormData;
|
||||
try {
|
||||
form = await request.formData();
|
||||
} catch {
|
||||
return Response.json({ error: "The upload could not be read. No notes were invented." }, { status: 400 });
|
||||
}
|
||||
|
||||
const image = form.get("image");
|
||||
if (!(image instanceof File)) {
|
||||
return Response.json({ error: "Choose a PNG, JPG, or WEBP image first." }, { status: 400 });
|
||||
}
|
||||
if (image.size === 0) {
|
||||
return Response.json(
|
||||
{ error: "That file is empty. No notes were invented." },
|
||||
{ status: 400 },
|
||||
);
|
||||
}
|
||||
const named = /\.(png|jpe?g|webp)$/i.test(image.name);
|
||||
if (image.type && !TYPES.has(image.type) && !named) {
|
||||
return Response.json(
|
||||
{ error: "Use a PNG, JPG, or WEBP photo. That file is not one of those. No notes were invented." },
|
||||
{ status: 415 },
|
||||
);
|
||||
}
|
||||
if (image.size > 8 * 1024 * 1024) {
|
||||
return Response.json(
|
||||
{ error: "That image is over 8 MB. Crop the line or export a smaller JPEG." },
|
||||
{ status: 413 },
|
||||
);
|
||||
}
|
||||
|
||||
const result = await recognizeImage(image);
|
||||
if (!result.ok) {
|
||||
return Response.json({ error: result.error, recognizer: result.recognizer }, { status: result.status });
|
||||
}
|
||||
return Response.json({
|
||||
score: result.score,
|
||||
warnings: result.warnings,
|
||||
recognizer: result.recognizer,
|
||||
});
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,130 @@
|
||||
@import "tailwindcss";
|
||||
@import "tw-animate-css";
|
||||
@import "shadcn/tailwind.css";
|
||||
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--font-sans: var(--font-source);
|
||||
--font-mono: var(--font-geist-mono);
|
||||
--font-heading: var(--font-display);
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
--color-sidebar-accent: var(--sidebar-accent);
|
||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||
--color-sidebar-primary: var(--sidebar-primary);
|
||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||
--color-sidebar: var(--sidebar);
|
||||
--color-chart-5: var(--chart-5);
|
||||
--color-chart-4: var(--chart-4);
|
||||
--color-chart-3: var(--chart-3);
|
||||
--color-chart-2: var(--chart-2);
|
||||
--color-chart-1: var(--chart-1);
|
||||
--color-ring: var(--ring);
|
||||
--color-input: var(--input);
|
||||
--color-border: var(--border);
|
||||
--color-destructive: var(--destructive);
|
||||
--color-accent-foreground: var(--accent-foreground);
|
||||
--color-accent: var(--accent);
|
||||
--color-muted-foreground: var(--muted-foreground);
|
||||
--color-muted: var(--muted);
|
||||
--color-secondary-foreground: var(--secondary-foreground);
|
||||
--color-secondary: var(--secondary);
|
||||
--color-primary-foreground: var(--primary-foreground);
|
||||
--color-primary: var(--primary);
|
||||
--color-popover-foreground: var(--popover-foreground);
|
||||
--color-popover: var(--popover);
|
||||
--color-card-foreground: var(--card-foreground);
|
||||
--color-card: var(--card);
|
||||
--radius-sm: calc(var(--radius) * 0.6);
|
||||
--radius-md: calc(var(--radius) * 0.8);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) * 1.4);
|
||||
--radius-2xl: calc(var(--radius) * 1.8);
|
||||
--radius-3xl: calc(var(--radius) * 2.2);
|
||||
--radius-4xl: calc(var(--radius) * 2.6);
|
||||
}
|
||||
|
||||
:root {
|
||||
--background: oklch(0.955 0.02 85);
|
||||
--foreground: oklch(0.27 0.03 55);
|
||||
--card: oklch(0.985 0.012 92);
|
||||
--card-foreground: oklch(0.27 0.03 55);
|
||||
--popover: oklch(0.985 0.012 92);
|
||||
--popover-foreground: oklch(0.27 0.03 55);
|
||||
--primary: oklch(0.42 0.07 48);
|
||||
--primary-foreground: oklch(0.98 0.01 90);
|
||||
--secondary: oklch(0.93 0.02 85);
|
||||
--secondary-foreground: oklch(0.32 0.04 50);
|
||||
--muted: oklch(0.94 0.015 85);
|
||||
--muted-foreground: oklch(0.45 0.03 55);
|
||||
--accent: oklch(0.9 0.035 150);
|
||||
--accent-foreground: oklch(0.28 0.04 155);
|
||||
--destructive: oklch(0.5 0.16 28);
|
||||
--border: oklch(0.86 0.025 75);
|
||||
--input: oklch(0.86 0.025 75);
|
||||
--ring: oklch(0.55 0.07 48);
|
||||
--chart-1: oklch(0.87 0 0);
|
||||
--chart-2: oklch(0.556 0 0);
|
||||
--chart-3: oklch(0.439 0 0);
|
||||
--chart-4: oklch(0.371 0 0);
|
||||
--chart-5: oklch(0.269 0 0);
|
||||
--radius: 0.8rem;
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.145 0 0);
|
||||
--sidebar-primary: oklch(0.205 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.145 0 0);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.205 0 0);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.205 0 0);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.922 0 0);
|
||||
--primary-foreground: oklch(0.205 0 0);
|
||||
--secondary: oklch(0.269 0 0);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.269 0 0);
|
||||
--muted-foreground: oklch(0.708 0 0);
|
||||
--accent: oklch(0.269 0 0);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.556 0 0);
|
||||
--chart-1: oklch(0.87 0 0);
|
||||
--chart-2: oklch(0.556 0 0);
|
||||
--chart-3: oklch(0.439 0 0);
|
||||
--chart-4: oklch(0.371 0 0);
|
||||
--chart-5: oklch(0.269 0 0);
|
||||
--sidebar: oklch(0.205 0 0);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.556 0 0);
|
||||
}
|
||||
|
||||
@layer base {
|
||||
* {
|
||||
@apply border-border outline-ring/50;
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
html {
|
||||
@apply font-sans;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Fraunces, Source_Sans_3 } from "next/font/google";
|
||||
import { Toaster } from "@/components/ui/sonner";
|
||||
import "./globals.css";
|
||||
|
||||
const sans = Source_Sans_3({
|
||||
subsets: ["latin"],
|
||||
variable: "--font-source",
|
||||
weight: ["400", "500", "600", "700"],
|
||||
});
|
||||
|
||||
const display = Fraunces({
|
||||
subsets: ["latin"],
|
||||
variable: "--font-display",
|
||||
weight: ["500", "600", "700"],
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Recorder Tab Converter",
|
||||
description:
|
||||
"Turn a lead melody into soprano recorder fingering tabs, with rhythm, rests, and bar lines kept.",
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }: LayoutProps<"/">) {
|
||||
return (
|
||||
<html lang="en" className={`${sans.variable} ${display.variable} h-full antialiased`}>
|
||||
<body className="min-h-full flex flex-col font-sans">
|
||||
{children}
|
||||
<Toaster />
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Converter } from "@/components/converter";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<main>
|
||||
<Converter />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user