Преглед изворни кода

initial implementation of pvocex format

Jonathan Higgins пре 4 месеци
родитељ
комит
b17945e253

+ 10 - 6
scenes/main/control.tscn

@@ -608,7 +608,7 @@ offset_top = 45.0
 offset_right = 549.0
 offset_right = 549.0
 offset_bottom = 72.0
 offset_bottom = 72.0
 tooltip_text = "Adjusts the number of analysis points used by the frequency domain processes in this thread. More points give better frequency resolution but worse time resolution."
 tooltip_text = "Adjusts the number of analysis points used by the frequency domain processes in this thread. More points give better frequency resolution but worse time resolution."
-item_count = 14
+item_count = 16
 popup/item_0/text = "2"
 popup/item_0/text = "2"
 popup/item_0/id = 0
 popup/item_0/id = 0
 popup/item_1/text = "4"
 popup/item_1/text = "4"
@@ -635,8 +635,12 @@ popup/item_11/text = "4096"
 popup/item_11/id = 11
 popup/item_11/id = 11
 popup/item_12/text = "8192"
 popup/item_12/text = "8192"
 popup/item_12/id = 12
 popup/item_12/id = 12
-popup/item_13/text = "16380"
+popup/item_13/text = "16384"
 popup/item_13/id = 13
 popup/item_13/id = 13
+popup/item_14/text = "32768"
+popup/item_14/id = 14
+popup/item_15/text = "65536"
+popup/item_15/id = 15
 
 
 [node name="FFTOverlapLabel" type="Label" parent="."]
 [node name="FFTOverlapLabel" type="Label" parent="."]
 layout_mode = 0
 layout_mode = 0
@@ -654,13 +658,13 @@ offset_right = 747.0
 offset_bottom = 72.0
 offset_bottom = 72.0
 tooltip_text = "Adjusts the number of analysis points used by the frequency domain processes in this thread. More points give better frequency resolution but worse time resolution."
 tooltip_text = "Adjusts the number of analysis points used by the frequency domain processes in this thread. More points give better frequency resolution but worse time resolution."
 item_count = 4
 item_count = 4
-popup/item_0/text = "1"
+popup/item_0/text = "0"
 popup/item_0/id = 0
 popup/item_0/id = 0
-popup/item_1/text = "2"
+popup/item_1/text = "1"
 popup/item_1/id = 1
 popup/item_1/id = 1
-popup/item_2/text = "3"
+popup/item_2/text = "2"
 popup/item_2/id = 2
 popup/item_2/id = 2
-popup/item_3/text = "4"
+popup/item_3/text = "3"
 popup/item_3/id = 3
 popup/item_3/id = 3
 
 
 [connection signal="connection_request" from="GraphEdit" to="GraphEdit" method="_on_connection_request"]
 [connection signal="connection_request" from="GraphEdit" to="GraphEdit" method="_on_connection_request"]

+ 2 - 2
scenes/main/process_help.json

@@ -5337,7 +5337,7 @@
 	"subcategory": "combine",
 	"subcategory": "combine",
 	"title": "Sum"
 	"title": "Sum"
   },
   },
-  "pvoc_anal_1": {
+  "pvocex2_-A": {
 	"category": "pvoc",
 	"category": "pvoc",
 	"description": "This is process is used to analyse a sound and convert it from the time domain to the frequency domain. This allows for processes in the PVOC processes menu to be used to manipulate the sound. Once you are done processing in the frequency domain you can convert it back to audio again using Resynthesise. See Help > Tutorials > PVOC for more.\n",
 	"description": "This is process is used to analyse a sound and convert it from the time domain to the frequency domain. This allows for processes in the PVOC processes menu to be used to manipulate the sound. Once you are done processing in the frequency domain you can convert it back to audio again using Resynthesise. See Help > Tutorials > PVOC for more.\n",
 	"inputtype": "[0]",
 	"inputtype": "[0]",
@@ -5349,7 +5349,7 @@
 	"subcategory": "convert",
 	"subcategory": "convert",
 	"title": "Analyse"
 	"title": "Analyse"
   },
   },
-  "pvoc_synth": {
+  "pvocex2_-S": {
 	"category": "pvoc",
 	"category": "pvoc",
 	"description": "This is process is used to take the analysis of a sound file and resynthesise it back into the time domain. This should be used after you are done processing in the frequency domain to convert back to audio. See Help > Tutorials > PVOC for more. \n",
 	"description": "This is process is used to take the analysis of a sound file and resynthesise it back into the time domain. This should be used after you are done processing in the frequency domain to convert back to audio. See Help > Tutorials > PVOC for more. \n",
 	"inputtype": "[1]",
 	"inputtype": "[1]",

+ 2 - 5
scenes/main/scripts/control.gd

@@ -867,16 +867,13 @@ func on_files_dropped(files):
 
 
 func _on_fft_size_item_selected(index: int) -> void:
 func _on_fft_size_item_selected(index: int) -> void:
 	var fft_size
 	var fft_size
-	if index == 13:
-		fft_size = 16380
-	else:
-		fft_size = 1 << (index + 1)
+	fft_size = 1 << (index + 1)
 	run_thread.fft_size = fft_size
 	run_thread.fft_size = fft_size
 
 
 
 
 
 
 func _on_fft_overlap_item_selected(index: int) -> void:
 func _on_fft_overlap_item_selected(index: int) -> void:
-	run_thread.fft_overlap = index + 1
+	run_thread.fft_overlap = index
 
 
 
 
 func _on_undo_button_button_down() -> void:
 func _on_undo_button_button_down() -> void:

+ 9 - 11
scenes/main/scripts/run_thread.gd

@@ -477,7 +477,7 @@ func run_thread_with_branches():
 			else: 
 			else: 
 				#Process outputs audio
 				#Process outputs audio
 				#check if this is the last pvoc process in a stereo processing chain and check if infile is an array meaning that the last pvoc process was run in dual mono mode
 				#check if this is the last pvoc process in a stereo processing chain and check if infile is an array meaning that the last pvoc process was run in dual mono mode
-				if node.get_meta("command") == "pvoc_synth" and is_pvoc_stereo(current_infiles):
+				if node.get_meta("command") == "pvocex2_-S" and is_pvoc_stereo(current_infiles):
 					var split_files = await process_dual_mono_pvoc(current_infiles, node, process_count, slider_data)
 					var split_files = await process_dual_mono_pvoc(current_infiles, node, process_count, slider_data)
 					var pvoc_stereo_files = split_files[0]
 					var pvoc_stereo_files = split_files[0]
 								
 								
@@ -890,13 +890,11 @@ func get_analysis_file_properties(file: String) -> Dictionary:
 	#close the file
 	#close the file
 	f.close()
 	f.close()
 	
 	
-	#calculate actual window size from the decimation factor
-	
-	analysis_file_properties["windowsize"] = analysis_file_properties["windowsize"] * 128 / analysis_file_properties["decimationfactor"]
 	
 	
 	if analysis_file_properties["windowsize"] != 0 and data_chunk_size != 0:
 	if analysis_file_properties["windowsize"] != 0 and data_chunk_size != 0:
-		var bytes_per_frame = (analysis_file_properties["windowsize"] + 2) * 4
-		analysis_file_properties["windowcount"] = int(data_chunk_size / bytes_per_frame)
+		var floats_per_window = analysis_file_properties["windowsize"] + 2
+		var total_floats = data_chunk_size / 4
+		analysis_file_properties["windowcount"] = int(total_floats / floats_per_window)
 	else:
 	else:
 		log_console("Error: Could not get information from analysis file", true)
 		log_console("Error: Could not get information from analysis file", true)
 		
 		
@@ -1068,9 +1066,9 @@ func match_pvoc_channels(dict: Dictionary) -> void:
 			
 			
 func _get_slider_values_ordered(node: Node) -> Array:
 func _get_slider_values_ordered(node: Node) -> Array:
 	var results := []
 	var results := []
-	if node.has_meta("command") and node.get_meta("command") == "pvoc_anal_1":
-		results.append(["slider", "-c", fft_size, false, [], 2, 16380, false, false])
-		results.append(["slider", "-o", fft_overlap, false, [], 1, 4, false, false])
+	if node.has_meta("command") and node.get_meta("command") == "pvocex2_-A":
+		results.append(["slider", "-N", fft_size, false, [], 2, 16380, false, false])
+		results.append(["slider", "-W", fft_overlap, false, [], 1, 4, false, false])
 		return results
 		return results
 	for child in node.get_children():
 	for child in node.get_children():
 		if child is Range:
 		if child is Range:
@@ -1119,8 +1117,8 @@ func make_process(node: Node, process_count: int, current_infile: Array, slider_
 	var command
 	var command
 	var cleanup = []
 	var cleanup = []
 	
 	
-	# Determine output extension: .wav or .ana based on the node's slot type
-	var extension = ".wav" if node.get_slot_type_right(0) == 0 else ".ana"
+	# Determine output extension: .wav or .pvx based on the node's slot type
+	var extension = ".wav" if node.get_slot_type_right(0) == 0 else ".pvx"
 
 
 	# Construct output filename for this step
 	# Construct output filename for this step
 	var output_file = "%s_%d%s" % [Global.outfile.get_basename(), process_count, extension]
 	var output_file = "%s_%d%s" % [Global.outfile.get_basename(), process_count, extension]