Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump piper to v1.1 #58

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const getCutTimestamp = (): number => {
return Math.max(lastResponseReflex, lastCut);
}

const getTransciptionSoFar = (): string => {
const getTranscriptionSoFar = (): string => {
const lastResponseReflex = getLastResponseReflexTimestamp();
const cutTranscriptionEvents = eventlog.events.filter(e => e.eventType === 'cutTranscription' && e.timestamp > lastResponseReflex);
const lastTranscriptionEvent = getLastTranscriptionEvent();
Expand Down Expand Up @@ -262,7 +262,7 @@ const transcriptionEventHandler = async (event: AudioBytesEvent) => {
const lastTranscription = getLastTranscriptionEvent()
const doneSpeaking = whisper.finishedVoiceActivity(activityBuffer, VAD_SAMPLE_MS, VAD_THOLD, VAD_ENERGY_THOLD);
if (doneSpeaking && lastTranscription && lastTranscription.data.transcription.length) {
return responseInputEventHandler();
return responseInputEventHandler(event);
}
}
const joinedBuffer = Buffer.concat(
Expand Down Expand Up @@ -326,7 +326,7 @@ const responseReflexEventHandler = async (event: TranscriptionEvent): Promise<vo
const responseInputEvents = eventlog.events.filter(e => (e.eventType === 'responseInput'));
const lastResponseInputTimestamp = responseInputEvents.length > 0 ? responseInputEvents[responseInputEvents.length - 1].timestamp : eventlog.events[0].timestamp;
if (lastResponseInputTimestamp > lastTranscriptionEventTimestamp) {
const transcription = getTransciptionSoFar();
const transcription = getTranscriptionSoFar();
if (transcription) {
const responseReflexEvent: ResponseReflexEvent = {
timestamp: Number(Date.now()),
Expand Down Expand Up @@ -400,13 +400,13 @@ const talkEventHandler = async (event: ResponseReflexEvent): Promise<void> => {
}
}

const responseInputEventHandler = (): void => {
const responseInputEventHandler = (event: void | AudioBytesEvent): void => {
const responseInputEvent: ResponseInputEvent = {
eventType: 'responseInput',
timestamp: Number(Date.now()),
data: {}
}
newEventHandler(responseInputEvent);
newEventHandler(responseInputEvent, event);
}

// Defines the DAG through which events trigger each other
Expand Down
6 changes: 3 additions & 3 deletions install_piper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ function main() {

# Set download link based on architecture
if [ "$ARCH" = "x86_64" ]; then
DOWNLOAD_LINK="https://github.com/rhasspy/piper/releases/download/v1.0.0/piper_amd64.tar.gz"
DOWNLOAD_LINK="https://github.com/rhasspy/piper/releases/download/v1.1.0/piper_amd64.tar.gz"
elif [ "$ARCH" = "aarch64" ]; then
DOWNLOAD_LINK="https://github.com/rhasspy/piper/releases/download/v1.0.0/piper_arm64.tar.gz"
DOWNLOAD_LINK="https://github.com/rhasspy/piper/releases/download/v1.1.0/piper_arm64.tar.gz"
elif [ "$ARCH" = "armv7l" ]; then
DOWNLOAD_LINK="https://github.com/rhasspy/piper/releases/download/v1.0.0/piper_armv7.tar.gz"
DOWNLOAD_LINK="https://github.com/rhasspy/piper/releases/download/v1.1.0/piper_armv7.tar.gz"
else
echo "Unsupported architecture: $ARCH. You will have to manually compile and install piper from their repo https://github.com/rhasspy/piper/"
return
Expand Down