Skip to content

Commit 0be18b8

Browse files
2 parents ec597eb + 04c06d5 commit 0be18b8

File tree

3 files changed

+136
-10
lines changed

3 files changed

+136
-10
lines changed

.github/workflows/compile-sketch.yml

Lines changed: 70 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ jobs:
3636
- examples/ml_epiano_example
3737
- examples/ml_mod_tracker
3838
- examples/ml_synth_basic_example
39-
- examples/ml_synth_fm_example
39+
#- examples/ml_synth_fm_example
4040
- examples/ml_synth_multi_saw_example
4141
- examples/ml_synth_organ_example
42-
- examples/ml_synth_pwm_osc_example
42+
#- examples/ml_synth_pwm_osc_example
4343
- examples/ml_synth_sampler_example
4444
libraries: |
4545
- source-url: https://github.com/marcel-licence/ML_SynthTools.git
@@ -109,6 +109,66 @@ jobs:
109109
- source-url: https://github.com/marcel-licence/AC101.git
110110
name: AC101
111111
112+
113+
build_rp2040:
114+
115+
name: build rp2040
116+
117+
runs-on: ubuntu-latest
118+
119+
strategy:
120+
matrix:
121+
fqbn:
122+
- rp2040:rp2040:rpipico
123+
124+
steps:
125+
- name: Checkout repository
126+
uses: actions/checkout@v4
127+
128+
with:
129+
submodules: 'true'
130+
131+
- name: Compile sketch
132+
uses: arduino/compile-sketches@v1
133+
with:
134+
fqbn: ${{ matrix.fqbn }}
135+
cli-compile-flags: |
136+
- --build-property
137+
- "build.usbstack_flags=-DUSE_TINYUSB -I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino"
138+
platforms: |
139+
- name: rp2040:rp2040
140+
source-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
141+
sketch-paths: |
142+
- examples/ml_epiano_example
143+
- examples/ml_mod_tracker
144+
- examples/ml_synth_basic_example
145+
#- examples/ml_synth_fm_example
146+
- examples/ml_synth_multi_saw_example
147+
- examples/ml_synth_organ_example
148+
#- examples/ml_synth_pwm_osc_example
149+
- examples/ml_synth_sampler_example
150+
libraries: |
151+
- source-url: https://github.com/marcel-licence/ML_SynthTools.git
152+
name: ML_SynthTools
153+
- source-url: https://github.com/marcel-licence/ML_SynthTools_Lib.git
154+
name: ML_SynthTools_Lib
155+
- source-url: https://github.com/adafruit/Adafruit-GFX-Library.git
156+
name: Adafruit_GFX_Library
157+
version: 1.10.10
158+
- source-url: https://github.com/adafruit/Adafruit_SSD1306.git
159+
name: Adafruit_SSD1306
160+
version: 2.4.5
161+
- source-url: https://github.com/adafruit/Adafruit_BusIO.git
162+
name: Adafruit BusIO
163+
version: 1.14.1
164+
- source-url: https://github.com/marcel-licence/AC101.git
165+
name: AC101
166+
- source-url: https://github.com/marcel-licence/ML_SynthTools.git
167+
name: ML_SynthTools
168+
- source-url: https://github.com/FortySevenEffects/arduino_midi_library.git
169+
name: MIDI_Library
170+
version: 5.0.2
171+
112172
build_stm32:
113173

114174
if: false
@@ -164,7 +224,7 @@ jobs:
164224
165225
build_teensy:
166226

167-
if: false
227+
if: true
168228

169229
name: build teensy
170230

@@ -188,16 +248,16 @@ jobs:
188248
platforms: |
189249
- name: teensy:avr
190250
source-url: https://www.pjrc.com/teensy/package_teensy_index.json
191-
version: 1.56.2
251+
version: 1.59.0
192252
sketch-paths: |
193-
- examples/ml_epiano_example
194-
- examples/ml_mod_tracker
253+
#- examples/ml_epiano_example
254+
#- examples/ml_mod_tracker
195255
- examples/ml_synth_basic_example
196256
- examples/ml_synth_fm_example
197-
- examples/ml_synth_multi_saw_example
198-
- examples/ml_synth_organ_example
199-
- examples/ml_synth_pwm_osc_example
200-
- examples/ml_synth_sampler_example
257+
#- examples/ml_synth_multi_saw_example
258+
#- examples/ml_synth_organ_example
259+
#- examples/ml_synth_pwm_osc_example
260+
#- examples/ml_synth_sampler_example
201261
libraries: |
202262
- source-url: https://github.com/marcel-licence/ML_SynthTools.git
203263
name: ML_SynthTools

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,13 @@ Some changes in the toolchain cause that the linker searches the lib in the cort
116116
---
117117

118118
Please feel free to share your experience and ideas.
119+
120+
## Support & Donations
121+
122+
If you appreciate the work done on this project and would like to support its development, I would be more than happy to accept donations!
123+
124+
For more information on how to donate, please send an email to:
125+
126+
127+
128+
Thank you for your support!

extras/ml_sampler.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Sampler
2+
This synthesizer module is made to playback samples from RAM or FLASH memory.
3+
It allows to manipulate the playback by changing the pitch, volume and tweak parameters like ADSR (attack, decay, sustain, release).
4+
In addition to that it is possible to loop samples.
5+
6+
To use the **sampler** you need to include ml_sampler.h into your project:
7+
```cpp
8+
#include <ml_sampler.h>
9+
10+
```
11+
12+
The sampler requires an initialization by calling its init routine for example from the setup():
13+
```cpp
14+
#include <ml_sampler.h>
15+
16+
#define SAMPLE_RATE 44100
17+
18+
void setup(void)
19+
{
20+
Sampler_Init(SAMPLE_RATE);
21+
/*
22+
* some other setup routines might be called here
23+
*/
24+
}
25+
```
26+
27+
28+
## playing samples from FLASH
29+
### preparing samples
30+
Samples can be played directly from FLASH when they are compiled into the program code.
31+
It is possible to convert wav-files into c files into a data array.
32+
For example prepare a 16bit mono wav-file and store it as test.wav.
33+
[Audacity](https://www.audacity.de/) can be used for this conversation
34+
![image](https://github.com/user-attachments/assets/7cbfe52e-24f7-45c9-a8a6-a54b0d1aa272)
35+
36+
Then you can use [Bin2c](https://www.segger.com/free-utilities/bin2c/) to convert it to a c-file.
37+
You will find an array in the c-file:
38+
```cpp
39+
static const unsigned char _actest[55164UL + 1] = {
40+
```
41+
which can be used as a sample in the sampler by loading it:
42+
```cpp
43+
#include <ml_sampler.h>
44+
45+
#define SAMPLE_RATE 44100
46+
47+
void setup(void)
48+
{
49+
Sampler_Init(SAMPLE_RATE);
50+
Sampler_NewSampleStatic(_actest, sizeof(_actest));
51+
/*
52+
* some other setup routines might be called here
53+
*/
54+
}
55+
```
56+
Now the sampler is ready to playback the loaded sample.

0 commit comments

Comments
 (0)