Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New option to always play kana sounds #5

Open
vedxyz opened this issue Apr 11, 2023 · 2 comments
Open

New option to always play kana sounds #5

vedxyz opened this issue Apr 11, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@vedxyz
Copy link
Owner

vedxyz commented Apr 11, 2023

Moving this comment here since it's now unrelated to the bug issue it was initially under.


I'd like to have the option to let the kana sound always play before each reply/answer. Or to have the stroke order always show. But perhaps we can have both.

Currently, as a workaround, I use a userscript just for the strokes. And its far from perfect, it's the first time I created one. And at the time, I use it for https://djtguide.neocities.org/kana/ which is pretty similar.

(function() {
    'use strict';

 document.getElementById('input_box').addEventListener('input', function() {
        document.getElementById('tool_stroke').click();
 });
})();

I propose to add two CheckBox in "FreePracticeOptions.tsx" and "BruteForcePracticeOptions.tsx" or all other relevant mode options
toggleState is at that moment just a placeholder.

          checked={toggleState}
          onChange={() => setToggleState(!toggleState)}
          label="Always play sound"
        />
           <Checkbox
          checked={toggleState}
          onChange={() => setToggleState(!toggleState)}
          label="Always show stroke order"
        />
      </Container>

Originally posted by @zDEFz in #4 (comment)

@vedxyz vedxyz added the enhancement New feature or request label Apr 11, 2023
@vedxyz
Copy link
Owner Author

vedxyz commented Apr 11, 2023

Replying to @zDEFz:

Ah, now I understand. Yeah, playing sounds automatically for each kana had been suggested before elsewhere as well. I wouldn't mind adding another "General" option along the lines of "Play the sound for each kana automatically" (edit: as you've proposed), though I personally wouldn't get much use out of it since I prefer to keep rotating through the kana as fast as I can. And by that I mean 2-3 seconds per kana during the first ever attempts, then 0.5-1 seconds after that.

Consequently, I'm also not sure what the best time to play the kana would be. In your user script you have hooked to the input event, but kana romaji are only 1-3 characters long so there's not really much time (if at all) before you move onto to the next kana. Playing the sound immediately upon getting a new kana might also be weird since you're just spoiling the answer then? I couldn't really find an optimal solution last I thought about this, so the idea had gone into the backlog.

I suppose that's part of the answer to your question as to why there is a middle-ground. Having the sound play on request avoids the timing issues. What do you think is the ideal time to play the sound then? Immediately when a kana is shown? When the user begins to answer? Or some other instant?


On the other hand, stroke order is a different topic. I've opened a new issue to track that over at

which includes my current thoughts on it.

@zDEFz
Copy link

zDEFz commented Apr 11, 2023

What do you think is the ideal time to play the sound then? Immediately when a kana is shown? When the user begins to answer? Or some other instant?

It depends. If I understand the situation properly, then the audio samples have varying lengths. To avoid overlapping those samples, we at least need the longest time a audio sample is and then add half a second as buffer. Or we get the length of the audio file before playing it to estimate the delay.

function getDuration(src: string, cb: (length: number) => void) {
  const audio = new Audio();
  audio.onloadedmetadata = () => {
    cb(audio.duration);
  };
  audio.src = src;
}

getDuration("https://www.example.com/sample.mp3", (length) => {
  console.log(`The length of the mp3 sample is ${length} seconds.`);
});

Ideally, audio samples are as short as possible to get through as efficient as possible, while staying helpful enough to improve learning as well. I am new to the japanese sounds, so I want it in the beginning to memorize it better.

Playing the sound immediately upon getting a new kana might also be weird since you're just spoiling the answer then?

Pronouncing the solution is not automatically leading the user to enter the correct answer. There are some slight differences, but it is of utmost importance to learn those as well. They may not be required when in muscle memory, though.

Pronouncing itself would be something interesting. Perhaps there is already a japanese voice input engine that we could add as a tip for practicing that. We wouldn't need to do any work for that, as long as such solutions exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants