lostanlen / scattering.m

Scattering.m — a MATLAB toolbox for wavelet scattering
MIT License
56 stars 11 forks source link

Some errors when running the example files #44

Open blibliki opened 4 years ago

blibliki commented 4 years ago

Hello and thank you again for these wonderful tools!

As I was running the examples to get a grasp of how things work, some of the scripts gave me errors. It would be really helpful if you could offer some insight into them (especially the first 3).

in the research folder:

///////////////////////////////////////////////////////////////////////////////////

  1. all the examples in the recspiral folder gave the following error:

--chordsjoint_1015 Reference to non-existent field 'verbosity_period'.

Error in sc_reconstruct (line 160) mod_iteration = mod(iteration,reconstruction_opt.verbosity_period);

Error in chordsjoint_1015 (line 47) sc_reconstruct(target_signal, archs, reconstruction_opt);

///////////////////////////////////////////////////////////////////////////////////

  1. In the finitediffs folder the ravel_script.m gave the following error:

Brace indexing is not supported for variables of this type.

Error in U_to_Y (line 8) banks{1}.behavior.U.is_scattered && ...

Error in ravel_script (line 63) target_Y{layer} = U_to_Y(target_U{1+previous_layer},arch);

///////////////////////////////////////////////////////////////////////////////////

  1. All the scripts in the folder tfns15 gave the following error:

--sequenza_joint Error using sc_reconstruct Too many input arguments.

Error in sequenza_joint (line 34) sc_reconstruct(target_S,archs,rec_opt,nIterations);

///////////////////////////////////////////////////////////////////////////////////

  1. in the folder comren19 cras19_fig2 gave the following error:

--cras19_fig2 Dot indexing is not supported for variables of this type.

Error in cras19_fig2 (line 44) S{3}{1,1}.data{j2}{1}(1, j1, 2);

///////////////////////////////////////////////////////////////////////////////////

  1. in the mlsp15_companion probably error because of missing "dataset22k"

Index exceeds array bounds.

Error in mlsp_companion (line 11) file_name = file_infos(file_index).name;

///////////////////////////////////////////////////////////////////////////////////

  1. In the mlsp15 when running mlsp_synthesize_mcdermott.m (I didn't find the mcdermott_toolbox online, I only found Sound_Texture_Synthesis_Toolbox).

Undefined function or variable 'run_synthesis'.

Error in mlsp_synthesize_mcdermott (line 6) run_synthesis(P);

/////////////////////////////////////////////////////////////////////////////////

  1. in the examples folder the example_plain

--example_plain Reference to non-existent field 'verbosity_period'.

Error in sc_reconstruct (line 160) mod_iteration = mod(iteration,reconstruction_opt.verbosity_period);

Error in example_plain (line 57) sc_reconstruct(signal, archs, reconstruction_opt);

/////////////////////////////////////////////////////////////////////////////////

Thank you for you time! Any info would be really appreciated.

lostanlen commented 4 years ago

Hello @blibliki, thank you for reporting

  1. --chordsjoint_1015 Reference to non-existent field 'verbosity_period'.

Solved in 42fe487

lostanlen commented 4 years ago
  1. In the finitediffs folder the ravel_script.m gave the following error: Brace indexing is not supported for variables of this type.

Solved in d3381dd

lostanlen commented 4 years ago
  1. All the scripts in the folder tfns15 gave the following error:
    --sequenza_joint
    Error using sc_reconstruct
    Too many input arguments.

Solved in 519be2c

lostanlen commented 4 years ago
  1. in the folder comren19 cras19_fig2 gave the following error:
    --cras19_fig2
    Dot indexing is not supported for variables of this type.

Solved in 3739a10

lostanlen commented 4 years ago
5. in the mlsp15_companion probably error because of missing "dataset22k"

Yes, create your own dataset at 22k sample rate and you will be able to run the script.

lostanlen commented 4 years ago
  1. In the mlsp15 when running mlsp_synthesize_mcdermott.m (I didn't find the mcdermott_toolbox online, I only found Sound_Texture_Synthesis_Toolbox)

Rename Sound_Texture_Synthesis_Toolbox to mcdermott_toolbox

lostanlen commented 4 years ago
  1. In the examples folder the example_plain
    --example_plain
    Reference to non-existent field 'verbosity_period'.

Solved alongside 1.

I hope this helps!

blibliki commented 4 years ago

Thank you @lostanlen for your quick response, you have been really helpful!

I am sorry for posting on a closed issue, but I am not fully familiar with the issue etiquette and thought it would be noisier if I created a new issue for a similar topic. (please let me know if I did wrong for future reference).

In the past few days I tried all the scripts (as given and with variations) and unfortunately some of them still gave me errors which I cannot understand.

///////////////////////////////////////////////////////////////////////////////////

  1. a) All the scripts in tfns15 give the following error:
    
    sequenza_spiral
    Error using sc_reconstruct
    Too many output arguments.

Error in sequenza_spiral (line 40) sc_reconstruct(target_S,archs,rec_opt);

////////////////

   1.  b)  I get the same error when I just try to run something similar like this:

file_path = '\audioTest_3.wav'; [full_waveform, sample_rate] = audioread_compat(file_path); N=2^16; target_signal= original_waveform(1:N); Q = 8; opts{1} = default_auditory(length(target_signal),sample_rate,Q); opts{2}.time = struct(); archs = sc_setup(opts); target_S = sc_propagate(target_signal,archs); reconstruction_opt = fill_reconstruction_opt(struct()); [rec_signal,rec_summary] = sc_reconstruct(target_S,archs,reconstruction_opt);

///////////////////////////////////////////////////////////////////////////////////

   2.  The **ravel_script** gives the following error:

ravel_script Not enough input arguments.

Error in update_reconstruction (line 4) if reconstruction_opt.is_regularized

Error in ravel_script (line 123) update_reconstruction(previous_signal,delta_signal,reconstruction_opt);

 I saw the input args of "update_reconstruction" which were
"signal, delta_signal, signal_update, learning_rate, reconstruction_opt" and tried adding "reconstruction_opt.signal_update" and "reconstruction_opt.learning_rate" but they cannot be placed there.

///////////////////////////////////////////////////////////////////////////////////

   3.   For the **mlsp_synthesize_mcdermott.m**  and also for the **tsp19\synthesis\tsp19_mcdermott.m**  
I changed the name as you previously suggested, initially it  seems it loads the toolbox fine but then gives an error. I guess its a missing function from the mcdermott toolbox and has nothing to do with the scattering.m , but if missing from toolbox how did you run the code?

mlsp_synthesize_mcdermott Undefined function 'minimize' for input arguments of type 'struct'.

Error in impose_env_stats (line 91) [updated_subband_env, cost_fn_history, ~] = minimize(new_subband_envs(:,current_sub_num),

'total_stat_cost_fn_and_grad', num_line_searches,...

Error in run_synthesis (line 209) [new_envs] = impose_env_stats(synth_subband_envs, P, target_S, ...

Error in mlsp_synthesize_mcdermott (line 6) run_synthesis(P);

///////////////////////////////////////////////////////////////////////////////////

   4.  in  **comren19**  the **cras19_fig2**  plots the 'Wavelet scalogram' and then gives the following error:

cras19_fig2 Error using plot Invalid color value.

Error in cras19_fig2 (line 84) plot([6, 6], [0, 29], ...

///////////////////////////////////////////////////////////////////////////////////

   5. in **eca** the **resynthesize_file.m**  when added a folder of 20ms - 40ms  files, it gave the following error:

Starting parallel pool (parpool) using the 'local' profile ... connected to 4 workers. Error using dual_secondborn_blur (line 25) Index in position 2 exceeds array bounds (must not exceed 2).

Error in dual_blur_dY (line 25) dual_secondborn_blur(sub_dY.data, invariant, sub_dY.ranges, sibling);

Error in dS_backto_dY (line 11) layer_dY{start_index} = dual_blur_dY(layer_dS,invariants{start_index});

Error in backpropagate_layer (line 43) layer_dY{1+0} = dS_backto_dY(layer_dS, arch);

Error in sc_backpropagate (line 20) backpropagate_layer(layer_dS, layer_dU, layer_Y, layer_U, arch);

Error in eca_synthesize (line 89) parfor batch_index = 0:(nBatches-1)

Error in eca_synthesize_dir (line 27) [sounds, texts] = eca_synthesize(y, archs, opts);

Error in resynthesize_file (line 31) eca_synthesize_dir(archs, sounds_folder, opts)


and when added a different folder with wav files all of 16sec duration had the following error:

Elapsed time is 5.065261 seconds. Reference to non-existent field 'T'.

Error in unchunk_data (line 22) nHops_per_chunk = chunk_length (1 - 2root_leaf.T/root_leaf.size);

Error in unchunk_data (line 11) unchunked_data{cell_index} = unchunk_data(data_cell, root_leaf);

Error in unchunk_layer (line 26) unchunked_layer.data = unchunk_data(layer.data, root_leaf);

Error in sc_unchunk (line 8) unchunked_S{1+layer_index} = unchunk_layer(S{1+layer_index});

Error in eca_synthesize (line 143) scalogram = display_scalogram(sc_unchunk(U(2)));

Error in eca_synthesize_dir (line 27) [sounds, texts] = eca_synthesize(y, archs, opts);

Error in resynthesize_file (line 31) eca_synthesize_dir(archs, sounds_folder, opts)

///////////////////////////////////////////////////////////////////////////////////

Maybe this goes off topic, but I wanted to ask about the amount of time  that the transformations  and reconstructions take in general to compute. I placed some of my audio files in the  in the format of the **recspiral** folder examples  and according to their length the timing was as follows:

for joint:
Elapsed time is **108.675444** seconds for **5** iteration of **2^16** length
Elapsed time is around **30min**  for **100** iteration of **2^16** length 

Elapsed time is **3743.506540** seconds. for **5** iteration of **2^18** length
Elapsed time is **48089.995241** seconds.for **50** iteration of **2^18** length

for spiral:
Elapsed time is **2601.333253** seconds. for **5** iterations of **2^16** length

I noticed that when wanted to analyse and re-synthesize a duration of greater than 2^16 the timing did not increase proportionally to the length of the audio, but much more. Also with spiral scattering time increases significantly. Are these times normal and can they become more manageable?

If I wanted to do re-synthesis of a 1 min audio for instance, would that be possible? 
As you say in the documentation "Long signals are processed by constant-sized chunks" would that make things faster if the chunks were of the size 2^16 or even lower at 2^10?

I saw on the scattering options  that there is the  "opts{1}.time.is_chunked = true; "
and on the "reconstruction options" ,   the   'nChunks_per_batch' where you can specify how many chunks.  Do I need to specify this in both scattering and reconstruction options?

In order for this to work for a signal of length 2^23 and chunks 2^16 do I need to do something like the following: 

file_path = '\audioTest_3.wav'; [full_waveform, sample_rate] = audioread_compat(file_path); N=2^23; target_signal= original_waveform(1:N); Q = 8;

opts{1}.time.size = 2^23; opts{1}.time.T = 2^16; %opts{1}.time.max_Q = 16;
opts{1}.time.is_chunked = true;

opts{2}.time.size = 2^23; opts{2}.time.T = T; opts{2}.time.is_chunked = true;

archs = sc_setup(opts); target_S = sc_propagate(target_signal,archs);

rec_opt.nChunks_per_batch= 128;
reconstruction_opt = fill_reconstruction_opt(rec_opt); [rec_signal,rec_summary] = sc_reconstruct(target_S,archs,reconstruction_opt);



Any help with these would be really great since this is a very exciting toolbox to work with!

Thank you again!
blibliki commented 4 years ago

Hi @lostanlen and happy new year! Any chance of addressing the above issues?

Thank you anyway!!