Dynamic filenames


#1

Hey Guys,
I just wanted to use axoloti as an easy sampler.
So i uploaded files on the sdcard which match their corresponding midi note.
For example when I get midi note 60 i want the file 60.wav to be played, when i press note 89 i want 89.wav to be played untill i leave the key on my midi keyboard and so on for the other samples.

i tried it with the object called string/indexed but it wont play back anything.
here is my try:
screenshot:
https://app.box.com/s/w9bk73161clztf4mtnfnovogdsrfy8j7
patchfile:
https://app.box.com/s/gcetrmqgamhfshyrddkzedujcqsvjltw

Does anyone know what i m doing wrong?

best wishes and a happy new year,
Flub


#2
  • string/indexed will always use 3 digits for the number, so 089.wav if you just specify .wav as suffix and no prefix.
  • check object execution order, very important here, otherwise you'll get trigger the playback of the previous note number with a new note.

#3

I havent done much with the sampler yet, but have you been able to get just a single sample to be played? I know there are specific requirments around the format of the sample:


#4

Wow, thank you for your super fast answer = )
I added a zero before every two digit filename. thats the solution, thanks johannes!
Now i can play back the different samples... if you look at the screenshot, do you know an easier way to make the samples play as long as the key is pressed?

Just another quick question so i can avoid making a hole topic out of it.
When i use the Midi/in/keyb note object and set its value to 20, then go live and press midi key 20 i get no gate signal.
So it seems that this selective midi input doesnt work...

-Flo


#5

keyb gate->logic/inv->stop inlet

Or, do not stop the sample at all but use an envelope to mute it...

Should work, sure about the midi channel?


#6

I tried all midi channels, it still doesnt work with the keyb note object but always works with the midi/in/keyb object
I made a screenshot of the midi/in/keyb note problem. On the screen you can see the GUI while i am pressing key 26 on my usb midi keyboard which is connected to the axoloti.
Screenshot:
https://app.box.com/s/kucjygcaodv1xav6jjh2jqu1cvlzgbe8

thank you for the hint about the logic inv object, i will try the logic/inv object to play a sample only as long as the key is pressed ...

is there a documentation about the objects?


#7

Wires carry midi note numbers with 64 units offset (whole keyboard range is -64..53, 0 is note E4).
The "midi/in/keyb note" object expects midi note number without offset (0..127).

The reason for offsetting midi note numbers is that oscillators can be tuned to an audible frequency when the pitch inlet is unconnected. Unconnected inlets are assumed to be zero.

Object documentation: there are hints that show up when hovering the mouse over inlets, outlets, parameters, and the object title bar. Often example and test patches are referenced through the object popup menu (little upside down triangle in the object title bar, select help).


#8

Cool that was it ! Is there a possibiliy to do automate many sample voices like midi -> sample mapping?
This is my patch and i wonder if i have to manually create the next Midi note in -> sample playback pairs.
Screenshot:
https://app.box.com/s/bz3xxpfvfby3xmcr3mvqf9peetq47c88


#9

I've been working on a similar patch last week. This one switches between 4 sample players so you can play samples on top of each other when the notes don't start at the same time. Still looking for a polyphonic solution to create sample-based drum machines where notes can start at the same time.

samplebank2.axp (8.4 KB)


Has anyone tried a Mellotron patch?
#10

I just copy and pasted a new object together, sadly it doesnt work as polyphonic subpatch.
Is there anywhere an explanation about how the polyphonic functionalities are organized?

my object folder as rar package:
https://app.box.com/s/ef8pansi411v2yi5swrzdd0c0tr5h93n

my object has to be in the same folder as sdbenchmark.h and streamer.h, it is called midi_sampler. its actually just a packed version of playing back midinotenumber.wav (ex 065.wav, 122.wav, 050.wav etc) from sdcard.

I would like to make it possible to use it in polyphonic mode, but i dont know how at the moment.
I think I have to somehow create more than one sdcardstream :(see at the Line where it says sdCardOpen(stream...)
:: if ((status == MIDI_NOTE_ON + attr_midichannel) && (data2)) {
sdOpenStream(stream, &c[0]);
sdSeekStream(stream,(0>>4)< _note = data1;
_velo = data2;
_gate = 1;
} else if (((status == MIDI_NOTE_ON + attr_midichannel) && (!data2)) || (status == MIDI_NOTE_OFF + attr_midichannel)) {
sdCloseStream(stream);
_rvelo = data2;
_gate = 0;


#11

What does actually happen when using a polyphonic subpatch? How do i have to structure my object to make it work with that functionality?


#12

polyphonic objects will create multiple instances of each of the objects in the voice. so assuming you are using instance or locals variables it should 'just work'
if your a C/C++ programmer the best advice is to have a look at the generated xpatch.cpp, its pretty simple to see whats going on.
( iirc the instances are an array... its pretty obvious, but I don't have a copy of the code in front of me)

I've not checked your object, are you sure it... or something it depends on, is not using a static that could perhaps be getting overwritten?


#13

(info for developers)
Reading data from sdcard requires the destination memory to be capable of DMA, not all memory areas can do that.
To declare memory in a DMA capable section,
static sdReadFilePingpong s __attribute__ ((section (".data")));
is used.
But since it is declared static it is only allocated once and shared for all instances of the class. That's the problem you're observing I believe.
The solution is statically declaring an array of buffers:

static sdReadFilePingpong s[attr_poly] __attribute__ ((section (".data")));
// unmap from aliased memory for DMA
stream = (sdReadFilePingpong *)(0x20000000 | (int)&s[parent->polyIndex]);

this should work both in a polyphonic subpatch as in an ordinary subpatch. Table allocation for use with sdram use the same approach. I just made a commit, care to test?


#14

I am kind of a chaotic try and error programmer :grimacing:

If i understood you right then i dont have to put this array of buffers into my object but you changed something i can test after git pull and build your new commit?
I will try to do this and see if polyphonic sample playback from sdcard works .

thank you !


#15

yes


please tell me if this works


#16

it seems that it doesnt work :

Start compiling patch
BDIR = C:\Users\Flo\DOCUME~1\axoloti/build
FIRMWARE = .
"RM"
rm -f C:\Users\Flo\DOCUME~1\axoloti/build/xpatch.o C:\Users\Flo\DOCUME~1\axoloti/build/xpatch.elf C:\Users\Flo\DOCUME~1\axoloti/build/xpatch.bin C:\Users\Flo\DOCUME~1\axoloti/build/xpatch.d C:\Users\Flo\DOCUME~1\axoloti/build/xpatch.map C:\Users\Flo\DOCUME~1\axoloti/build/xpatch.lst
"APP"
arm-none-eabi-g++ -nostdlib -fno-exceptions -fno-rtti -mcpu=cortex-m4 -O3 -fomit-frame-pointer -falign-functions=16 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsingle-precision-constant -Wunused-parameter -DCORTEX_USE_FPU=TRUE -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -mthumb -DTHUMB -std=c++11 -DARM_MATH_CM4 -D__FPU_PRESENT -H -IC:\PROGRA~2\Axoloti\app/CMSIS/Include -IC:\PROGRA~2\Axoloti\app/chibios/os/ports/common/ARMCMx/CMSIS/include -IC:\PROGRA~2\Axoloti\app/chibios/os/ports/common/ARMCMx -IC:\PROGRA~2\Axoloti\app/chibios/os/ports/GCC/ARMCMx -IC:\PROGRA~2\Axoloti\app/chibios/os/ports/GCC/ARMCMx/STM32F4xx -IC:\PROGRA~2\Axoloti\app/chibios/os/kernel/include -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/include -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32F4xx -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32 -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32/GPIOv2 -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32/I2Cv1 -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32/OTGv1 -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32/RTCv2 -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32/SPIv1 -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32/TIMv1 -IC:\PROGRA~2\Axoloti\app/chibios/os/hal/platforms/STM32/USARTv1 -IC:\PROGRA~2\Axoloti\app/chibios/boards/ST_STM32F4_DISCOVERY -IC:\PROGRA~2\Axoloti\app/chibios/ext/fatfs/src -I. -IC:\PROGRA~2\Axoloti\app/chibios -Winvalid-pch -MD -MP --include C:\Users\Flo\DOCUME~1\axoloti/build/xpatch.h -c C:\Users\Flo\DOCUME~1\axoloti/build/xpatch.cpp -o C:\Users\Flo\DOCUME~1\axoloti/build/xpatch.o
! C:\Users\Flo\DOCUME~1\axoloti/build/xpatch.h.gch
. C:/Program Files (x86)/Axoloti/app/objects/wave/streamer.h
. C:\Program Files (x86)\Axoloti\app\chibios/ext/fatfs/src/ff.h
Multiple include guards may be useful for:
C:/Program Files (x86)/Axoloti/app/objects/wave/streamer.h
LINK
arm-none-eabi-gcc -nostartfiles -Tramlink.ld -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mno-thumb-interwork C:\Users\Flo\DOCUME~1\axoloti/build/xpatch.o -Wl,-Map=C:\Users\Flo\DOCUME~1\axoloti/build/xpatch.map,--cref,--just-symbols=./build/axoloti.elf -o C:\Users\Flo\DOCUME~1\axoloti/build/xpatch.elf
c:/program files (x86)/axoloti_runtime/platform_win/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld.exe: C:\Users\Flo\DOCUME~1\axoloti/build/xpatch.elf section .data' will not fit in regionSRAM'
c:/program files (x86)/axoloti_runtime/platform_win/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld.exe: region `SRAM' overflowed by 91660 bytes
collect2.exe: error: ld returned 1 exit status
make: *** [C:\Users\Flo\DOCUME~1\axoloti/build/xpatch.bin] Error 1
shell task failed, exit value: 1
Compiling patch failed ( C:\Users\Flo\Documents\axoloti_patches\raumsamples\allesamples2.axp )


#17

using too much SRAM try reducing any table sizes etc, or the number of voices.


#18

i tried it with only one voice... my samples are only about 200kb big

EDIT: I think it was my fault i accidently used a axoloti patcher version which was compiled without the changes in src/main/java/generatedobjects/Wave.java

I ll try it with the right version and give a feedback.


#19

Cool, It works more or less now. Thank you very much!

check object execution order, very important here, otherwise you'll get
trigger the playback of the previous note number with a new note.

I dont get the order of the object so that the filename is set before the sample is played back.
the patch is almost like this now : https://app.box.com/s/w9bk73161clztf4mtnfnovogdsrfy8j7

EDIT: i just changed the two lines you changed in wav/play in my own objects code. it works fine now.
midi_sampler.axo (3.2 KB)