democloid / picoTracker

BSD 3-Clause "New" or "Revised" License
187 stars 17 forks source link

Add Script / Documentation on converting samples to a supported format. #208

Open simotek opened 1 month ago

simotek commented 1 month ago

I have tried a number of methods to convert samples into a format that will work on the picotracker. The most conservative was sox -S "$SAMPLE_DIR/$SAMPLE_PATH" -r 22050 -b 16 -c 1 -e unsigned-integer "samplelib/$SAMPLE_FOLDER/$SAMPLE_OUT.wav" with both the unsigned and signed 16 bit integer versions not working there are some samples at http://simotek.net/downloads/BassU22/

I have also tried using ffmpeg with no luck. So far i've found very few samples that will work out of the box.

maks commented 1 month ago

Thanks for reporting this @simotek 👍🏻 Definitely do need to document specifically what sample file formats are supported. I think @democloid is planning to work on this soon.

simotek commented 1 month ago

I also tried signed versions with

maks commented 1 month ago

so starting from this line, the code here is the source of truth on what wav file formats are supported.

Having a look at the code, it supports:

But interesting things to note:

  1. number of channels is used but never actually validated to be 1 or 2
  2. sample rate is stored and then used to adjust playback rate (see SampleInstrument 187)
  3. theres 3 magic number checks of various parts of the file metadata header, I'll need to look up what each of those parts of the header contain that they are checking

I'll try to break this code out into a little harness and then run tests on arm emu against various sample files to see if theres also possibly any bugs in that code, possibly due to endianess differences.

simotek commented 2 weeks ago

Interestingly the samples work fine with LGPT

maks commented 2 weeks ago

Interestingly the samples work fine with LGPT

@simotek VWould you know which version of LGPT you were using that worked? That would help with cross checking it's source with pT's to see what the difference is.

peterswimm commented 2 weeks ago

the things that would make legacy piggy barf the most is metadata in the wav header