Skip to content

Commit

Permalink
Creating build with more defaults baked in
Browse files Browse the repository at this point in the history
  • Loading branch information
TooDissing committed Aug 10, 2022
1 parent d3ea85a commit b9d49d4
Show file tree
Hide file tree
Showing 5 changed files with 203 additions and 10 deletions.
8 changes: 4 additions & 4 deletions docs/source/requirements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Acoustics
*********
With this project it is not the goal to create another `boombox <https://en.wikipedia.org/wiki/Boombox>`_, with over attenuated lows (bass) and highs (treble) as this will quickly result in listening fatigue. This is also called a `smiley face curve <https://en.wikipedia.org/wiki/Smiley_face_curve>`_.

However a slight bass boost at lower SPL levels to accommodate for the non-linear human hearing will make the speaker sound natural a lower sound pressure levels (SPL). This boost should be less pronounced at higher SPL levels; the dynamic part of this requirement can become hard to realize, but it will make for a much more appealing listening proposition.
However a slight bass boost at lower SPL levels to accommodate for the non-linear human hearing will make the speaker sound natural at lower sound pressure levels (SPL). This boost should be less pronounced at higher SPL levels; the dynamic part of this requirement can become hard to realize, but it will make for a much more appealing listening proposition.
A non exhaustive lists of further considerations:

.. acoustic-requirements-start
Expand Down Expand Up @@ -81,13 +81,13 @@ We also want to add a few more limitations to this design goal. The maximum SPL

* and should avoid clipping

We have settle on **100dB of maximum SPL** for this small speaker. This will be more than sufficient for must small and medium sized rooms.
The implementation of this requirement will affect (limit) the frequency response of the speaker. Most drivers can play down to 20Hz, but maybe not a great volume. So by limitting the frequency band we can push the drivers to higher SPL levels.
We have settle on **100dB of maximum SPL** for this small speaker. This will be more than sufficient for most small and medium sized rooms.
The implementation of this requirement will affect (limit) the frequency response of the speaker. Most drivers can play down to 20Hz, but maybe not at great volume. So by limitting the frequency band we can push the drivers to higher SPL levels.

Frequency response
------------------

It should be pleasent to listen to this speaker and at the same time you should be able to get an "audio experience". So no smiley curve frequency response, nor overly exaggerated lows; i.e. this is not a boom box. We are looking to implement a hi-fi speaker with fairly linear frequency response.
It should be pleasent to listen to this speaker and at the same time you should be able to get an "audio experience". So no smiley curve frequency response, nor overly exaggerated lows; i.e. this is not a boom box. We are looking to implement a "hi-fi" speaker with fairly linear frequency response.

A requirement of a linearity within ±4dB isn't perfect, but it is a pretty decent middle ground.

Expand Down
10 changes: 5 additions & 5 deletions software/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,8 @@ copy-config:
@echo "Copying local cofig"
cp ${COPY_FLAGS} config/* euphonium/

ifeq ($(origin IDF_PATH),undefined)
esp32: copy-config
bash -c "source ${IDF_HOME}/export.sh; cd euphonium/targets/esp32; sh generate_full_build.sh;"
else
esp32: copy-config
cd euphonium/targets/esp32; sh generate_full_build.sh;
endif

cli: copy-config
cd euphonium/targets/cli/build; cmake ${CMAKE_BUILD_ARGS} ..;
Expand All @@ -37,6 +32,10 @@ flash-all: esp32
@echo "flashing using this port '${JTAG_PORT}'"
cd euphonium/targets/esp32; sh flash_all.sh ${JTAG_PORT};

flash-spiffs: copy-config
@echo "flashing using this port '${JTAG_PORT}'"
cd euphonium/targets/esp32; sh reflash_spiffs.sh ${JTAG_PORT};

clean: clean-cli clean-esp32

clean-cli:
Expand All @@ -49,3 +48,4 @@ monitor:
cd euphonium/targets/esp32; sh monitor.sh ${JTAG_PORT};

flash-and-monitor: flash-all monitor
flash-spiffs-and-monitor: flash-spiffs monitor
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class MA12070P : DACDriver

#self.volume_table = [255, 160, 100, 90, 80, 70, 65, 60, 57, 54, 51, 48, 46, 44, 42, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24]

self.volume_table = [255, 160, 100, 90, 80, 70, 65, 60, 57, 54, 51, 48, 46, 44, 42, 40, 38, 36, 34, 32, 30, 28, 26, 24, 22, 20, 19, 18, 17, 16, 15, 14]
self.volume_table = [255, 160, 100, 90, 80, 70, 65, 60, 57, 54, 51, 48, 46, 44, 42, 40, 38, 36, 34, 32, 30, 28, 26, 24, 22, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]

self.name = "MA12070P"
self.hardware_volume_control = true
Expand Down
143 changes: 143 additions & 0 deletions software/config/euphonium/scripts/esp32/hardware_plugin.be
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
import math

class HardwarePlugin : Plugin
var registered_drivers
var selected_driver

def init()
self.registered_drivers = []
self.apply_default_values()

self.name = "hardware"
self.display_name = "Hardware"
self.type = "system"
self.selected_driver = nil
self.is_audio_output = true
end

def make_form(ctx, state)
var drivers = []

for driver : self.registered_drivers
drivers.push(driver.name)
end

ctx.create_group('boardGroup', { 'label': 'Board' })
board_names = []
for board : ESP32_BOARDS
board_names.push(board["name"])
end
ctx.select_field('board', {
'label': "Select your board type",
'default': "custom",
'group': 'boardGroup',
'values': board_names,
'type': 'number'
})

# if the user has selected a board, show a dialog asking if he wants to
# change the gpio settings to this board
if state.find("board") != self.state.find("board")
ctx.modal_confirm("boardChanged", {
'label': "Board changed",
'hint': "The board you selected has changed to " + state.find("board") + ". Do you want to apply the new settings?",
'group': 'boardGroup',
'default': nil,
'okValue': "confirmed_" + state.find("board"),
'cancelValue': "cancelled_" + state.find("board")
})
if state.find("boardChanged") == "confirmed_" + state.find("board")
state["boardChanged"] = "cancelled_" + state.find("board")
for board : ESP32_BOARDS
if board["name"] == state.find("board")
# copy the state defined for the board
for key : board["state"].keys()
state.setitem(key, board["state"][key])
end
break
end
end
end
end

ctx.create_group('driver', { 'label': 'DAC Driver' })


ctx.select_field('dac', {
'label': "Select DAC chip driver",
'default': "dummy",
'group': 'driver',
'values': drivers,
'type': 'number'
})
for driver : self.registered_drivers
if driver.name == state['dac']
print("Found driver", driver)
print("driver.make_config_form", driver.make_config_form)
if driver.datasheet_link != nil && driver.datasheet_link != ""
ctx.link_button('datasheet', {
'label': "Datasheet",
'link': driver.datasheet_link,
'group': 'driver',
'placeholder': 'PDF'
})
end
driver.make_config_form(ctx, state)
break
end
end



end

# register driver implementation
def register_driver(driver)
self.registered_drivers.push(driver)
end

def select_driver(driver_name)
if (self.selected_driver != nil)
i2s.set_readable(false)
self.selected_driver.unload_i2s()
end

for driver : self.registered_drivers
if driver.name == driver_name
self.selected_driver = driver
self.selected_driver.state = self.state
self.selected_driver.init_i2s()
i2s.set_readable(true)
end
end
end

def init_audio()
end

def has_hardware_volume()
if self.selected_driver != nil
return self.selected_driver.hardware_volume_control
end
return false
end

def on_event(event, data)
if event == EVENT_CONFIG_UPDATED
self.select_driver(self.state['dac'])
end

if event == EVENT_VOLUME_UPDATED
if self.selected_driver != nil
self.selected_driver.set_volume(data)
else
print("Attempt to set volume on unselected driver")
end

end
end
end

var hardware = HardwarePlugin()

euphonium.register_plugin(hardware)
50 changes: 50 additions & 0 deletions software/config/euphonium/scripts/plugin/cspot.be
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
class CSpotPlugin : Plugin
def init()
self.apply_default_values()
self.name = "cspot"
self.theme_color = "#1DB954"
self.display_name = "Spotify Connect"
self.type = "plugin"
end

def make_form(ctx, state)
ctx.create_group('spotify', { 'label': 'General' })

ctx.text_field('receiverName', {
'label': "Speaker's name",
'default': "STRØM 1.0",
'group': 'spotify'
})
ctx.select_field('audioBitrate', {
'label': "Audio bitrate",
'default': "320",
'values': ['320', '160', '96'],
'group': 'spotify'
})
ctx.checkbox_field('overrideAp', {
'label': "Override access point address",
'default': "true",
'group': 'spotify'
})

if state.find('overrideAp') != nil && state['overrideAp'] == 'true'
ctx.text_field('apAddress', {
'label': "Access point address",
'default': "ap-gew1.spotify.com:4070",
'group': 'spotify'
})
end
end

def on_event(event, data)
if event == EVENT_SET_PAUSE
cspot_set_pause(data)
end

if event == EVENT_VOLUME_UPDATED
#cspot_set_volume_remote(data)
end
end
end

euphonium.register_plugin(CSpotPlugin())

0 comments on commit b9d49d4

Please sign in to comment.