Compare commits
2 commits
5d1d653ada
...
c55c1d3563
Author | SHA1 | Date | |
---|---|---|---|
c55c1d3563 | |||
e94f3ef4d5 |
13 changed files with 1775 additions and 0 deletions
32
MicRecord.gd
32
MicRecord.gd
|
@ -11,6 +11,13 @@ var format := AudioStreamWAV.FORMAT_16_BITS # This is the default format on rec
|
||||||
var noise_max_lvl := 2000000#10000000
|
var noise_max_lvl := 2000000#10000000
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
%TTS_Voices.clear()
|
||||||
|
var i = 0
|
||||||
|
for vc in DisplayServer.tts_get_voices():
|
||||||
|
%TTS_Voices.add_item(vc["language"]+" "+vc["name"])
|
||||||
|
%TTS_Voices.set_item_metadata(i,vc)
|
||||||
|
i+=1
|
||||||
|
|
||||||
var idx := AudioServer.get_bus_index("Record")
|
var idx := AudioServer.get_bus_index("Record")
|
||||||
effect = AudioServer.get_bus_effect(idx, 2)
|
effect = AudioServer.get_bus_effect(idx, 2)
|
||||||
%Controls.visible=false
|
%Controls.visible=false
|
||||||
|
@ -32,6 +39,16 @@ func save_words():
|
||||||
fl.close()
|
fl.close()
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
|
if tts_mode:
|
||||||
|
if %WordList.item_count<tts_spoken:
|
||||||
|
run_swap_code(1)
|
||||||
|
_on_tts_mode_pressed()
|
||||||
|
return
|
||||||
|
if !DisplayServer.tts_is_speaking():
|
||||||
|
await run_swap_code(1)
|
||||||
|
tts_spoken+=1
|
||||||
|
DisplayServer.tts_speak(last_item_text,%TTS_Voices.get_item_metadata(%TTS_Voices.selected)["id"])
|
||||||
|
return
|
||||||
auto_timer_t+=delta
|
auto_timer_t+=delta
|
||||||
if auto_timer and auto_timer_t>=auto_timer_val:
|
if auto_timer and auto_timer_t>=auto_timer_val:
|
||||||
auto_timer_t=0
|
auto_timer_t=0
|
||||||
|
@ -48,6 +65,8 @@ var auto_timer := false
|
||||||
var auto_timer_val := 1.0
|
var auto_timer_val := 1.0
|
||||||
var auto_timer_t := 0.0
|
var auto_timer_t := 0.0
|
||||||
func _on_auto_switch_pressed() -> void:
|
func _on_auto_switch_pressed() -> void:
|
||||||
|
if tts_mode:
|
||||||
|
return
|
||||||
auto_timer_val = %Time.value
|
auto_timer_val = %Time.value
|
||||||
auto_timer_t=0
|
auto_timer_t=0
|
||||||
auto_timer=!auto_timer
|
auto_timer=!auto_timer
|
||||||
|
@ -56,6 +75,19 @@ func _on_auto_switch_pressed() -> void:
|
||||||
else:
|
else:
|
||||||
%AutoSwitch.text="Start Timer"
|
%AutoSwitch.text="Start Timer"
|
||||||
|
|
||||||
|
var tts_mode := false
|
||||||
|
var tts_spoken := 0
|
||||||
|
func _on_tts_mode_pressed() -> void:
|
||||||
|
if auto_timer:
|
||||||
|
_on_auto_switch_pressed()
|
||||||
|
tts_mode=!tts_mode
|
||||||
|
tts_spoken=0
|
||||||
|
if tts_mode:
|
||||||
|
%TTSMode.text="Stop TTS"
|
||||||
|
_on_record_button_pressed()
|
||||||
|
else:
|
||||||
|
%TTSMode.text="Start TTS"
|
||||||
|
|
||||||
|
|
||||||
func run_swap_code(dir):
|
func run_swap_code(dir):
|
||||||
if effect.is_recording_active():
|
if effect.is_recording_active():
|
||||||
|
|
|
@ -228,6 +228,20 @@ step = 0.25
|
||||||
value = 1.0
|
value = 1.0
|
||||||
ticks_on_borders = true
|
ticks_on_borders = true
|
||||||
|
|
||||||
|
[node name="HBoxContainer4" type="HBoxContainer" parent="TabContainer/Record/HBoxContainer3/Controls"]
|
||||||
|
layout_mode = 2
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="TTSMode" type="Button" parent="TabContainer/Record/HBoxContainer3/Controls/HBoxContainer4"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Start TTS"
|
||||||
|
|
||||||
|
[node name="TTS_Voices" type="OptionButton" parent="TabContainer/Record/HBoxContainer3/Controls/HBoxContainer4"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(200, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="HSeparator2" type="HSeparator" parent="TabContainer/Record/HBoxContainer3/Controls"]
|
[node name="HSeparator2" type="HSeparator" parent="TabContainer/Record/HBoxContainer3/Controls"]
|
||||||
self_modulate = Color(1, 1, 1, 0)
|
self_modulate = Color(1, 1, 1, 0)
|
||||||
custom_minimum_size = Vector2(0, 40)
|
custom_minimum_size = Vector2(0, 40)
|
||||||
|
@ -316,6 +330,7 @@ placeholder_text = "Text to read load worlds"
|
||||||
[connection signal="pressed" from="TabContainer/Record/HBoxContainer3/Controls/HBoxContainer/SaveButton" to="." method="_on_save_button_pressed"]
|
[connection signal="pressed" from="TabContainer/Record/HBoxContainer3/Controls/HBoxContainer/SaveButton" to="." method="_on_save_button_pressed"]
|
||||||
[connection signal="pressed" from="TabContainer/Record/HBoxContainer3/Controls/HBoxContainer/OpenUserFolderButton" to="." method="_on_open_user_folder_button_pressed"]
|
[connection signal="pressed" from="TabContainer/Record/HBoxContainer3/Controls/HBoxContainer/OpenUserFolderButton" to="." method="_on_open_user_folder_button_pressed"]
|
||||||
[connection signal="pressed" from="TabContainer/Record/HBoxContainer3/Controls/HBoxContainer3/AutoSwitch" to="." method="_on_auto_switch_pressed"]
|
[connection signal="pressed" from="TabContainer/Record/HBoxContainer3/Controls/HBoxContainer3/AutoSwitch" to="." method="_on_auto_switch_pressed"]
|
||||||
|
[connection signal="pressed" from="TabContainer/Record/HBoxContainer3/Controls/HBoxContainer4/TTSMode" to="." method="_on_tts_mode_pressed"]
|
||||||
[connection signal="pressed" from="TabContainer/Record/HBoxContainer3/Controls/HBoxContainer2/DeleteButton" to="." method="_on_delete_button_pressed"]
|
[connection signal="pressed" from="TabContainer/Record/HBoxContainer3/Controls/HBoxContainer2/DeleteButton" to="." method="_on_delete_button_pressed"]
|
||||||
[connection signal="pressed" from="TabContainer/PlanText/HBoxContainer2/PlayTextBTN" to="." method="_on_play_text_btn_pressed"]
|
[connection signal="pressed" from="TabContainer/PlanText/HBoxContainer2/PlayTextBTN" to="." method="_on_play_text_btn_pressed"]
|
||||||
[connection signal="pressed" from="TabContainer/PlanText/HBoxContainer2/AddWordsBTN" to="." method="_on_add_words_btn_pressed"]
|
[connection signal="pressed" from="TabContainer/PlanText/HBoxContainer2/AddWordsBTN" to="." method="_on_add_words_btn_pressed"]
|
||||||
|
|
92
addons/ai_voices/Dock_aivoices.tscn
Normal file
92
addons/ai_voices/Dock_aivoices.tscn
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
[gd_scene load_steps=4 format=3 uid="uid://dw3yneckugr7i"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://srkgrxnfaw0o" path="res://addons/ai_voices/GenerateDialog.cs" id="1_u4t6r"]
|
||||||
|
|
||||||
|
[sub_resource type="SystemFont" id="SystemFont_u4t6r"]
|
||||||
|
font_weight = 800
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_0yynb"]
|
||||||
|
font = SubResource("SystemFont_u4t6r")
|
||||||
|
font_size = 20
|
||||||
|
|
||||||
|
[node name="AIVoicesMenu" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="MainContainer" type="VBoxContainer" parent="."]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_right = 424.0
|
||||||
|
offset_bottom = 185.0
|
||||||
|
|
||||||
|
[node name="LabelSettings" type="Label" parent="MainContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Settings:"
|
||||||
|
label_settings = SubResource("LabelSettings_0yynb")
|
||||||
|
|
||||||
|
[node name="VoiceContainer" type="HBoxContainer" parent="MainContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="MainContainer/VoiceContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Voice:"
|
||||||
|
|
||||||
|
[node name="voice" type="OptionButton" parent="MainContainer/VoiceContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
item_count = 1
|
||||||
|
popup/item_0/text = "Default"
|
||||||
|
popup/item_0/id = 0
|
||||||
|
|
||||||
|
[node name="LangContainer" type="HBoxContainer" parent="MainContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="MainContainer/LangContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Lang:"
|
||||||
|
|
||||||
|
[node name="lang" type="OptionButton" parent="MainContainer/LangContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
item_count = 5
|
||||||
|
popup/item_0/text = "en"
|
||||||
|
popup/item_0/id = 0
|
||||||
|
popup/item_1/text = "fr"
|
||||||
|
popup/item_1/id = 1
|
||||||
|
popup/item_2/text = "es"
|
||||||
|
popup/item_2/id = 2
|
||||||
|
popup/item_3/text = "it"
|
||||||
|
popup/item_3/id = 3
|
||||||
|
popup/item_4/text = "de"
|
||||||
|
popup/item_4/id = 4
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="MainContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Text to generate:"
|
||||||
|
|
||||||
|
[node name="DialogToGenerate" type="TextEdit" parent="MainContainer"]
|
||||||
|
custom_minimum_size = Vector2(0, 80)
|
||||||
|
layout_mode = 2
|
||||||
|
placeholder_text = "Lorem ipsum"
|
||||||
|
scroll_smooth = true
|
||||||
|
scroll_fit_content_height = true
|
||||||
|
caret_type = 1
|
||||||
|
|
||||||
|
[node name="GenerateButton" type="Button" parent="MainContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Generate wav file"
|
||||||
|
script = ExtResource("1_u4t6r")
|
||||||
|
|
||||||
|
[node name="HSeparator" type="HSeparator" parent="MainContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="LinkButton" type="LinkButton" parent="MainContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "AllTalk_TTS repos"
|
||||||
|
uri = "https://github.com/erew123/alltalk_tts"
|
||||||
|
|
||||||
|
[node name="LinkButton2" type="LinkButton" parent="MainContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "How to install AllTalk?"
|
||||||
|
uri = "https://www.anthony-cardinale.fr/_public/unity-tools/AITools/AllTalk_Installation.pdf"
|
1544
addons/ai_voices/GenerateDialog.cs
Normal file
1544
addons/ai_voices/GenerateDialog.cs
Normal file
File diff suppressed because it is too large
Load diff
1
addons/ai_voices/GenerateDialog.cs.uid
Normal file
1
addons/ai_voices/GenerateDialog.cs.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://srkgrxnfaw0o
|
23
addons/ai_voices/Voices.cs
Normal file
23
addons/ai_voices/Voices.cs
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#if TOOLS
|
||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
[Tool]
|
||||||
|
public partial class Voices : EditorPlugin
|
||||||
|
{
|
||||||
|
Control dock;
|
||||||
|
|
||||||
|
public override void _EnterTree()
|
||||||
|
{
|
||||||
|
dock = (Control)GD.Load<PackedScene>("addons/ai_voices/Dock_aivoices.tscn").Instantiate();
|
||||||
|
AddControlToDock(DockSlot.LeftUl, dock);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _ExitTree()
|
||||||
|
{
|
||||||
|
RemoveControlFromDocks(dock);
|
||||||
|
dock.Free();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
1
addons/ai_voices/Voices.cs.uid
Normal file
1
addons/ai_voices/Voices.cs.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://dbb78cttweipf
|
BIN
addons/ai_voices/icon-aivoices.png
Normal file
BIN
addons/ai_voices/icon-aivoices.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 504 B |
34
addons/ai_voices/icon-aivoices.png.import
Normal file
34
addons/ai_voices/icon-aivoices.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://m8qmkaxyajs3"
|
||||||
|
path="res://.godot/imported/icon-aivoices.png-758b658cfba7c130942d59a689d24696.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/ai_voices/icon-aivoices.png"
|
||||||
|
dest_files=["res://.godot/imported/icon-aivoices.png-758b658cfba7c130942d59a689d24696.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
7
addons/ai_voices/plugin.cfg
Normal file
7
addons/ai_voices/plugin.cfg
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[plugin]
|
||||||
|
|
||||||
|
name="AI Voices"
|
||||||
|
description=""
|
||||||
|
author="Anthony Cardinale"
|
||||||
|
version="1.0"
|
||||||
|
script="Voices.cs"
|
|
@ -21,6 +21,7 @@ config/icon="res://icon.webp"
|
||||||
|
|
||||||
[audio]
|
[audio]
|
||||||
|
|
||||||
|
general/text_to_speech=true
|
||||||
driver/enable_input=true
|
driver/enable_input=true
|
||||||
enable_audio_input=true
|
enable_audio_input=true
|
||||||
|
|
||||||
|
|
4
scripts/hello.gd.txt
Normal file
4
scripts/hello.gd.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
print("Hello world with no .UID files!")
|
21
test.tscn
Normal file
21
test.tscn
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://b71653f53iyqe"]
|
||||||
|
|
||||||
|
[sub_resource type="GDScript" id="GDScript_unn25"]
|
||||||
|
script/source = "extends Node
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
var scripts_dir = \"res://scripts/\"
|
||||||
|
for file in DirAccess.get_files_at(scripts_dir):
|
||||||
|
if file.ends_with(\".gd.txt\"):
|
||||||
|
var node = Node.new()
|
||||||
|
var script = GDScript.new()
|
||||||
|
script.source_code=FileAccess.get_file_as_string(scripts_dir+file)
|
||||||
|
script.reload()
|
||||||
|
node.set_script(script)
|
||||||
|
add_child(node)
|
||||||
|
"
|
||||||
|
|
||||||
|
[node name="Node" type="Node"]
|
||||||
|
script = SubResource("GDScript_unn25")
|
Loading…
Reference in a new issue