Skip to content

Commit 1d60eb7

Browse files
committed
Initial Commit
0 parents  commit 1d60eb7

File tree

791 files changed

+160765
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

791 files changed

+160765
-0
lines changed

.gitignore

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# For PCBs designed using KiCad: http://www.kicad-pcb.org/
2+
# Format documentation: http://kicad-pcb.org/help/file-formats/
3+
4+
# Temporary files
5+
*.000
6+
*.bak
7+
*.bck
8+
*.kicad_pcb-bak
9+
*.sch-bak
10+
*~
11+
_autosave-*
12+
*.tmp
13+
*-save.pro
14+
*-save.kicad_pcb
15+
fp-info-cache
16+
17+
# Netlist files (exported from Eeschema)
18+
*.net
19+
20+
# Autorouter files (exported from Pcbnew)
21+
*.dsn
22+
*.ses
23+
24+
# Exported BOM files
25+
*.xml
26+
*.csv
27+
28+
Firmware/build
29+
Firmware/openocd_picoprobe
30+
Hardware/gerber
31+
Hardware/tdm_*
32+
Enclosure/backplate_gerbers
33+
Enclosure/frontplate_gerbers
34+
Enclosure/temp
35+
36+
*.pdb
37+
Enclosure/frontplate/frontplate-backups
38+
Enclosure/frontplate_gerbers.zip
39+
Hardware/kicad_project/tdm_v6-backups
40+
Hardware/gerber.zip
41+
Hardware/audcalc/audcalc-backups

Docs/ImageWithHeads.png

1.01 MB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"node":"DMA","expanded":true,"format":0,"pinned":false}]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]

Firmware/.vscode/launch.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Pico Debug",
6+
"type":"cortex-debug",
7+
"cwd": "${workspaceRoot}",
8+
"executable": "${command:cmake.launchTargetPath}",
9+
"request": "launch",
10+
"servertype": "external",
11+
// Connect to an already running OpenOCD instance
12+
"gdbTarget": "localhost:3333",
13+
"svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",
14+
"runToMain": true,
15+
// Work around for stopping at main on restart
16+
//"postRestartCommands": [
17+
// "break main",
18+
// "continue"
19+
//]
20+
}
21+
]
22+
}

Firmware/.vscode/settings.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
// These settings tweaks to the cmake plugin will ensure
3+
// that you debug using cortex-debug instead of trying to launch
4+
// a Pico binary on the host
5+
"cmake.statusbar.advanced": {
6+
"debug": {
7+
"visibility": "hidden"
8+
},
9+
"launch": {
10+
"visibility": "hidden"
11+
},
12+
"build": {
13+
"visibility": "hidden"
14+
},
15+
"buildTarget": {
16+
"visibility": "hidden"
17+
}
18+
},
19+
"cmake.buildBeforeRun": true,
20+
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
21+
"cmake.configureArgs": [
22+
"-D\"PICO_BOARD=TDM_BOARD\""
23+
],
24+
"cortex-debug.variableUseNaturalFormat": false,
25+
"files.associations": {
26+
"voice_data.h": "c",
27+
"random": "cpp",
28+
"*.tcc": "cpp"
29+
},
30+
"C_Cpp.dimInactiveRegions": false
31+
}

Firmware/.vscode/tasks.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "build",
8+
"type": "cmake",
9+
"command": "build",
10+
"problemMatcher": [],
11+
"group": {
12+
"kind": "build",
13+
"isDefault": true
14+
}
15+
}
16+
]
17+
}

Firmware/ADSREnvelope.h

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
// Copyright 2012 Emilie Gillet.
2+
//
3+
// Author: Emilie Gillet ([email protected])
4+
//
5+
// This program is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
// This program is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
// You should have received a copy of the GNU General Public License
14+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
16+
#ifndef TDM_ENVELOPE_H_
17+
#define TDM_ENVELOPE_H_
18+
19+
#include "audio/dsp.h"
20+
#include "audio/resources.h"
21+
#include "pico/stdlib.h"
22+
namespace braids {
23+
24+
using namespace stmlib;
25+
26+
enum ADSREnvelopeSegment {
27+
ADSR_ENV_SEGMENT_ATTACK = 0,
28+
ADSR_ENV_SEGMENT_DECAY = 1,
29+
ADSR_ENV_SEGMENT_DEAD = 2,
30+
ADSR_ENV_NUM_SEGMENTS,
31+
};
32+
33+
class ADSREnvelope {
34+
public:
35+
ADSREnvelope() { }
36+
~ADSREnvelope() { }
37+
38+
void Init() {
39+
target_[ADSR_ENV_SEGMENT_ATTACK] = 65535;
40+
target_[ADSR_ENV_SEGMENT_DECAY] = 0;
41+
target_[ADSR_ENV_SEGMENT_DEAD] = 0;
42+
increment_[ADSR_ENV_SEGMENT_DEAD] = 0;
43+
priorValue_ = 0;
44+
}
45+
46+
inline ADSREnvelopeSegment segment() const {
47+
return static_cast<ADSREnvelopeSegment>(segment_);
48+
}
49+
50+
inline void Update(int32_t a, int32_t d) {
51+
increment_[ADSR_ENV_SEGMENT_ATTACK] = lut_env_portamento_increments[a];
52+
increment_[ADSR_ENV_SEGMENT_DECAY] = lut_env_portamento_increments[d];
53+
}
54+
55+
inline void Trigger(ADSREnvelopeSegment segment) {
56+
if (segment == ADSR_ENV_SEGMENT_DEAD) {
57+
value_ = 0;
58+
}
59+
a_ = value_;
60+
b_ = target_[segment];
61+
priorValue_ = value_;
62+
segment_ = segment;
63+
phase_ = 0;
64+
}
65+
66+
inline uint16_t Render() {
67+
uint32_t increment = increment_[segment_]>>7;
68+
phase_ += increment;
69+
if (phase_ < increment) {
70+
value_ = Mix(a_, b_, 65535);
71+
Trigger(static_cast<ADSREnvelopeSegment>(segment_ + 1));
72+
}
73+
if (increment_[segment_]) {
74+
value_ = Mix(a_, b_, Interpolate824(lut_env_expo, phase_));
75+
}
76+
return value_;
77+
}
78+
// returns the last exponential value
79+
inline uint16_t value() const { return value_; }
80+
inline uint16_t valueLin() const {
81+
return Mix(a_, b_, phase_>>16);
82+
}
83+
84+
private:
85+
// Phase increments for each segment.
86+
uint32_t increment_[ADSR_ENV_NUM_SEGMENTS];
87+
88+
// Value that needs to be reached at the end of each segment.
89+
uint16_t target_[ADSR_ENV_NUM_SEGMENTS];
90+
91+
// Current segment.
92+
size_t segment_;
93+
94+
// Start and end value of the current segment.
95+
uint16_t a_;
96+
uint16_t b_;
97+
uint16_t value_;
98+
uint16_t priorValue_;
99+
uint32_t phase_;
100+
101+
DISALLOW_COPY_AND_ASSIGN(ADSREnvelope);
102+
};
103+
104+
} // namespace braids
105+
106+
#endif // BRAIDS_ENVELOPE_H_

0 commit comments

Comments
 (0)