Skip to content

Commit

Permalink
fix: spwan sox on data event only run 108 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
sobird committed Feb 19, 2025
1 parent 320fdd5 commit adabd05
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Continuous Integration
on:
push:
branches: [ "master" ]
# pull_request:
# branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:

jobs:
Expand Down
4 changes: 0 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const command = program

const spinner = ora({
discardStdin: false,
// text: 'Loading...',
spinner: {
frames: [
randomWave(),
Expand All @@ -62,12 +61,9 @@ const command = program
keypress((str, key) => {
if (key.name === 'space') {
space = !space;

if (space) {
mqttService.startListening();
spinner.start();

// keypress
} else {
spinner.stop();
mqttService.stopListening();
Expand Down
10 changes: 7 additions & 3 deletions services/AudioService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ export class AudioService {
});
});

sox.stderr.on('data', () => {
// console.error(data.toString());
});

mic.on('error', (err) => {
console.error(`send audio error: ${err}`);
});
Expand Down Expand Up @@ -137,9 +141,9 @@ export class AudioService {
'-t', process.platform === 'win32' ? 'waveaudio' : 'coreaudio', '-d', // 输出到默认音频设备
]);

// sox.stderr.on('data', (data) => {
// console.error(data.toString());
// });
sox.stderr.on('data', () => {
// console.error(data.toString());
});

const opusScript = new OpusScript(outputSampleRate, outputChannels, OpusScript.Application.AUDIO);

Expand Down

0 comments on commit adabd05

Please sign in to comment.