Skip to content

Make Input Whitespace Independent #1

@AEFeinstein

Description

@AEFeinstein

The following to RTTTL strings are identical, except the first has spaces and the second does not. When playing on https://adamonsoon.github.io/rtttl-play/ the first will be too slow as it seems to ignore the eighth note default (d=8).

TitleScreen: d=8,o=5,b=376: c6, g4, p, g, e4, f, c, g4, c6, e4, p, g, g4, f, c, e4, c6, g4, p, g, e4, f, c, g4, c6, e4, p, g, g4, f, c, e4, a#, g#4, p, g, d#4, d#, d, g#4, a#, d#4, p, g, g#4, d#, d, d#4, a#, g#4, p, g, d#4, d#, d, g#4, a#, d#4, p, g, g#4, d#, d, d#4, g#, f4, p, g, c4, d#, c, f4, g#, c4, p, g, f4, d#, c, c4, g#, f4, p, g, c4, d#, c, f4, g#, c4, p, g, f4, d#, c, c4, a#, f4, p, g, d4, f, d, f4, a#, d4, p, g, f4, f, d, d4, a#, f4, p, g, d4, f, d, f4, a#, d4, p, g, f4, f, d, d4
TitleScreen:d=8,o=5,b=376:c6,g4,p,g,e4,f,c,g4,c6,e4,p,g,g4,f,c,e4,c6,g4,p,g,e4,f,c,g4,c6,e4,p,g,g4,f,c,e4,a#,g#4,p,g,d#4,d#,d,g#4,a#,d#4,p,g,g#4,d#,d,d#4,a#,g#4,p,g,d#4,d#,d,g#4,a#,d#4,p,g,g#4,d#,d,d#4,g#,f4,p,g,c4,d#,c,f4,g#,c4,p,g,f4,d#,c,c4,g#,f4,p,g,c4,d#,c,f4,g#,c4,p,g,f4,d#,c,c4,a#,f4,p,g,d4,f,d,f4,a#,d4,p,g,f4,f,d,d4,a#,f4,p,g,d4,f,d,f4,a#,d4,p,g,f4,f,d,d4

I don't think the RTTTL spec mentions whitespace, but I would expect these two inputs to play the same song. I believe the simple solution is to strip all whitespace from the input string before parsing. I can try to write that if you want, but I'm an embedded C programmer and have no JS experience.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions