From e2cd86e48762e9396737a00c56e1d45ebfae24e3 Mon Sep 17 00:00:00 2001 From: fgwt202412 <191263616+fgwt202412@users.noreply.github.com> Date: Sun, 15 Dec 2024 13:17:00 -0500 Subject: [PATCH] Add sample rate and number of channels --- .../exportTypeScriptSchemas.test.ts.snap | 12 ++++---- internal/schemas.ts | 14 ++++++++-- ros_foxglove_msgs/ros1/CompressedAudio.msg | 8 ++++-- ros_foxglove_msgs/ros2/CompressedAudio.msg | 8 ++++-- schemas/README.md | 28 +++++++++++++++++-- schemas/flatbuffer/CompressedAudio.fbs | 8 ++++-- schemas/jsonschema/CompressedAudio.json | 12 +++++++- schemas/jsonschema/index.ts | 12 +++++++- schemas/omgidl/foxglove/CompressedAudio.idl | 8 ++++-- schemas/proto/foxglove/CompressedAudio.proto | 8 ++++-- schemas/ros1/CompressedAudio.msg | 8 ++++-- schemas/ros2/CompressedAudio.msg | 8 ++++-- schemas/typescript/CompressedAudio.ts | 12 ++++---- 13 files changed, 115 insertions(+), 31 deletions(-) diff --git a/internal/__snapshots__/exportTypeScriptSchemas.test.ts.snap b/internal/__snapshots__/exportTypeScriptSchemas.test.ts.snap index 0296c89..41aa397 100644 --- a/internal/__snapshots__/exportTypeScriptSchemas.test.ts.snap +++ b/internal/__snapshots__/exportTypeScriptSchemas.test.ts.snap @@ -247,11 +247,7 @@ export type CompressedAudio = { /** Timestamp of audio frame */ timestamp: Time; - /** - * Compressed audio frame data. - * - * TK - */ + /** Compressed audio frame data. */ data: Uint8Array; /** @@ -267,6 +263,12 @@ export type CompressedAudio = { * Supported values: \`key\`, \`delta\`. */ type: string; + + /** Number of audio samples per second. */ + sample_rate: number; + + /** Number of audio channels in the input. */ + number_of_channels: number; }; ", "CylinderPrimitive" => "// Generated by https://github.com/foxglove/schemas diff --git a/internal/schemas.ts b/internal/schemas.ts index ab01a1e..42f9ae8 100644 --- a/internal/schemas.ts +++ b/internal/schemas.ts @@ -856,9 +856,7 @@ const CompressedAudio: FoxgloveMessageSchema = { { name: "data", type: { type: "primitive", name: "bytes" }, - description: `Compressed audio frame data. - -TK`, + description: `Compressed audio frame data.`, }, { name: "format", @@ -870,6 +868,16 @@ TK`, type: { type: "primitive", name: "string" }, description: "Frame type.\n\n Supported values: `key`, `delta`.", }, + { + name: "sample_rate", + type: { type: "primitive", name: "uint32" }, + description: "Number of audio samples per second.", + }, + { + name: "number_of_channels", + type: { type: "primitive", name: "uint32" }, + description: "Number of audio channels in the input.", + }, ], }; diff --git a/ros_foxglove_msgs/ros1/CompressedAudio.msg b/ros_foxglove_msgs/ros1/CompressedAudio.msg index f9cdfc0..3680dd2 100644 --- a/ros_foxglove_msgs/ros1/CompressedAudio.msg +++ b/ros_foxglove_msgs/ros1/CompressedAudio.msg @@ -7,8 +7,6 @@ time timestamp # Compressed audio frame data. -# -# TK uint8[] data # Audio format. @@ -20,3 +18,9 @@ string format # # Supported values: `key`, `delta`. string type + +# Number of audio samples per second. +uint32 sample_rate + +# Number of audio channels in the input. +uint32 number_of_channels diff --git a/ros_foxglove_msgs/ros2/CompressedAudio.msg b/ros_foxglove_msgs/ros2/CompressedAudio.msg index 31dc397..a03030f 100644 --- a/ros_foxglove_msgs/ros2/CompressedAudio.msg +++ b/ros_foxglove_msgs/ros2/CompressedAudio.msg @@ -7,8 +7,6 @@ builtin_interfaces/Time timestamp # Compressed audio frame data. -# -# TK uint8[] data # Audio format. @@ -20,3 +18,9 @@ string format # # Supported values: `key`, `delta`. string type + +# Number of audio samples per second. +uint32 sample_rate + +# Number of audio channels in the input. +uint32 number_of_channels diff --git a/schemas/README.md b/schemas/README.md index 57b041c..0a5d1fb 100644 --- a/schemas/README.md +++ b/schemas/README.md @@ -585,8 +585,6 @@ bytes Compressed audio frame data. -TK - @@ -617,6 +615,32 @@ Frame type. Supported values: `key`, `delta`. + + + +sample_rate + + +uint32 + + + + +Number of audio samples per second. + + + + +number_of_channels + + +uint32 + + + + +Number of audio channels in the input. + diff --git a/schemas/flatbuffer/CompressedAudio.fbs b/schemas/flatbuffer/CompressedAudio.fbs index 211df16..fbee197 100644 --- a/schemas/flatbuffer/CompressedAudio.fbs +++ b/schemas/flatbuffer/CompressedAudio.fbs @@ -10,8 +10,6 @@ table CompressedAudio { timestamp:Time (id: 0); /// Compressed audio frame data. - /// - /// TK data:[uint8] (id: 1); /// Audio format. @@ -23,6 +21,12 @@ table CompressedAudio { /// /// Supported values: `key`, `delta`. type:string (id: 3); + + /// Number of audio samples per second. + sample_rate:uint32 (id: 4); + + /// Number of audio channels in the input. + number_of_channels:uint32 (id: 5); } root_type CompressedAudio; diff --git a/schemas/jsonschema/CompressedAudio.json b/schemas/jsonschema/CompressedAudio.json index c4d1274..835be23 100644 --- a/schemas/jsonschema/CompressedAudio.json +++ b/schemas/jsonschema/CompressedAudio.json @@ -23,7 +23,7 @@ "data": { "type": "string", "contentEncoding": "base64", - "description": "Compressed audio frame data.\n\nTK" + "description": "Compressed audio frame data." }, "format": { "type": "string", @@ -32,6 +32,16 @@ "type": { "type": "string", "description": "Frame type.\n\n Supported values: `key`, `delta`." + }, + "sample_rate": { + "type": "integer", + "minimum": 0, + "description": "Number of audio samples per second." + }, + "number_of_channels": { + "type": "integer", + "minimum": 0, + "description": "Number of audio channels in the input." } } } diff --git a/schemas/jsonschema/index.ts b/schemas/jsonschema/index.ts index 8c06a1e..e8ffa52 100644 --- a/schemas/jsonschema/index.ts +++ b/schemas/jsonschema/index.ts @@ -394,7 +394,7 @@ export const CompressedAudio = { "data": { "type": "string", "contentEncoding": "base64", - "description": "Compressed audio frame data.\n\nTK" + "description": "Compressed audio frame data." }, "format": { "type": "string", @@ -403,6 +403,16 @@ export const CompressedAudio = { "type": { "type": "string", "description": "Frame type.\n\n Supported values: `key`, `delta`." + }, + "sample_rate": { + "type": "integer", + "minimum": 0, + "description": "Number of audio samples per second." + }, + "number_of_channels": { + "type": "integer", + "minimum": 0, + "description": "Number of audio channels in the input." } } }; diff --git a/schemas/omgidl/foxglove/CompressedAudio.idl b/schemas/omgidl/foxglove/CompressedAudio.idl index c16a510..0ca8c1c 100644 --- a/schemas/omgidl/foxglove/CompressedAudio.idl +++ b/schemas/omgidl/foxglove/CompressedAudio.idl @@ -10,8 +10,6 @@ struct CompressedAudio { Time timestamp; // Compressed audio frame data. - // - // TK sequence data; // Audio format. @@ -23,6 +21,12 @@ struct CompressedAudio { // // Supported values: `key`, `delta`. string type; + + // Number of audio samples per second. + uint32 sample_rate; + + // Number of audio channels in the input. + uint32 number_of_channels; }; }; diff --git a/schemas/proto/foxglove/CompressedAudio.proto b/schemas/proto/foxglove/CompressedAudio.proto index 61c3f8b..4aa5f83 100644 --- a/schemas/proto/foxglove/CompressedAudio.proto +++ b/schemas/proto/foxglove/CompressedAudio.proto @@ -12,8 +12,6 @@ message CompressedAudio { google.protobuf.Timestamp timestamp = 1; // Compressed audio frame data. - // - // TK bytes data = 2; // Audio format. @@ -25,4 +23,10 @@ message CompressedAudio { // // Supported values: `key`, `delta`. string type = 4; + + // Number of audio samples per second. + fixed32 sample_rate = 5; + + // Number of audio channels in the input. + fixed32 number_of_channels = 6; } diff --git a/schemas/ros1/CompressedAudio.msg b/schemas/ros1/CompressedAudio.msg index f9cdfc0..3680dd2 100644 --- a/schemas/ros1/CompressedAudio.msg +++ b/schemas/ros1/CompressedAudio.msg @@ -7,8 +7,6 @@ time timestamp # Compressed audio frame data. -# -# TK uint8[] data # Audio format. @@ -20,3 +18,9 @@ string format # # Supported values: `key`, `delta`. string type + +# Number of audio samples per second. +uint32 sample_rate + +# Number of audio channels in the input. +uint32 number_of_channels diff --git a/schemas/ros2/CompressedAudio.msg b/schemas/ros2/CompressedAudio.msg index 31dc397..a03030f 100644 --- a/schemas/ros2/CompressedAudio.msg +++ b/schemas/ros2/CompressedAudio.msg @@ -7,8 +7,6 @@ builtin_interfaces/Time timestamp # Compressed audio frame data. -# -# TK uint8[] data # Audio format. @@ -20,3 +18,9 @@ string format # # Supported values: `key`, `delta`. string type + +# Number of audio samples per second. +uint32 sample_rate + +# Number of audio channels in the input. +uint32 number_of_channels diff --git a/schemas/typescript/CompressedAudio.ts b/schemas/typescript/CompressedAudio.ts index 4b29a2c..0d13260 100644 --- a/schemas/typescript/CompressedAudio.ts +++ b/schemas/typescript/CompressedAudio.ts @@ -8,11 +8,7 @@ export type CompressedAudio = { /** Timestamp of audio frame */ timestamp: Time; - /** - * Compressed audio frame data. - * - * TK - */ + /** Compressed audio frame data. */ data: Uint8Array; /** @@ -28,4 +24,10 @@ export type CompressedAudio = { * Supported values: `key`, `delta`. */ type: string; + + /** Number of audio samples per second. */ + sample_rate: number; + + /** Number of audio channels in the input. */ + number_of_channels: number; };