pd-externals / earplug

binaural filter based on KEMAR impulse measurement for Pd
GNU General Public License v2.0
14 stars 1 forks source link

earplug~.h #4

Closed chikashimiyama closed 3 years ago

chikashimiyama commented 3 years ago

this header file is very weird. the dataset [368][2][128] represent obviously 328 -> points in space 2 -> stereo 128 -> number of samples of IR.

but many data set are filled with the same number (like first IR are completely filled with -0.001343). When IR response is sampled with a dummy head, this could not happen.

chikashimiyama commented 3 years ago

The size of the data set in the header exactly matches the size of the data set in the text file. There is high possibility that somebody failed to convert the text file to header properly.

chikashimiyama commented 3 years ago

@danomatika

oh.. your code still refers to the IR data file. I thought the intention of the newer version is to get rid of the data .txt file and put the data in the header (so that less error-prone for the user when they copy the external object around in their file system)

It seems like this file overrides the data that comes from the header file but in the code, the file name earplug_data.txt doesn't exist as a result you are using the data from the header file, which contains completely "wrong" IR.

I just changed line 204

filedesc = open_via_path(canvasdir->s_name, "earplug_data.txt", "", buff, &bufptr, MAXPDSTRING, 0);

to

filedesc = open_via_path(canvasdir->s_name, "earplug_data_src.txt", "", buff, &bufptr, MAXPDSTRING, 0);

and it worked.

chikashimiyama commented 3 years ago

How should we proceed from here @danomatika

  1. do you want to have this "sane" IR dataset in the header file?
  2. do you want to get rid of the option to read another IR data?
    • if not, what kind of data format do you want to load
danomatika commented 3 years ago

Actually, it should still read the file but only if it exists. Before I started updating this external, it required reading the data file so it would fail if the file wasn’t there. I saw someone had also added the default dataset to the header, so I changed it to use that if the data file isn’t found. There should not be a file called earplug_data.txt here as people can create their own or adapt the earplug_data_src.txt which I simply renamed.

enohp ym morf tnes

Dan Wilcox danomatika.com robotcowboy.com

On Mar 30, 2021, at 10:01 AM, Chikashi Miyama @.***> wrote:

 How should we proceed from here @danomatika

do you want to have this "sane" IR dataset in the header file? do you want to get rid of the option to read another IR data? if not, what kind of data format do you want to load — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

danomatika commented 3 years ago

It's summarized in the readme:

https://github.com/pd-externals/earplug/blob/develop/README.txt#L33

Ideally, the header data should match the default dataset. If the order of the data is wrong, then it would be good to fix it. Perhaps someone made the header, then someone else changed how the data was ordered while loading the file and, since the file was always read before, they didn't notice. I'm not sure, but my goal was to remove the requirement of the external file.

danomatika commented 3 years ago

Also, please correct any incorrect terminology in the readme. I have only a basic understanding of how this algorithm works. :)

chikashimiyama commented 3 years ago

I made a new issue to fix the header file #6