JSON Audio Sprite Data Exporter

Audio software developers forum.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Kitsune
Posts: 6
Joined: Tue Jan 26, 2021 6:05 pm
Operating System: Windows 10

JSON Audio Sprite Data Exporter

Post by Kitsune » Tue Jan 26, 2021 6:18 pm

Hi there, I’m working on audio sprites and would like to use Software to automate the data exportation process.

I’m not very familiar with Audacity nor Nyquist so please correct me if I am wrong or when there is a better way :}

The data structure it would look like this

Code: Select all

"sheetName":{
   "spriteName":{
      [{"startTime": 0, "endTime": 3}]
   }
}
Hopefully that’s valid JSON

Sheet name
- Sprite name
- Splice data

(There might be a lot of Splice data in one Sprite that is why it’s an array)

Kitsune
Posts: 6
Joined: Tue Jan 26, 2021 6:05 pm
Operating System: Windows 10

Re: JSON Audio Sprite Data Export

Post by Kitsune » Tue Jan 26, 2021 6:35 pm

I forgot to include other details

A Sprite Sheet is the entire Audio file
A Sprite is a group of related Sounds
A Splice contains data (startTime and endTime)

I am thinking that it could be a good option to use region label for Sprites and point label for Splices

If there is always a 1 second gap between each Splice and a 2 second gab between each Sprite it would be easy to tell them apart


I am familiar with lua so if you could point me to the right direction I can probably write my own software for this

steve
Site Admin
Posts: 81227
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: JSON Audio Sprite Data Exporter

Post by steve » Tue Jan 26, 2021 7:01 pm

Kitsune wrote:
Tue Jan 26, 2021 6:18 pm
Hopefully that’s valid JSON
It isn't ;)

Perhaps you mean:

Code: Select all

{
   "sheetName": [
      {
         "spriteName": [
            {
               "startTime": 0,
               "endTime": 3
            }
         ]
      }
   ]
}
Kitsune wrote:
Tue Jan 26, 2021 6:35 pm
I am thinking that it could be a good option to use region label for Sprites and point label for Splices
I don't understand where Audacity fits in. What do you want Audacity to do?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Kitsune
Posts: 6
Joined: Tue Jan 26, 2021 6:05 pm
Operating System: Windows 10

Re: JSON Audio Sprite Data Exporter

Post by Kitsune » Tue Jan 26, 2021 9:11 pm

I want to use Audacity to visually label each Sprite and Splice and then use a plugin to read that data then export it as a JSON file

steve
Site Admin
Posts: 81227
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: JSON Audio Sprite Data Exporter

Post by steve » Tue Jan 26, 2021 11:21 pm

Kitsune wrote:
Tue Jan 26, 2021 6:35 pm
I am familiar with lua so if you could point me to the right direction I can probably write my own software for this
If you had a list of "Splice times" like this:

Code: Select all

0.000000	2.890884	
7.151746	11.261678	
19.504762	31.021859	
42.353197	53.963175	
63.529796	69.845624	

would that be sufficient to allow you to write a lua script to generate your JSON?

The above example was created by exporting a label track that contained 5 "region labels".
See: https://manual.audacityteam.org/man/label_tracks.html and https://manual.audacityteam.org/man/imp ... abels.html
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Kitsune
Posts: 6
Joined: Tue Jan 26, 2021 6:05 pm
Operating System: Windows 10

Re: JSON Audio Sprite Data Exporter

Post by Kitsune » Wed Jan 27, 2021 12:49 am

I’d still need the Sprite name and Sheet name to construct the data

The JSON data would be converted into a Lua table
19E55843-D922-47CC-AA87-816A0B04DB66.jpeg
19E55843-D922-47CC-AA87-816A0B04DB66.jpeg (337.84 KiB) Viewed 1299 times
Something like that

steve
Site Admin
Posts: 81227
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: JSON Audio Sprite Data Exporter

Post by steve » Wed Jan 27, 2021 9:38 am

Kitsune wrote:
Wed Jan 27, 2021 12:49 am
I’d still need the Sprite name and Sheet name
What determines those names?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Kitsune
Posts: 6
Joined: Tue Jan 26, 2021 6:05 pm
Operating System: Windows 10

Re: JSON Audio Sprite Data Exporter

Post by Kitsune » Wed Jan 27, 2021 9:45 am

Would probably use region label for Sprites and point label for Splices?

I’m not sure if you can assign text to labels but I’d assume so

steve
Site Admin
Posts: 81227
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: JSON Audio Sprite Data Exporter

Post by steve » Wed Jan 27, 2021 10:32 am

Kitsune wrote:
Wed Jan 27, 2021 9:45 am
I’m not sure if you can assign text to labels
Yes you can. See the links to the manual that I posted previously.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Kitsune
Posts: 6
Joined: Tue Jan 26, 2021 6:05 pm
Operating System: Windows 10

Re: JSON Audio Sprite Data Exporter

Post by Kitsune » Fri Jan 29, 2021 2:12 am

I see that is a very useful feature, thank you for pointing it out!!

It is nice that I can export the start time and end time of each region label, however is there a way their names could also be exported as well?
Or maybe read by another program as a project file and then export the data as a Lua file?

The track name or file name would be the Sheet name, -> file name
Each Point Label would be the Sprite name, -> Contains Splices
Each Region Label would contain Splice data, -> start and end time

While the default export format is helpful it still requires human input which I would like to avoid, however if this isn’t possible then it’s fine.

Post Reply