S
S
Sergey Sulakov2016-03-12 12:55:29
JavaScript
Sergey Sulakov, 2016-03-12 12:55:29

What is the best structure of sound files to make on the site?

The site has a mini-game: the terms from 1 to 2000 are randomly shown and voiced.
At the end of the game, the site visitor enters the answer.
The essence of the problem: at the moment, 10,000 sound files are stored in one /sounds/ folder (5 different formats for each of the 2000 sounds.)
For some clients, voice acting is intermittent. How likely is it that the browser/server is having a hard time finding one file to play among 10,000 files?
If so, what is the best way to organize the file structure?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Sokolov, 2016-03-12
@sergiks

10k in one folder can be a problem. I would scatter through the folder tree, say hundreds from 0 to 20, and numbers:
1234 => /12/34/ => and there are five files
0001 => /00/01/ 2000 => /20/ 00
/
I organized myself in one project with a roughly similar folder structure, but made it a little more complicated - because. the number of folders is not uniform for different root folders, I mirror the order of the bits in each number, and hit the levels by hex letters:

число  двоичное        наоборот        hex  папка
0001   0000 0000 0001  1000 0000 0000  800  /8/0/0
1234   0100 1101 0010  0100 1011 0010  4B2  /4/B/2
0173   0001 0111 0011  1100 1110 1000  CE8  /C/E/8
2000   0111 1101 0000  0000 1011 1110  0BE  /0/B/E
So in each folder level you will have no more than 16 subfolders.
Also, maybe you don't preload sounds? It is worth starting to download the sound file as soon as it becomes clear, or it is likely that you will need it. So that at the time the playback starts, the file has already been loaded.

X
xmoonlight, 2016-03-12
@xmoonlight

And why not just take and break a number, for example, "2134" into separate sounds:
"two", "thousands", "one hundred", "thirty", "four"?
When updating the number - you will load only the changed digits: "2314":
"two" "thousands" - do not load, use from the previous voice acting
"three hundred" "fourteen" - load
You can make one file broken down by timestamps and play from different tags to get the desired voice fragment of a given number.
Then you will have only 5 files!
A once cached file on the client side will no longer be loaded every time.
Check your browser for TTS support in the desired language and if possible, pronounce it instead of downloading the file.
The options are plentiful..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question