Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing dsp.be changes and docs update #50

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ targets/esp32/scripts.tar
targets/esp32/recovery/dependencies.lock
targets/esp32/app/dependencies.lock
targets/esp32/app/spiffs/*
targets/esp32/ota_checksum.txt
web/package-lock.json
web/yarn.lock
py/
18 changes: 15 additions & 3 deletions docs/technical/dev-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,20 @@ If you are on macOS then we can do this with `brew`:
brew install OpenSSL PortAudio
```

If you are on Ubuntu/Debian you can install with:
#### Needed libs on Linux
If you are on Ubuntu/Debian you can install this with:
```
sudo apt install libmbedtls-dev protobuf-compiler openssl libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0
```

#### Needed libs on Linux
When building on linux you will also need the follwoing dependency: `libavahi-compat-libdnssd-dev`.
When building on linux you will likely also need the follwoing dependency: `libavahi-compat-libdnssd-dev`.
This can be installed by
```
sudo apt-get install libavahi-compat-libdnssd-dev
```

both can be installed with a package manager.

#### ESP32-Specific dependencies

- `esp-idf` in version `4.4.1`. Please follow [Espressif's guide](https://docs.espressif.com/projects/esp-idf/en/v4.4.1/esp32/get-started/index.html#get-started-get-prerequisites).
Expand Down Expand Up @@ -117,6 +119,16 @@ For a desktop run, please run the following commands
This will output a binary `euphoniumcli` which can be later executed to run the platform. The web-ui will be available on port `80` by default.
If you have trouble using port 80 (on Linux for example), use `cmake .. -D HTTP_SERVER_PORT=8080` to change the web-ui port.

#### Hint for Linux Mint
In order for the CLI build to work on Linux Mint I had to add a little extra CLI arg to the `cmake` command, as it doesn't know how to find the correct library it would seem.
Maybe this could be added directly into the `cmake` setup?

To fully compile the `cli` on Linux Mint execute the following
```
cmake -DCMAKE_CXX_STANDARD_LIBRARIES="-lX11 -ldl" ..
make
```

### Building and installing the project - ESP32

For ESP32 target, please run following commands (with esp-idf in the PATH)
Expand Down
16 changes: 8 additions & 8 deletions euphonium/scripts/esp32/dacs/ma12070p_driver.be
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ class MA12070P : DACDriver
def init_i2s()
# PINOUT: SDA: 23, SCL: 22, SDATA: 26, LRCLK: 25, BCLK: 5
# All of I2S init logic goes here

var ADDR = 0x20

var config = I2SConfig()
config.sample_rate = 44100
config.bits_per_sample = 32

# MCLK: 22.58MHz @ 44.1KHz - sufficient for running the dedicated dsp!
config.mclk = 512
config.mclk = 512
config.comm_format = I2S_CHANNEL_FMT_RIGHT_LEFT
config.channel_format = I2S_COMM_FORMAT_I2S

Expand Down Expand Up @@ -53,10 +53,10 @@ class MA12070P : DACDriver

# Init done.

# Unmute Amplifier
# Unmute Amplifier
gpio.digital_write(self.get_gpio('mutePin'), gpio.HIGH)
sleep_ms(300)
volume_strip = LEDStrip(0, 4, 12, 0, 10)
volume_strip = LEDStrip(0, 4, 12, 0, 10)
end

def unload_i2s()
Expand All @@ -71,7 +71,7 @@ class MA12070P : DACDriver
var volume_step = volume / 100.0
var actual_volume = int(volume_step * 32)

var ADDR = 0x20
var ADDR = 0x20

# Write it..
i2c.write(ADDR, 64, self.volume_table[actual_volume])
Expand All @@ -80,7 +80,7 @@ class MA12070P : DACDriver

def make_config_form(ctx, state)
ctx.create_group('MA12070P_pins', { 'label': 'DAC binary pins' })

ctx.number_field('enablePin', {
'label': "Enable Pin",
'default': "0",
Expand Down Expand Up @@ -140,7 +140,7 @@ gpio.register_encoder(20, 2, def (interaction)
euphonium.apply_volume(local_volume)
end)

euphonium.on_event(EVENT_VOLUME_UPDATED, def (volume)
euphonium.on_event(EVENT_VOLUME_UPDATED, def (volume)
local_volume = volume
show_led_volume(volume)
end)
2 changes: 1 addition & 1 deletion euphonium/scripts/extensions.be
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# # dsp.add_mono_downmix()
dsp.set_gain_db(-5)
# dsp.add_biquad(dsp.CHANNEL_LEFT, dsp.BIQUAD_TYPE_LOWSHELF, { 'f': real(0.00566893424), 'g': 3, 'q': 0.7 })
# dsp.add_biquad(dsp.CHANNEL_RIGHT, dsp.BIQUAD_TYPE_LOWSHELF, { 'f': real(0.00566893424), 'g': 3, 'q': 0.7 })
# dsp.add_biquad(dsp.CHANNEL_RIGHT, dsp.BIQUAD_TYPE_LOWSHELF, { 'f': real(0.00566893424), 'g': 3, 'q': 0.7 })
4 changes: 3 additions & 1 deletion euphonium/scripts/internal/dsp.be
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class DSPProcessor
var BIQUAD_TYPE_PEAK
var BIQUAD_TYPE_LOWSHELF
var BIQUAD_TYPE_HIGHSHELF
var BIQUAD_TYPE_PEAKING_EQ

def init()
self.CHANNEL_LEFT = 0
Expand All @@ -21,6 +22,7 @@ class DSPProcessor
self.BIQUAD_TYPE_PEAK = 3
self.BIQUAD_TYPE_LOWSHELF = 4
self.BIQUAD_TYPE_HIGHSHELF = 5
self.BIQUAD_TYPE_PEAKING_EQ = 6
end

def clear_chain()
Expand All @@ -44,4 +46,4 @@ class DSPProcessor
end
end

dsp = DSPProcessor()
dsp = DSPProcessor()
3 changes: 2 additions & 1 deletion targets/esp32/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
.vscode
sdkconfig
sdkconfig.old
sdkconfig.old
**/**/*.component_hash