diff --git a/apps/mobile/app/(app)/(tabs)/home/settings.tsx b/apps/mobile/app/(app)/(tabs)/home/settings.tsx index 4118351..ce05edb 100644 --- a/apps/mobile/app/(app)/(tabs)/home/settings.tsx +++ b/apps/mobile/app/(app)/(tabs)/home/settings.tsx @@ -450,9 +450,10 @@ function QualitySection({ user }: { user: CurrentUser }) { /** Shades of the text color, faintest for the smallest files. */ const QUALITY_OPACITY: Record = { - medium: 0.25, - high: 0.45, - lossless: 0.7, + low: 0.2, + medium: 0.35, + high: 0.5, + lossless: 0.75, atmos: 1, } diff --git a/apps/web/components/downloads-settings.tsx b/apps/web/components/downloads-settings.tsx index 9c0faa2..8dac6d2 100644 --- a/apps/web/components/downloads-settings.tsx +++ b/apps/web/components/downloads-settings.tsx @@ -39,9 +39,10 @@ const ASK_EVERY_TIME = "ask" /** Shades of the text color, darkest for the smallest files. */ const QUALITY_OPACITY: Record = { - medium: 0.25, - high: 0.45, - lossless: 0.7, + low: 0.2, + medium: 0.35, + high: 0.5, + lossless: 0.75, atmos: 1, } diff --git a/packages/convex/download-quality.ts b/packages/convex/download-quality.ts index b7b32d9..8f7318e 100644 --- a/packages/convex/download-quality.ts +++ b/packages/convex/download-quality.ts @@ -2,6 +2,7 @@ import type { PlaybackSource, PlaybackStreamPlan } from "./playback-stream" /** Qualities a listener can pick when downloading, lowest first. */ export const DOWNLOAD_QUALITIES = [ + "low", "medium", "high", "lossless", @@ -11,6 +12,7 @@ export const DOWNLOAD_QUALITIES = [ export type DownloadQuality = (typeof DOWNLOAD_QUALITIES)[number] export const DOWNLOAD_QUALITY_LABELS: Record = { + low: "Low", medium: "Medium", high: "High", lossless: "Lossless", @@ -18,12 +20,14 @@ export const DOWNLOAD_QUALITY_LABELS: Record = { } export const DOWNLOAD_QUALITY_DETAILS: Record = { + low: "AAC 64 kbps", medium: "AAC 128 kbps", high: "AAC 256 kbps", lossless: "ALAC or FLAC", atmos: "Spatial audio", } +const LOW_KBPS = 64 const MEDIUM_KBPS = 128 const HIGH_KBPS = 256 @@ -54,13 +58,14 @@ function highPlan(files: Record): DownloadPlan { /** * Picks the file for one song. Lossless and Dolby Atmos fall back to High when - * the song lacks them, and Medium is always transcoded. + * the song lacks them, and Low and Medium are always transcoded. */ export function downloadPlan( files: Record, quality: DownloadQuality ): DownloadPlan { switch (quality) { + case "low": case "medium": return { quality, @@ -70,7 +75,7 @@ export function downloadPlan( : "normal" in files ? "normal" : "atmos", - kbps: MEDIUM_KBPS, + kbps: quality === "low" ? LOW_KBPS : MEDIUM_KBPS, } case "high": return highPlan(files) @@ -84,7 +89,7 @@ export function downloadPlan( /** * The download quality holding the same audio a stream plan plays, so a - * download can stand in for streaming. Low has no download equivalent. + * download can stand in for streaming. */ export function streamDownloadQuality( plan: PlaybackStreamPlan @@ -95,6 +100,7 @@ export function streamDownloadQuality( } if (plan.kbps === HIGH_KBPS) return "high" if (plan.kbps === MEDIUM_KBPS) return "medium" + if (plan.kbps === LOW_KBPS) return "low" return undefined } @@ -129,6 +135,7 @@ export function downloadOptions( ).length if ( fallbackCount === songs.length && + quality !== "low" && quality !== "medium" && quality !== "high" ) {