@grunnverk/audio-tools 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,35 @@
1
+ import { RecordingOptions, RecordingResult } from './types';
2
+ /**
3
+ * Record audio using @theunwalked/unplayable
4
+ */
5
+ export declare function recordAudio(options?: RecordingOptions): Promise<RecordingResult>;
6
+ /**
7
+ * Get timestamped filename for archived audio
8
+ */
9
+ export declare function getTimestampedArchivedAudioFilename(originalExtension?: string): string;
10
+ /**
11
+ * Get timestamped filename for archived transcript
12
+ */
13
+ export declare function getTimestampedArchivedTranscriptFilename(): string;
14
+ /**
15
+ * Archive audio file with transcription to specified directory
16
+ * This saves BOTH the audio file AND transcription text together
17
+ * @param originalAudioPath Path to the original audio file
18
+ * @param transcriptionText The transcribed text content
19
+ * @param outputDirectory Directory to save archived files (default: 'output')
20
+ * @returns Paths to both archived audio and transcript files
21
+ */
22
+ export declare function archiveAudio(originalAudioPath: string, transcriptionText: string, outputDirectory?: string): Promise<{
23
+ audioPath: string;
24
+ transcriptPath: string;
25
+ }>;
26
+ /**
27
+ * Delete audio file
28
+ */
29
+ export declare function deleteAudio(audioPath: string): Promise<void>;
30
+ /**
31
+ * Get audio file duration (requires external library or audio analysis)
32
+ * For now, returns null - can be enhanced later
33
+ */
34
+ export declare function getAudioDuration(_audioPath: string): Promise<number | null>;
35
+ //# sourceMappingURL=recording.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recording.d.ts","sourceRoot":"","sources":["../../src/recording.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAEjE;;GAEG;AACH,wBAAsB,WAAW,CAC7B,OAAO,GAAE,gBAAqB,GAC/B,OAAO,CAAC,eAAe,CAAC,CA6C1B;AAoBD;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,iBAAiB,GAAE,MAAe,GAAG,MAAM,CAE9F;AAED;;GAEG;AACH,wBAAgB,wCAAwC,IAAI,MAAM,CAEjE;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAC9B,iBAAiB,EAAE,MAAM,EACzB,iBAAiB,EAAE,MAAM,EACzB,eAAe,GAAE,MAAiB,GACnC,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC,CA6CxD;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAWlE;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAIjF"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Audio transcription utilities
3
+ * Wraps @grunnverk/ai-service for convenience
4
+ */
5
+ /**
6
+ * Transcribe audio file using AI service
7
+ * This is a convenience wrapper around @grunnverk/ai-service
8
+ */
9
+ export declare function transcribeAudio(audioPath: string): Promise<string>;
10
+ //# sourceMappingURL=transcription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcription.d.ts","sourceRoot":"","sources":["../../src/transcription.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;GAGG;AACH,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAaxE"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Types for audio recording
3
+ */
4
+ export interface AudioDevice {
5
+ id: string;
6
+ name: string;
7
+ isDefault: boolean;
8
+ }
9
+ export interface RecordingOptions {
10
+ /** Audio device to use (optional, uses default if not specified) */
11
+ device?: AudioDevice | string;
12
+ /** Maximum recording duration in seconds (optional) */
13
+ duration?: number;
14
+ /** Output file path (optional, generates temp file if not specified) */
15
+ outputPath?: string;
16
+ /** Countdown delay before recording starts (optional, default: 3) */
17
+ countdownDelay?: number;
18
+ /** Sample rate in Hz (optional, default: 44100) */
19
+ sampleRate?: number;
20
+ /** Audio format (optional, default: 'wav') */
21
+ format?: 'wav' | 'mp3' | 'flac';
22
+ }
23
+ export interface RecordingResult {
24
+ /** Path to recorded audio file */
25
+ filePath: string;
26
+ /** Recording duration in seconds */
27
+ duration: number;
28
+ /** File size in bytes */
29
+ fileSize: number;
30
+ }
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,oEAAoE;IACpE,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAE9B,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,eAAe;IAC9B,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IAEjB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IAEjB,yBAAyB;IACzB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
package/guide/index.md ADDED
@@ -0,0 +1,57 @@
1
+ # @grunnverk/audio-tools - Agentic Guide
2
+
3
+ ## Purpose
4
+
5
+ Audio recording tools for voice-driven development workflows. Enables voice note capture, device management, and transcription.
6
+
7
+ ## Key Features
8
+
9
+ - **Audio Recording** - Record voice notes from command line
10
+ - **Device Management** - List and select audio input devices
11
+ - **Countdown Timer** - Visual countdown before recording starts
12
+ - **Transcription** - Convert audio to text via AI service
13
+ - **Cross-platform** - Works on macOS, Linux, and Windows
14
+
15
+ ## Usage
16
+
17
+ ```typescript
18
+ import { recordAudio, listDevices, transcribe } from '@grunnverk/audio-tools';
19
+
20
+ // List available devices
21
+ const devices = await listDevices();
22
+
23
+ // Record audio
24
+ const audioFile = await recordAudio({
25
+ duration: 60,
26
+ countdown: 3,
27
+ device: devices[0]
28
+ });
29
+
30
+ // Transcribe
31
+ const text = await transcribe(audioFile);
32
+ ```
33
+
34
+ ## Dependencies
35
+
36
+ - @grunnverk/ai-service - Transcription via OpenAI
37
+ - @theunwalked/unplayable - Audio recording engine
38
+
39
+ ## Package Structure
40
+
41
+ ```
42
+ src/
43
+ ├── recording.ts # Audio recording
44
+ ├── devices.ts # Device management
45
+ ├── countdown.ts # Countdown timer
46
+ ├── transcription.ts # Audio transcription
47
+ ├── types.ts # Type definitions
48
+ └── index.ts
49
+ ```
50
+
51
+ ## Key Exports
52
+
53
+ - `recordAudio()` - Record audio from microphone
54
+ - `listDevices()` - List available audio devices
55
+ - `transcribe()` - Transcribe audio to text
56
+ - `countdown()` - Display countdown timer
57
+
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@grunnverk/audio-tools",
3
+ "version": "1.0.0",
4
+ "description": "Audio recording tools for voice-driven development workflows",
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js",
10
+ "types": "./dist/index.d.ts"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "guide"
16
+ ],
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/grunnverk/audio-tools.git"
20
+ },
21
+ "scripts": {
22
+ "build": "npm run lint && tsc --noEmit && vite build",
23
+ "dev": "vite",
24
+ "watch": "vite build --watch",
25
+ "test": "vitest run --coverage",
26
+ "lint": "eslint . --ext .ts",
27
+ "lint:fix": "eslint . --ext .ts --fix",
28
+ "clean": "rm -rf dist",
29
+ "precommit": "npm run clean && npm run build && npm run lint && npm run test",
30
+ "prepublishOnly": "npm run clean && npm run lint && npm run build && npm run test"
31
+ },
32
+ "keywords": [
33
+ "audio",
34
+ "recording",
35
+ "voice",
36
+ "transcription",
37
+ "development",
38
+ "workflow"
39
+ ],
40
+ "author": "Tim O'Brien <tobrien@discursive.com>",
41
+ "license": "Apache-2.0",
42
+ "dependencies": {
43
+ "@grunnverk/ai-service": "^1.0.1",
44
+ "@theunwalked/unplayable": "^0.0.28"
45
+ },
46
+ "peerDependencies": {
47
+ "@grunnverk/shared": "^0.1.11",
48
+ "winston": "^3.17.0"
49
+ },
50
+ "peerDependenciesMeta": {
51
+ "@grunnverk/shared": {
52
+ "optional": true
53
+ },
54
+ "winston": {
55
+ "optional": true
56
+ }
57
+ },
58
+ "devDependencies": {
59
+ "@grunnverk/shared": "^0.1.11",
60
+ "@eslint/eslintrc": "^3.3.1",
61
+ "@eslint/js": "^9.33.0",
62
+ "@swc/core": "^1.13.3",
63
+ "@types/node": "^24.10.1",
64
+ "@types/winston": "^2.4.4",
65
+ "@typescript-eslint/eslint-plugin": "^8.39.1",
66
+ "@typescript-eslint/parser": "^8.47.0",
67
+ "@vitest/coverage-v8": "^4.0.13",
68
+ "esbuild": "0.27.2",
69
+ "eslint": "^9.33.0",
70
+ "eslint-plugin-import": "^2.32.0",
71
+ "globals": "^16.3.0",
72
+ "mockdate": "^3.0.5",
73
+ "typescript": "^5.9.2",
74
+ "vite": "^7.2.4",
75
+ "vite-plugin-dts": "^4.3.0",
76
+ "vite-plugin-node": "^7.0.0",
77
+ "vitest": "^4.0.13",
78
+ "winston": "^3.17.0"
79
+ }
80
+ }