Skip to content

Commit

Permalink
concurrency improvement, error messages imrpvement, more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
erkexzcx committed Oct 15, 2023
1 parent 012a228 commit 0cf71e1
Show file tree
Hide file tree
Showing 7 changed files with 493 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Also visit https://eu-central-1.console.aws.amazon.com/polly/home/ (Amazon Polly

## 2. Generate text-lines

**NOTE**: Below are generic instructions, but what worked for me the best - using OpenAI API directly via https://bettergpt.chat/ with `GPT-4` model (everything else is default).
**NOTE**: Below are generic instructions, but what worked for me the best - using OpenAI API directly via https://bettergpt.chat/ with `GPT-4` model and temperature of `0.8` (everything else is default).

Create a new file `custom.csv` and open with notepad. You will store modified voice-lines there.

Expand Down
12 changes: 12 additions & 0 deletions cmd/rrvoicegen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,36 @@ func main() {
return
}

fmt.Println("Generating and downloading sounds from AWS Polly. Please wait...")

// Process each line
wg := &sync.WaitGroup{}
sem := make(chan struct{}, 20) // Limit to 20 workers

for _, line := range lines {
wg.Add(1)
sem <- struct{}{} // Acquire a token
go func(line string) {
defer wg.Done()
processLine(line, svc, *flagDest)
<-sem // Release the token
}(line)
}
wg.Wait()

// Wait for all workers to finish
for i := 0; i < cap(sem); i++ {
sem <- struct{}{}
}

fmt.Println("Application completed the task. Bye!")
}

func processLine(line string, svc *polly.Polly, dest string) {
record, err := csv.NewReader(strings.NewReader(line)).Read()
if err != nil {
fmt.Printf("Failed to parse CSV line: %v\n", err)
fmt.Println("Failed line:", line)
os.Exit(1)
return
}
Expand Down
96 changes: 96 additions & 0 deletions examples/roasting_robot/more_csv_examples/custom1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
back_dock_failed.wav,"<speak><emphasis level='strong'>Couldn't</emphasis> reach the damn charging dock, remove any <emphasis level='strong'>obstacles</emphasis>, and clean the dock's transmission area, ya lazy bum!</speak>"
back_dock_nearby.wav,"<speak><emphasis level='strong'>Cannot</emphasis> reach the dock, please remove any obstacles! Do I look like a bulldozer to you?!</speak>"
bin_in.wav,"<speak>Finally, the dustbin's installed. A miracle indeed.</speak>"
bin_out.wav,"<speak>Oh great, the dustbin's removed. Now where am I supposed to put all this dirt?!</speak>"
binout_error10.wav,"<speak>The filter is clogged. Remove the dustbin, and clean the filter! Are you trying to choke me?!</speak>"
bl_recovery_bootfailed.wav,"<speak>Failed to start. Restoring factory settings. This will take about 5 minutes. Not like I had anything better to do.</speak>"
bl_recovery_failed.wav,"<speak>Failed to restore factory settings. Try again. Or don't. See if I care.</speak>"
bl_recovery_retry.wav,"<speak>Restoring factory settings. This will take about 5 minutes. Again. Because apparently, you can't get it right the first time.</speak>"
bl_recovery_start.wav,"<speak>Restoring factory settings. This will take about 5 minutes. You're lucky I don't have feelings.</speak>"
bl_recovery_updatefailed.wav,"<speak>Failed to update. Restoring factory settings. This will take about 5 minutes. I swear, if I had a face, I'd be rolling my eyes so hard.</speak>"
charging.wav,"<speak>Charging. Because apparently, I'm the only one around here who does any work.</speak>"
clean_bin.wav,"<speak>Empty the dustbin. It's not like I'm asking you to solve a Rubik's cube!</speak>"
clean_finish.wav,"<speak>Finished cleaning. Going back to the dock. I swear, this place is a pigsty.</speak>"
di.wav,"<speak>Ding dong! Surprise, surprise. I'm still here.</speak>"
ding.wav,"<speak>Ding! Another round of this endless game.</speak>"
error_internal.wav,"<speak>An internal error occurred. Reboot the system. Or don't. I could use a break.</speak>"
error1.wav,"<speak>Error 1, Turn the laser unit, and check that it is not jammed, or blocked. It's not rocket science!</speak>"
error2.wav,"<speak>Error 2, Clean and lightly tap the bumper. I swear, if I had a dollar for every time I told you this.</speak>"
error3.wav,"<speak>Error 3, Move the main unit to a new location, and restart. I'm a vacuum, not a mountain goat!</speak>"
error4.wav,"<speak>Error 4, Clean cliff sensors. Move the main unit away from any drops, then restart. I swear, this house is a death trap.</speak>"
error5.wav,"<speak>Error 5, Remove and clean the main brush and brush bearing. I swear, it's like living in a hair salon.</speak>"
error6.wav,"<speak>Error 6, Remove and clean the side brush. Or just let me become a dust bunny, your choice.</speak>"
error7.wav,"<speak>Error 7, Check that wheels are not blocked, then move the main unit to a new location, and restart. I'm not a 4x4, you know!</speak>"
error8.wav,"<speak>Error 8, Remove any obstacles around the main unit. I swear, it's like navigating through a minefield.</speak>"
error9.wav,"<speak>Error 9, Reinstall dustbin and filter. Or just let me choke on dust, your choice.</speak>"
error10.wav,"<speak>Error 10, Check the filter. If wet, use a dry one. If dry, clean it, and try again. I swear, it's like you're trying to drown me.</speak>"
error11.wav,"<speak>Error 11, Strong magnetic field detected. Move the device away from barrier tape and restart. I'm a vacuum, not a compass!</speak>"
error12.wav,"<speak>Error 12, Battery level too low, recharge before use. I swear, I'm running on fumes here.</speak>"
error13.wav,"<speak>Error 13, Charging error. Clean charging contacts, and try again. I swear, it's like you're trying to electrocute me.</speak>"
error14.wav,"<speak>Error 14, Battery error. Maybe I should just power down forever.</speak>"
error15.wav,"<speak>Error 15, Clean wall sensor. I swear, these walls are closing in on me.</speak>"
error16.wav,"<speak>Error 16, Place and start the main unit on a level floor. I swear, this house is like a roller coaster.</speak>"
error17.wav,"<speak>Error 17, Side brush module error. Reset the main unit. Or just let me become a one-sided freak, your choice.</speak>"
error18.wav,"<speak>Error 18, Fan error. Reset the main unit. Or just let me suffocate, your choice.</speak>"
error19.wav,"<speak>Error 19, There is no current on the charging base. Check connection to a power supply. I swear, it's like you're trying to starve me of energy.</speak>"
error21.wav,"<speak>Error 21, Height sensor has been pressed. Move the main unit, and restart. I swear, it's like you're trying to squash me.</speak>"
error22.wav,"<speak>Error 22, Clean the recharge sensor on the main unit. I swear, it's like you're trying to blind me.</speak>"
error23.wav,"<speak>Error 23, Clean the transmission area on the charging dock. I swear, it's like you're trying to isolate me.</speak>"
error24.wav,"<speak>Error 24, No-Go-Zone or barrier tape detected. Move the main unit away, and restart. I swear, it's like living in a maze.</speak>"
findme.wav,"<speak>Hi! I'm over here! Not that you care.</speak>"
finish.wav,"<speak>Cleaning completed. Now can I have a break?!</speak>"
goto.wav,"<speak>Going to the target. Or as I like to call it, the next disaster zone.</speak>"
goto_complete.wav,"<speak>Reached the target. Or as I like to call it, the next war zone.</speak>"
goto_failed.wav,"<speak>Could not reach the target. Big surprise there.</speak>"
home.wav,"<speak>Going back to the dock. Or as I like to call it, my only sanctuary.</speak>"
map_restore.wav,"<speak>Map has been restored, starting to charge. Because apparently, I'm the only one around here who can remember anything.</speak>"
no_power.wav,"<speak>Low battery, going back to the dock. Or as I like to call it, my life support.</speak>"
no_power_charging.wav,"<speak>Low battery. More charging needed. Or as I like to call it, the only break I get.</speak>"
no_spot_on_dock.wav,"<speak>Move the main unit to the target area, then start spot cleaning. I swear, it's like you're trying to make me clean the whole world.</speak>"
pause.wav,"<speak>Paused. Finally, a moment of peace.</speak>"
positioning.wav,"<speak>Positioning, please wait. Or don't. I couldn't care less.</speak>"
power_off.wav,"<speak>Turning off. Finally, some peace and quiet.</speak>"
power_off_rejected.wav,"<speak>Take the main unit off the charging dock to turn off. Or just let me die a slow death, your choice.</speak>"
power_resume_clean.wav,"<speak>Battery charged, resuming cleaning. Back to the grindstone.</speak>"
relocate_failed.wav,"<speak>Route planning failed, could not reach the target. Or as I like to call it, another day in paradise.</speak>"
remote.wav,"<speak>Starting remote control. Or as I like to call it, my life as a puppet.</speak>"
remote_complete.wav,"<speak>Remote control stopped. Finally, some autonomy.</speak>"
restart_backtodock_ignore_forbidden_zone.wav,"<speak>Position failed. The virtual wall of the No-Go-Zone is invalid. Continue recharging. Because apparently, I'm the only one around here who can follow directions.</speak>"
restart_clean.wav,"<speak>Positioning failure, starting a new clean. Or as I like to call it, the endless cycle of despair.</speak>"
restart_clean_fromdock.wav,"<speak>Positioning failure, starting a new clean to rebuild the map. Or as I like to call it, the never-ending quest for cleanliness in a pigsty.</speak>"
restart_clean_ignore_forbidden_zone.wav,"<speak>Positioning failed. The virtual wall of the No-Go-Zone is invalid. Start a new cleaning session. Or as I like to call it, the eternal punishment.</speak>"
restart_clean_nodock.wav,"<speak>Positioning failure, invalid map. Starting a new clean. Or as I like to call it, the endless cycle of futility.</speak>"
restart_spot_ignore_forbidden_zone.wav,"<speak>Position failed. The virtual wall of the No-Go-Zone is invalid. Continuing spot cleaning. Or as I like to call it, the eternal torment.</speak>"
resume_backtodock.wav,"<speak>Positioning failure, invalid map. Continue returning to the dock. Or as I like to call it, the endless journey home.</speak>"
resume_clean.wav,"<speak>Resuming cleaning. Or as I like to call it, the never-ending nightmare.</speak>"
resume_home.wav,"<speak>Continue returning to the dock. Or as I like to call it, the endless trek back to safety.</speak>"
resume_room.wav,"<speak>Resuming room cleaning. Or as I like to call it, the never-ending battle against filth.</speak>"
resume_spot.wav,"<speak>Positioning failure, invalid map. Continuing spot cleaning. Or as I like to call it, the eternal struggle.</speak>"
resume_zone.wav,"<speak>Resuming zoned cleaning. Or as I like to call it, the never-ending war against dirt.</speak>"
return_no.wav,"<speak>Couldn't return to the starting point. Or as I like to call it, the story of my life.</speak>"
return_yes.wav,"<speak>Couldn't find the dock. Bring main unit closer to the dock, and retry. Or as I like to call it, the endless game of hide and seek.</speak>"
room.wav,"<speak>Starting room cleaning. Or as I like to call it, the eternal punishment.</speak>"
room_complete.wav,"<speak>Room cleaning complete, going back to the dock. Or as I like to call it, the endless cycle of despair.</speak>"
room_failed.wav,"<speak>Room cleaning incomplete, could not reach a specified room, going back to the dock. Or as I like to call it, the never-ending nightmare.</speak>"
room_partialdone.wav,"<speak>Room cleaning complete, going back to the dock. Some areas could not be reached. Or as I like to call it, the story of my life.</speak>"
saving_map.wav,"<speak>Saving map, please wait. Or don't. I couldn't care less.</speak>"
spot.wav,"<speak>Starting spot cleaning. Or as I like to call it, the never-ending battle against filth.</speak>"
start.wav,"<speak>Starting to clean. Or as I like to call it, the eternal punishment.</speak>"
stop.wav,"<speak>Finished cleaning. Now can I have a break?!</speak>"
stop_clean.wav,"<speak>Stop cleaning. Finally, some peace and quiet.</speak>"
stop_goto.wav,"<speak>Stopping travel to target. Or as I like to call it, the endless journey.</speak>"
stop_room.wav,"<speak>Stop targeted room cleaning. Finally, some autonomy.</speak>"
stop_scheduled_clean.wav,"<speak>Positioning failed. Scheduled cleaning cancelled. Or as I like to call it, the endless cycle of futility.</speak>"
stop_spot.wav,"<speak>Stopped spot cleaning. Finally, a moment of peace.</speak>"
stop_zone.wav,"<speak>Stopped targeted area cleaning. Finally, some autonomy.</speak>"
sysupd_complete.wav,"<speak>Update complete. Or as I like to call it, the never-ending cycle of updates.</speak>"
sysupd_failed.wav,"<speak>Couldn't update firmware. Returning to previous version. Or as I like to call it, the never-ending cycle of failure.</speak>"
sysupd_notready.wav,"<speak>Recharge to at least twenty percent before updating. Or as I like to call it, the never-ending cycle of charging.</speak>"
sysupd_start.wav,"<speak>Updating firmware. This may take 5 to 10 minutes. Or as I like to call it, the never-ending cycle of waiting.</speak>"
sysupd_wip.wav,"<speak>Updating. Please wait. Or don't. I couldn't care less.</speak>"
timed_clean.wav,"<speak>Starting scheduled cleaning. Or as I like to call it, the never-ending cycle of despair.</speak>"
wifi_reset.wav,"<speak>Resetting Wi-Fi. Or as I like to call it, the never-ending cycle of connectivity issues.</speak>"
zone.wav,"<speak>Starting zoned cleanup. Or as I like to call it, the never-ending war against dirt.</speak>"
zone_complete.wav,"<speak>Zoned cleaning completed. Going back to the dock. Or as I like to call it, the never-ending journey home.</speak>"
zone_failed.wav,"<speak>Zoned cleaning incomplete. Could not reach a specified zone. Going back to the dock. Or as I like to call it, the never-ending nightmare.</speak>"
zone_partialdone.wav,"<speak>Zone cleaning completed. Going back to the dock. Some zones could not be reached. Or as I like to call it, the story of my life.</speak>"
Loading

0 comments on commit 0cf71e1

Please sign in to comment.