GithubHelp home page GithubHelp logo

How to upload samples? about nesizer2 HOT 10 OPEN

KeenVox avatar KeenVox commented on August 27, 2024
How to upload samples?

from nesizer2.

Comments (10)

beau-seidon avatar beau-seidon commented on August 27, 2024 1

The source for gensysex is in this repo under tools, and can be compiled with gcc or another c compiler (I used msvc). I'll upload my Windows-compiled gensysex.exe after work. I'm also working on a script to batch-upload sysex files to Nesizer using midiox, to load whole drum/sample kits at a time.

from nesizer2.

Jaffe- avatar Jaffe- commented on August 27, 2024

If I recall correctly you can send samples when the system is in any mode. As soon as the MIDI receiver handling code sees a sysex command followed by SYSEX_CMD_SAMPLE_LOAD (0x01) it will change the global UI state into a "transfer mode". In this mode the 16 upper button LEDs will light up like a progress bar.

You can see in midi.c what is expected by this sysex command, but basically:

System Exclusive (0xF0)
MIDI_CMD_SAMPLE_LOAD (0x01)
<sample number> (0-127) (this is the number you use later to select this particular sample)
<sample type> (0: raw, 1: dpcm, only raw is supported at the moment so keep this at 0)
<sample length N, bits 0-7>
<sample length N, bits 8-13>
<sample length N, bits 14-20>
<data byte 0> (note: sample values are 7 bit unsigned) 
...
<data byte N-1>
End of Exclusive (0xF7)

What I did to load new samples was to first convert the sample from the source format (wav, mp3, whatever) to 7-bit unsigned audio. This can be done with a variety of tools, I believe I used SoX for this (in Linux). This produces the <data byte 0> to <data byte N-1> sequence above. I made a small script that read the file, added the rest that is shown above and wrote a resulting sysex file that could be sent over MIDI. I don't think I have that script around any more but it should not be hard to write.

from nesizer2.

KeenVox avatar KeenVox commented on August 27, 2024

Ah, okay. I will try it!

Thanks for you help, and for the fuse settings too. I'm relativly new to programming microcontroller outside of arduino, so I really appriciated the support!

from nesizer2.

Jaffe- avatar Jaffe- commented on August 27, 2024

Hi @KeenVox,

Really late follow-up, but I recently started working some more on this project to try and finish most of the features.

If you're still interested, I have now done some fixes to the code such that uploading and using samples is a bit more user friendly. I actually realized that the LED progress bar feature was actually never pushed to the git repository, but I have done that now.

I have also added a tool for generating a sysex file with the correct format.
To use this tool, you can look at the script convert-sample.sh. To put it short, convert the sample file to 16 kHz, 7-bit. unsigned raw format. SoX is a good utility for this, the script shows how to do this conversion for input files in wav format.

To create a sysex file from the converted raw sample, run the gensysex program like this:

./gensysex sample <index> <input raw sample file path> <sysex filename>

Where the index is which index you want the sample to have in the NESizer file system. Index 0 corresponds to MIDI note 60 (middle C). This is the note you will have to input on MIDI to trigger the sample on the DMC channel, or enter into the sequencer if making a pattern with DMC samples.

When you send the sysex data from the file, the NESizer should give you a progress bar on the LEDs, and the two digit display should show 'rr' (for now). If you see this, you can be sure that the NESizer is actually receiving the data and is storing it in memory. If it does not start, I would try to format the sample file system first, which is done by going into the settings mode/page and then pressing the 7th button on the second row.

from nesizer2.

beau-seidon avatar beau-seidon commented on August 27, 2024

Hell yes! I know what I'm doing this weekend :). I have been meaning to experiment with this to get some samples in, but have been super busy with work lately. I'm going to try it out with your script.

Probably better to post this on another thread since unrelated to samples, but over the next month or so I will try to add some MIDI CC callbacks to modify some of the voice parameters like duty and the envelopes etc., to match the Famimimidi MIDI implementation. It takes me a while because I'm still learning C/C++.

I'll finish the build guide from my notes first, like I said I'd do previously. It's about 40% done.

from nesizer2.

Jaffe- avatar Jaffe- commented on August 27, 2024

Hell yes! I know what I'm doing this weekend :). I have been meaning to experiment with this to get some samples in, but have been super busy with work lately. I'm going to try it out with your script.

Probably better to post this on another thread since unrelated to samples, but over the next month or so I will try to add some MIDI CC callbacks to modify some of the voice parameters like duty and the envelopes etc., to match the Famimimidi MIDI implementation. It takes me a while because I'm still learning C/C++.

That would be really great! I'd be happy to review a pull-request and get this in.

I'll finish the build guide from my notes first, like I said I'd do previously. It's about 40% done.

Really great work of you to make a build guide and updated BOM. I also would like to get the gerber files uploaded so people can order this without having the PCB tool. Don't know why I didn't do that already...

from nesizer2.

KeenVox avatar KeenVox commented on August 27, 2024

from nesizer2.

Jaffe- avatar Jaffe- commented on August 27, 2024

Probably better to post this on another thread since unrelated to samples, but over the next month or so I will try to add some MIDI CC callbacks to modify some of the voice parameters like duty and the envelopes etc., to match the Famimimidi MIDI implementation. It takes me a while because I'm still learning C/C++.

Regarding another thread for this, please make one under Discussion (instead of Issues), I added that feature to the repository now :)
Also, I pushed a commit yesterday which changes the Makefile to compile the sources with -O2 instead of -O3 optimization level. This reduced the flash size from ~30 kB to ~22 kB (less aggressive unrolling of loops and branches), so there should be enough room to implement more features now.
I did some quick testing that things still run fast enough, and it seems like it is.

from nesizer2.

jeff464 avatar jeff464 commented on August 27, 2024

I would also like to know how to upload samples to the NESizer. I converted my audio file to the proper format using sox, but I'm not sure what "run the gensysex program like this: ./gensysex sample " means in this context. The windows command line just errors out and double clicking the file sends me to VSC to edit it.

from nesizer2.

beau-seidon avatar beau-seidon commented on August 27, 2024

gensysex.zip

here are the gensysex and deltacompress windows executables used to convert samples. you shouldn't need to do anything with dc.

take a look at the .sh script in tools to see how the process is automated in linux. it shows the syntax for calling gensysex in a terminal. I have a .sh and .bat script for converting big batches of samples, but I have some tweaks to make before I upload them.

I also have a little bit of experimenting to do regarding the indexing of samples (mapping to MIDI notes), which may lead to a wishlist item of my own.

the task I'm having a little bit of trouble with is learning the COM scripting API for midi-ox. when I figure that out I'll upload the script for batch upload too.

from nesizer2.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.