wav2gig and unity note

You're new to the LinuxSampler world? You don't know where to start and nothing works? Here's the place to ask for help.
Post Reply
kokomo
Newbie
Posts: 2
Joined: Fri Aug 20, 2021 3:07 pm

wav2gig and unity note

Post by kokomo » Sat Aug 21, 2021 2:56 pm

Hello all,

I'm currently converting a bunch of wav-samples to several gig-files and wrote a bash-script to do that by invoking wav2gig.
The samples are named according to the proposed scheme, the gig files show the right (one note) regions per sample. Unfortunately, the 'Unity note' in gigedit is C4 for all and each sample, so I would have to set this for each sample to the corresponding note manually in gigedit.
Example:
'TP - 1SS - 64 - 065 - F3.wav'
shows the correct range as of F3 (midi note 65), but the 'Unity note' is still C4, so when playing that note, the tone has the wrong pitch.

- Is there a way to automate this?
- Is it possible, to implement a switch in wav2gig to set the 'Unity note' to the corresponding note, the range is created with?
- Or am I doing something wrong?

Thanks and best regards,
Kolja

User avatar
cuse
Developer
Posts: 366
Joined: Wed Jan 23, 2008 10:07 pm
Location: Germany

Re: wav2gig and unity note

Post by cuse » Tue Aug 24, 2021 2:46 pm

kokomo wrote:
Sat Aug 21, 2021 2:56 pm
Example:
'TP - 1SS - 64 - 065 - F3.wav'
shows the correct range as of F3 (midi note 65), but the 'Unity note' is still C4, so when playing that note, the tone has the wrong pitch.

- Is there a way to automate this?
ATM (a) loop points, (b) unity note (a.k.a. "root note") and (c) fine tuning are taken directly from the .wav files, because these are standard information stored in .wav files and supported by most audio editors for decades. Here is the relevant section in line 347 in wav2gig.cpp:
http://svn.linuxsampler.org/cgi-bin/vie ... arkup#l347
kokomo wrote:
Sat Aug 21, 2021 2:56 pm
- Is it possible, to implement a switch in wav2gig to set the 'Unity note' to the corresponding note, the range is created with?
- Or am I doing something wrong?
The wav2gig command line tool was added to libgig just 2 weeks. It is really just a first version. Obviously there are still plenty of things that can be improved. Allowing to specify the unity like you proposed would be a candidate, but also things like making the naming scheme configurable from the command line instead of hard coded.

I recommend you to just hack the wav2.gig.cpp source file to your personal needs for now. Function getWavInfo() already extracts the note number from the wav file name in line 308:
http://svn.linuxsampler.org/cgi-bin/vie ... arkup#l308

So you can just add a line in function createSample() to use that info instead if the .wav file does not contain it already, i.e. something like:

Code: Select all

if (wav->hasSfInst) {
    ...
} else {
    s->MIDIUnityNote = wav->note;
}
And ... like always, patches appreciated!

https://sourceforge.net/projects/linuxs ... pler-devel

kokomo
Newbie
Posts: 2
Joined: Fri Aug 20, 2021 3:07 pm

Re: wav2gig and unity note

Post by kokomo » Tue Aug 24, 2021 9:20 pm

Hi,
thanks a lot for your taking the time answer that detailed!
cuse wrote:
Tue Aug 24, 2021 2:46 pm
ATM (a) loop points, (b) unity note (a.k.a. "root note") and (c) fine tuning are taken directly from the .wav files, because these are standard information stored in .wav files and supported by most audio editors for decades. Here is the relevant section in line 347 in wav2gig.cpp:
http://svn.linuxsampler.org/cgi-bin/vie ... arkup#l347
Ok, I didn't know that.
cuse wrote:
Tue Aug 24, 2021 2:46 pm
I recommend you to just hack the wav2.gig.cpp source file to your personal needs for now. Function getWavInfo() already extracts the note number from the wav file name in line 308:
http://svn.linuxsampler.org/cgi-bin/vie ... arkup#l308

So you can just add a line in function createSample() to use that info instead if the .wav file does not contain it already, i.e. something like:

Code: Select all

if (wav->hasSfInst) {
    ...
} else {
    s->MIDIUnityNote = wav->note;
}
Cool, that worked like a charm, thanks!
but also things like making the naming scheme configurable from the command line instead of hard coded.
Yes, that would be great. I already have some ideas regarding this and will post them.
And ... like always, patches appreciated!
:D Good to know! Although I do some programming, I never really 'patched' before. I'll look into the code of wav2gig more deeply and participate in the mailinglist, when I'm ready to contribute.

Cheers,
Kolja

User avatar
cuse
Developer
Posts: 366
Joined: Wed Jan 23, 2008 10:07 pm
Location: Germany

Re: wav2gig and unity note

Post by cuse » Thu Aug 26, 2021 4:01 pm

kokomo wrote:
Tue Aug 24, 2021 9:20 pm
:D Good to know! Although I do some programming, I never really 'patched' before. I'll look into the code of wav2gig more deeply and participate in the mailinglist, when I'm ready to contribute.

Cheers,
Kolja

Code: Select all

svn co https://svn.linuxsampler.org/svn/libgig/trunk libgig
cd libgig
[ ... edit source code ... ]
svn diff > ../foo.patch
This is a small project. So it is not so complicated as with larger projects which often have very strict formal requirements how patches should look like and even how being sent.

User avatar
cuse
Developer
Posts: 366
Joined: Wed Jan 23, 2008 10:07 pm
Location: Germany

Re: wav2gig and unity note

Post by cuse » Wed Sep 08, 2021 1:33 pm

Just for the records, this discussion has moved to the mailing list:
https://sourceforge.net/p/linuxsampler/ ... sg37341010

Post Reply